Parameteric Audio Equalizer for ARM Cortex-M Processor
This example shows how to generate and run the optimized code of a parametric audio equalizer on ARM® Cortex®-M processor while adjusting equalizer response from within Simulink® environment. The optimized code uses CMSIS DSP library for the biquad filter in the equalizer.
Parametric equalizers are often used to adjust the frequency response of an audio system. For example, a parametric equalizer can be used to compensate for physical speakers which have peaks and dips at different frequencies.
The CMSIS DSP library contains a set of optimized signal processing algorithms for ARM Cortex-M processors. This example shows how to optimize the generated code of a parametric audio equalizer with code replacement of CMSIS DSP library for ARM Cortex-M processors.
To configure the example model, build and run it in external mode for real-time audio processing, please follow the steps in example Parametric Audio Equalizer for STM32F4-Discovery Board, which requires the installation of STMicroelectronics® STM32F4-Discovery Support Package.
Required MathWorks Products:
Before you start with this example, install these MathWorks® products:
DSP System Toolbox™
Embedded Coder Support Package for ARM Cortex-M Processors
Embedded Coder Support Package for STMicroelectronics Discovery Boards
DSP System Toolbox Support Package for ARM Cortex-M Processors
STMicroelectronics STM32F4-Discovery Board
Headphones or speakers
Audio input source
Audio Input, Signal Processing and Audio Output
1. The input audio signals are generated using the on board MEMS microphone, which produces a Pulse Density Modulated (PDM) signal.
2. The Audio signal with int16 data type is scaled and cast to single precision. Then, it is processed using a 3-band parametric audio equalizer, which consists of a second-order (bi-quadratic) filter whose coefficients can be adjusted to achieve a desired frequency response. A graphical user interface (GUI) is provided to assist run-time adjustment of the filter coefficients.
3. The processed audio signal is scaled and cast to integer before being sent to the STM32F4 Discovery Audio out block, which configures the peripheral of the STM32F4 processor % to send a stream of data to the on board audio output connector.
4. The adjustment effects of the filter coefficients can also be visualized in the spectrum analyzer.
Generate and Execute the Optimized Code on ARM Cortex-M Processor
To configure, build and run the model in external mode for real-time audio processing, please follow the steps in example Parametric Audio Equalizer for STM32F4-Discovery Board.
When the build finishes, you can examine the code generation report. Click on the stm32f4discovery_audio_equalizer.c file. Notice the CMSIS DSP Library function calls, arm_biquad_cascade_df2T_init_f32 and arm_biquad_cascade_df2T_f32 in the generated C code.