-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Optimize audio pathway #10079
Comments
Thanks for creating this issue. When I first started on effects there was discussion about a common utility library (in one of the base audio objects) and I think now that we see the commonalities it would be a good time to revisit that idea. I really like the idea of a common internal audio pathway format for CircuitPython (16-bit, signed, stereo would be my vote). I think we have to leave sample rate variable but I have never seen code saying The other concept I'd like to consider is how we use buffers per audio object. They are not huge but enough of them could add-up for RAM usage and I'm not sure the benefit. In audiomixer the initial reason was to provide a buffer in case the core was busy so the audio did not stutter. But having a buffer per audio component does not help that any more then 1 buffer. Is this a case of a "buffer" object like mixer at the root of the audio (requesting say 256 byte samples from the rest) or something else I'm not sure on. If that isn't clear what I'm envisioning is: Another potential benefit is if we standardize on a set buffer size (like synth has) the user can choose what works for them as a larger buffer can take away time from the core processing as everything stops as we run the audio chain. tl;dr
|
I think that's the only real option here.
There are any specific sample rate checks that I'm aware of, but a lot of the
Those chipsets will have to put some work into converting the signed 16-bit buffers into 8-bit unsigned output. There may be other potential platforms, but I think the ESP32
The audiosample API currently operates with buffered output in mind, so I'm not sure if a change like this would result in a change to the current
Tbh, I've always thought that these effects would make more sense in a shared
Let's hope! But a lot of these changes are going to need to be at least 10.x.x. When doing a restructure like this within CPy, is it typical to wait until a major release or to create the new modules and point the old ones to the new modules with a deprecation notice? |
Couple other thoughts (not sure if they are great or bad ideas yet):
|
A couple of thoughts on internal sample data type (that would have to target CP 10):
|
Currently, each object which utilizes the audiosample API is required to support multiple formats and manage common audio tasks independently. In order to reduce flash size, complexity, and the barrier to entry to create new audiosample objects (namely audio effects), the audio pathway should be streamlined by using a single format and adding shared resources for general audio processing tasks. These optimizations include but are not limited to the following lists. Feel free to suggest other areas of improvement.
For all audio objects:
For audio effects objects:
If these updates are carried out, some audio object constructor arguments and properties may need to be deprecated such as
bits_per_sample
andsamples_signed
as they will be dictated by the output.sample_rate
andchannel_count
are likely to still be necessary per object.This issue was inspired by the discussion within #10052 with @jepler and @gamblor21.
The text was updated successfully, but these errors were encountered: