-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Why are audioio
and audiopwmio
separate?
#4257
Comments
@tannewt @ladyada what do you think about hiding whether DAC or PWM is used, and leaving it up to the build flags to pick? This could be a 7.0.0 breaking change, or we could be back-compatible for a while, and then remove |
I'd rather not hide the implementation because it has noticeable quality differences and impacts external design (adding an external filter for PWM audio). This is similar to bitbangio vs busio. It's better to be explicit. It's important to note I2SOut is identical except for the constructor. Managing what audio form you want to output should be expected. My preference would be to split touchio instead of modelling after it. I think it's more important for the native API to be clear than to not require two imports. |
May I comment that Also, managing what audio form to output is trivial when there's only one audio form available on any board: "you can choose any colour so long as it is black", so to say. |
You are right that
I think the above Arduino does this magic use a DAC or PWM for |
The hardware reference design for the Pico/RP2040 ( https://datasheets.raspberrypi.org/rp2040/hardware-design-with-rp2040.pdf ) has a board in chapter 3 with both analogue PWM and digital I2S. So hiding the difference between the two technology might not help there. |
These two standard modules implement exactly the same API.
None of the boards in https://circuitpython.readthedocs.io/en/latest/shared-bindings/support_matrix.html has both of them. If ever there appears a board that needs both,
AudioOut
constructor can select the implementation appropriate for the passed pin.Thus, renaming
audiopwmio
toaudioio
, andPWMAudioOut
toAudioOut
, will not cause any conflicts, and will allow for more portable CircuitPython code, avoiding hacks such as in the example given in https://learn.adafruit.com/adafruit-circuit-playground-express/circuitpython-audio-outThe text was updated successfully, but these errors were encountered: