Clock Radio
MP3 Decoding with Helix
It’s kinda working!
The stuttering is partly due to slow SD reads and partly due to what is probably an off by one error in the read routines. But this little thing can indeed decode MP3s with the Helix library.
But it doesn't seem like it has any problem decoding in realtime.
Second attempt:
To solve the stuttering problem I moved the file reading to a separate task. FreeRTOS has a convenient StreamBuffer object to send bytes between tasks. I struggled a bit with StreamBuffer (they somewhat annoyingly consume bytes opportunistically) but once I got it working the SD card could easily keep up with supplying bytes while the main task decoded and shoveled samples out through I2S.
I'll see if I can do FLAC next. I'm pretty sure FLAC is integer only so it should run fine. The challenge will be seeing if I can read the SD card fast enough via SPI.
MP3s top out at 320kbps. FLAC is up to like 1400kbps.