Closed FoamyGuy closed 4 years ago
This is working and passing the CI now. I think there are a few open questions related to it that come to mind for me:
play_mp3
play_file
ultimately get renamed to play_wav
@FoamyGuy Yes to the unsupported - you can add it to the current list the same way the other two are already there. No to the rename, unless you can think of a seamless to make it so both names work - we don't want to break all the current code.
Thank you @kattni the latest commit makes play_mp3
use _unsupported
in the express module.
Here's how it works on the cpx now:
>>> from adafruit_circuitplayground import cp
>>> cp.play_mp3("test.mp3")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "adafruit_circuitplayground/express.py", line 82, in _unsupported
NotImplementedError: This feature is not supported on Circuit Playground Express.
I have learned a ton recent about structuring modules by working on this and the pybadger library. Thanks for making these so easy to extend with new functionalities :smile:
@FoamyGuy This is great! I'd like you to add one more thing - an example in the examples
folder. Please name it circuitplayground_bluefruit_play_mp3.py
and include a doc string similar to the one found in this file: https://github.com/adafruit/Adafruit_CircuitPython_CircuitPlayground/blob/master/examples/circuitplayground_bluefruit_loud_sound.py
Thanks!
This adds a
play_mp3
function that is analogous toplay_file
but supports mp3 files instead of wav.The module required for mp3 playback
audiomp3
isn't available on the CPX, so this function is available only to CPB devices.Example usage: