Unfortunately the available memory on Microcontrollers is quite restricted and we do not get very far by storing a (uncompressed) WAV file e.g. in program/flesh memory, so I started to look into compressed audio formats.

On the desktop we can use the FFmpeg project which comes with a rich set of functionality. Unfortunately the situation is much more fragmented for Microcontrollers.

I started to collect the relevant libraries and in order to make things simple to use I also added a simple C++ API on top of the available libraries:

  • libhelix A MP3 and AAC Decoder from Realnetworks
  • fdk-aac A AAC Encoder and Decoder from the Frauenhofer Institute
  • libmad A open source MP3 Decoder from Underbit
  • liblame A open source MP3 Encoder uing LAME

All these projects can be used as Arduino Libraries, but they compile and work also outside of Arduino with the help of cmake.

I am also providing an integration into my Arduino Audio Tools where you can use these libraries with the EncodedAudioStream class:

#include "Arduino.h"
#include "AudioTools.h"
#include "AudioCodecs/CodecMP3Helix.h"
#include "BabyElephantWalk60_mp3.h"

using namespace audio_tools;  

MemoryStream mp3(BabyElephantWalk60_mp3, BabyElephantWalk60_mp3_len); // MP3 data source
I2SStream i2s; // final output of decoded stream
EncodedAudioStream dec(new i2s, new MP3DecoderHelix()); // Decoding stream
StreamCopy copier(dec, mp3); // copy in to out

void setup(){



void loop(){
  if (mp3) {

The setNotifyAudioChange method is making sure, that the I2S settings are updated with the audio Information (channels, bits per sample, audio rate) based in the information provided by the decoder.


John Taipei · 2. September 2021 at 19:20

Hello Sir:
my English is poor

I have a idea that Long Range Walkie Talkie (500~1000meters)
audio–>INMP441–>esp32–>LoRa–>TX 443MHz
RX 443MHz–>LoRa–>esp32–>Max98357–>audio
Hardware is ready

but I can not write code
I am good at hardware not software

May I have chance to work with you??


    pschatzmann · 3. September 2021 at 11:01

    If you are not in a hurry I might be able to help you. What have you tried so far ?
    I suggest to have a look at my https://github.com/pschatzmann/arduino-audio-tools library. You should find all necessary building blocks there and you might even exchange the esp32 e.g with a Rasperry Pico.

    I am just worried about LoRa: Telephone quality is at min 8000 hz. With 16bit data this gives 128 kbps which is way above what you can achieve with LoRa.
    So we might be forced to use MP3 or AAC which will add complexity and delays…

Leave a Reply

Avatar placeholder

Your email address will not be published.