MP3 DECODING INTO NATIVE FILE.

Hi Engineers, 

I am developing an MP3 player for which I need help to convert mp3 files available in SD card into native file and to transmit through i2s to the DAC.

I tried playing .WAV formatted file, it is able to play but still have some glitches and tick sounds with it.

However the .WAV is very large in size so i want to use mp3 files. 

Before sending into DAC the mp3 file has to be converted to uncompressed form.

Please help me, suggest me how to do it.

Thanks.

  • Big uncompressed wav files should not be a problem - SD cards can be 256GB and bigger. Some buffering required, SD card read time can be surprisingly long.

    The NRF52840 is a bit too slow for real time MP3 decompression - have not tried the NRF5340 yet.

    But on the 600 MHZ Teensy 4.x it took roughly 50% CPU time to decompress a high quality MP3 file from SD card.

  • Hi Turbo j,

    It is fine if it is too slow, I just want to use an MP3 file of less than 100KB.

    The hardware that I have is nrf52840, SD card Module and NXP's DAC module.

    So please suggest me how should I process MP3 file. 

    Thanks, and regards

    Ajmal

  • Hi Ajmal

    Unfortunately we don't have any examples showing how to do mp3 decompression on the nRF devices. 

    As mentioned by Jörg this is a pretty CPU and memory intensive operation, and you might not be able to do this efficiently in the nRF52840 even if you manage to find a library to do it. 

    What kind of bit depth and sample rate are you using? 
    It should be possible to playback CD quality wave files directly from an SD card, as long as the communication with the SD card is handled efficiently. 

    Another option is to use the new LC3 codec which is the basis for the new LE Audio standard. LC3 is supported on our devices, and is less CPU intensive meaning you can run it realtime on the nRF52 series. 

    Best regards
    Torbjørn

  • There is a github project minimp3 that is basically just a header file with the decoding functions.

    Warning: Needs roughly 24KB stack when used in a zephyr thread - lots of temporary buffers.

    The high level decoders (with stdio file etc) won't work in zephyr or nordic SDKs, but they are useful as example how the low level decoder is supposed to operate.

Related