Skip to main content
Claramae
Visitor II
August 8, 2026
Question

Optimizing Throughput for High-Fidelity (320kbps) MP3 Decoding on STM32 Systems

  • August 8, 2026
  • 1 reply
  • 74 views

Hi everyone,

I’ve been working on some firmware lately for a media-based project, and I’m looking at the practical limits of decoding high-fidelity mp3 streams (specifically 320kbps CBR) on mid-range MCUs like the STM32U5 series.

While standard 128kbps streams are easy enough to handle, moving to the 320kbps standard introduces some interesting challenges regarding the DMA (Direct Memory Access) buffer size and the overhead of the file system (FatFS) when reading from an SD card.

I’d love to get some insights from the community here on a few technical points:

  1. Buffer Management: For a stable 320kbps mp3 playback without stutter, what is your preferred double-buffer size to minimize SAI (Serial Audio Interface) underruns?

  2. Hardware vs. Software Codecs: Are most of you using dedicated external hardware decoders for high-fidelity audio, or are you achieving stable results using software libraries like Helix or minimp3 on the Cortex-M33 core?

  3. Power Optimization: Since 320kbps requires more frequent SD card reads compared to lower bitrates, have you found a specific 'sweet spot' for the clock speed to balance audio integrity and power consumption?

Looking forward to hearing about your architectures and any 'lessons learned' from handling professional-grade audio on embedded systems!

Best regards,

Clara MAe

1 reply

AScha.3
Super User
August 9, 2026

Hi Clara,

nice to see someone doing some audio stuff (and writing here..).

And this audio stuff is just my hobby (at work only controlling machines, inverters etc.).

So i made an audio player, similar old CD player : plays wav, flac, MP3 files from 2 SD-cards or USB, or Web-Radio, to 6ch DACs , with IR remote control and small TFT display.

About your performance questions: i run my player on H743 now, had it on F411 at first, but so low on RAM … .

Clock is only 200M , as its more than enough and keeps cpu cool , about +4° from ambient.

The MP3 decoder is miniMP3 in float, output always 32 bit (because ES9038 DAC 32bit type).

CPU load on F411 was about 30% (at 100MHz), minimp3 i float , decoding 128kbit.

So i would say, it needs about 30M cpu time to decode 128kbit MP3 in float, maybe about 70M for 320kbit. 

From my buffer setting i just can tell my actual state:

  • i use 4K sample buffers, so 2x 16KB circular for a 2ch SAI 32bit output ( 3 SAI running for 3 DACs)
  • this giving about 40ms time , to fill a buffer at 44k1 or 48k ; at 96k about 20ms
  • input buffer from SDcard is 128K , for MP3 then extra 8K input and 128K output buffer.
  • this also in use when playing MP3 from WiFi (connected to ESP8266 over SPI with separate buffers)
  • after playbuf is filled, the biquad filters run, to get the crossover and correction (all in float)

BUT...everything was running fine, but since some time now a strange problem with the MP3 at 224 or 320k :

seems there are dropouts every 2 or 3 seconds, but no clear noise or tick, just the rhythm of the music is spoiled a little bit, 

sounds as if there are bad musicians, that cannot keep a constant beat. The real problem is: i cannot remember, what i changed, what created the problem then. I moved the buffers in RAM areas, changed some buffer sizes , mod flash loader script, etc. - so impossible to remember , what created the hiccup.

And important : always with optimizer -O2 , otherwise...no fun.

+

SD-card :   (2x SDMMC interface on H743 , was 1x SDIO 4bit on F411 , about 4MB/s read speed (8KB blocks)

I have it in 4bit mode , no DMA , get about 16MB/s effective (= reading in 64KB blocks);

sdcard having 0.5..1ms delay , from command to data coming, so reading very small blocks is wasting time. And sometimes -on old, used cards- can be a delay up to 100ms (!) until data is coming , thats why big RAM area in CPU is fine, the more, the better. :)

+

Maybe i move for a new design , maybe STM32H5E5  , 1.5MB RAM .

+this is the actual:

 

If you feel a post has answered your question, please click on " Best Answer ".