Main Content

Generate Code for Parametric Audio Equalizer Model

Since R2024b

This example shows how to model an algorithm specification for a three-band parametric equalizer which is used for code generation on multiple hardware targets.

Introduction

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.

In this example, the parametric equalizer algorithm provides a second-order section (SOS) filter, allowing for the adjustment of coefficients to achieve a desired frequency response. The Parametric Equalizer Design methodology is employed to fine-tune these coefficients.

In this example, you learn:

  • How to specify the parametric equalizer algorithm.

  • How to explore parametric equalizer algorithm behavior through simulation.

  • Where to find examples that generate code for this algorithm for different hardware targets.

Explore Parametric Equalizer Behavior Through Simulation

In this example, the model ParametricAudioEqDemo includes an excitation source and specifications for each band of the equalizer (gain, center frequency, and bandwidth). These specifications may be tuned as the model is running.

To open the model, enter the following command:

modelName = "ParametricAudioEqDemo";
open_system(modelName)

Simulate the model.

sim(modelName,"StopTime","1");

Close the model.

bdclose(modelName)

Code Generation

You can generate code from this three-band parametric equalizer for hardware targets. See Parametric Audio Equalizer for Qualcomm Hexagon DSP (Embedded Coder) and Deploy Parametric Audio Equalizer on ARM Cortex-M Processors (Embedded Coder) for examples demonstrating code generation for this model on different hardware targets.

See Also