Main Content

Compressed audio can be a nice alternative to uncompressed WAV files, especially when you have a small filesystem like that on many CircuitPython boards, as WAV files get sizeable quite quickly. You can listen to a much longer playlist with CircuitPython, using the built in MP3 playback capability!

CircuitPython supports any MP3 file, as long as it is the right bit rate and sample rate for your board.

Mono and stereo files less than 64kbit/s work, with sample rates from 8kHz to 24kHz. The RP2040 has a PWM output with 10 bits, so there’s not much point in using high bit rates.

Be aware, doing things like updating a display, or having intense flash activity like reading and writing files can result in distorted sounds or noise during playback.

You can find an example of converting an MP3 file using Audacity in this guide. The parameters suggested above may not be exactly what’s in the guide, but the concept will be the same.”

Link to article