This example shows how to model an algorithm specification for a three band parametric 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 parametric equalizer algorithm in this example provides three second-order (biquadratic) filters whose coefficients can be adjusted to achieve a desired frequency response. A user interface (UI) is used in simulation to dynamically adjust filter coefficients and explore behavior.
This example will describe how the parametric equalizer algorithm is specified and how the behavior can be explored through simulation.
In this example, the equalizer is implemented in the Equalizer subsystem of the model. In this subsystem, the input is passed through three cascaded bands of equalization. Coefficient changes within each band are smoothed through a leaky integrator before being passed into a Biquad Filter block.
This example allows tuning of each equalizer band's center frequency, bandwidth, and peak (or dip) gain. The bandwidth is defined at the arithmetic mean between the base of the filter (1 in this example) and the peak power value. The specifications of the three bands are in the Specifications subsystem. These specifications are converted to Biquad coefficients using a MATLAB Function block. The coefficients of a particular band are recomputed whenever any of that band's specifications are modified.
A UI designed to interact with the simulation is provided with the model and can be launched by clicking the 'Launch Parameter Tuning UI' link. The UI allows you to tune the equalizer specifications and the results are reflected in the simulation instantly.
When you simulate the model, you will visualize the equalizer's response on a scope. The response is computed using a Discrete Transfer Function Estimator block. The response will change as you tune the equalizer specifications. You can also listen to either the orignial or equalized audio by toggling the manual switch.
To learn how to generate C code for the equalizer subsystem based on the algorithm specifications, see the dspparameqcodegen example.
To learn how to convert the Equalizer subsystem to fixed point using the Fixed-Point Advisor, see the dspparameqflt2fix example.