This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

How to use nRF52 series to play mp3 audio file

Hello Sir,

I will use Nordic nRF52 series(832 or 840) to develop smart bluetooth device. As I need to store mp3 audio files in external flash and then will play mp3 audio file to drive speaker. Do I need to add external DAC (or mp3 decoder) and audio amplifier to meet this requirement? Please suggest decoder and audio amplifier to me for reference. Thanks.
Best Regards,

Thomas

  • Hi,

    I am not aware of any implementations of an MP3 decoder on an nRF52 device, but it may be possible depending on the complexity. There may be other more suitable codecs (such as Opus or similar) if you do not require MP3 specifically. You could use the PWM peripheral to output simple audio, but you may find that an external DAC is needed for good quality audio.

    Perhaps someone from the community has experience with this and want to comment?

  • Hi Einar,

        Thanks for your information.

       I want to verify the below flows of playing Opus audio format on nRF 52 series as below:

    Case1(simple audio). nRF52 (store opus audio format on external flash) > use PWM to output simple audio > to audio amplifier to drive speaker

    Case2(good quality audio). nRF52 (store opus audio format on external flash)> use( PWM or other I/O port)  to output to external DAC > to audio amplifier to drive speaker

    My flows are corrected or not? Please advise

    For case 2, we use PWM or other I/P to output to external DAC? Please advise. Thanks

    Best Regards,

    Thomas

  • Hi Thomas,

    arctommy20 said:
    Case1(simple audio). nRF52 (store opus audio format on external flash) > use PWM to output simple audio > to audio amplifier to drive speaker

    We only have examples using Opus for input from a PDM microphone (in the smart remote 3 reference design), but that is a possibility. Note that after decoding you would have to convert to a PWM signal. There are no official examples of that, but it should be possible.

    arctommy20 said:
    For case 2, we use PWM or other I/P to output to external DAC? Please advise. Thanks

    No, you would not use PWM to the DAC. Most likely you would use I2S if you are on the nRF52840. Essentially you need to use an interface that is compatible with both the nRF device you use and the DAC, so you must select an appropriate DAC.

  • Hi Thomas, this is possible. For simple (voice quality) tasks, you can use PWM output (have a look a this thread: https://devzone.nordicsemi.com/f/nordic-q-a/52878/pwm-audio-driver), for high-quality output use e.g. the MAX98357A I2S amplifier. I managed to combine both with a minimalistic mp3 decoder implementation (https://github.com/lieff/minimp3) and they work great. Unfortunately I am not allowed to show full source code, though.

Related