Skip to content
Henryk Paluch edited this page Oct 8, 2023 · 2 revisions

Audio Codecs

I'm currently interested in using Audio Codecs by various MCUs and to find what are advantages and disadvantages.

What is Audio codec?

  • It is digital to analog and analog to digital audio interface.
  • when you play audio you stream digital Audio data using suitable protocol (for example I2S) and codec will filter and convert and output them as Analog. Many codecs have even Power Audio amplifier to directly connect headphones or small speaker (typical usage case on mobile devices)
  • when you record audio it goes opposite way: analog input is processed by amplifier (limiter or automatic gain amplifier) filtered and converted to digital data. These data are streamed back to CPU using suitable interface/protocol (I2S etc).

Please note that today codecs are very sophisticated:

  • they automatically oversample signal (you use for example sample rate 44kHz but codec internally multiply it to 128kHz and interpolate to smooth output and make it sounds better)
  • they have various filters (some including equalizers or wind filter on microphone input)
  • for both output and input they have soft limiter to avoid hard clipping and distortion
  • for analog input codecs offer boost amplifiers, automatic gain amplifier and limiter for best processing of microphone input

First popular codec was Intel AC97 for integrated PC Sound cards. See for example https://en.wikipedia.org/wiki/AC%2797. Please note that AC97 used older digital interface called AC-Link. Today most prevalent is I2S or similar (DSP/PCM and others).

CPUs and Audio Codecs.

So far I tested:

However I plan to also test 32F769IDISCOVERY:

To understand STM32 + WM8994 you have to study at least under STM32Cube_FW_F7_V1.17.0:

Projects\STM32F769I-Discovery\Examples\BSP\Src\audio_play.c
Drivers\BSP\STM32F769I-Discovery\stm32f769i_discovery.c
Drivers\BSP\STM32F769I-Discovery\stm32f769i_discovery.h
Drivers\BSP\STM32F769I-Discovery\stm32f769i_discovery_audio.c
Drivers\BSP\STM32F769I-Discovery\stm32f769i_discovery_audio.h
Drivers\BSP\Components\wm8994\wm8994.c
Drivers\BSP\Components\wm8994\wm8994.h

Also here is really interesting page:

Clone this wiki locally