Showing results for 
Search instead for 
Did you mean: 

How to reduce the size of MEMS' microphone data

Associate III


I'm using an ST's digital MEMS microphone in my application. It is connected to an STM32L452 by SPI and the acquired data is stored in an SDCard.

My sampling frequency is 32 KHz which means the microphone produces a considerable amount of data. So, I'm wondering if there is anything that I can do to compress this data within the SDCard.

Any help would be appreciated

ST Employee

Hi @Community member​ ,

I'm not an expert on audio compression techniques on STM32, but as starting point I might suggest you the X-CUBE-AUDIO package that contains a set of audio processing components for the STM32F4 and STM32F7 series (unfortunately not much for L4 family, since usually for audio processing a more powerful MCU would be preferable).

The base is the .wav format, and to reduce the size you could think to:

  • convert .wav into MP3, using the MP3 encoder (MP3Enc): encoder for MPEG-1,2 or 2.5 formats (for layer 3 only) supporting fixed or free format bit rate for mono or stereo audio input streams.
  • sampling rate converter (SRC236 and SRC441), implementing sampling frequency conversion from any rate with a ratio of 2, 3, 6, 3/2, 1/2, 1/3, 1/6, or 2/3.

Let me know if these libraries could be useful for you even if you are using an a STM32L4 MCU.


I tend to agree.

Lossy encoding standards like MP3 or OggVorbis require substantial performance.

Surely one can reduce data size per sample, and sampling frequency.

For speech comprehension, even 8kHz is enough.