Skip to main content

minimp3-decode

:::warning [UNTESTED] native_sim build + run verified locally — the console prints [minimp3-decode] done. No on-silicon / HiL bench validation yet. :::

Decode a canned MP3 byte array to 16-bit PCM with the vendored minimp3 single-header decoder.

Source: examples/audio/minimp3-decode/.

What it does

mp3dec_init(), then a loop of mp3dec_decode_frame() over a 300-byte MP3 array embedded in main.c. Per frame it prints the sample count, channel count, and sample rate; at the end it prints the total sample count and RMS.

No I²S or codec hardware is required, so this builds and runs identically on native_sim and on real silicon — it is pure compute.

Where this leads

To turn this into a player, feed the decoder's pcm / samples / info.hz output into the I²S write path from i2s-tone (BOARD_I2S_AUDIO). That is the only board-specific step — a real player would also add i2s to peripherals:.

board.yaml

libraries:
- name: minimp3
cores: [m55_hp]

som:
sku: E1M-AEN801

preset: e1m-evk

cores:
m55_hp:
app: ./src
peripherals: []

diagnostics:
log_level: info

libraries: [minimp3] is the per-core §D.lib form — distinct from the top-level ADR 0018 libraries: key — and pulls the library's Kconfig knobs from its profile. The pure-C software fallback is the floor; DSP/SIMD backends are selected automatically when the SoM capability is present.

Console output

The example's README documents a verified run rather than a fixed output block. The lines main.c prints are:

[minimp3-decode] alp-sdk minimp3-decode starting
[minimp3-decode] decoded frame: <n> samples, <n> ch, <n> Hz
[minimp3-decode] total samples=<n> rms=<f>
[minimp3-decode] done

See also

Questions about this page? Discuss in Community Forum