Microchip® Advanced Software Framework

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Graphic Audio Equalizer Example
Description:
This example demonstrates how a 5-band graphic equalizer can be constructed using the Biquad cascade functions. A graphic equalizer is used in audio applications to vary the tonal quality of the audio.
Block Diagram:
The design is based on a cascade of 5 filter sections.
GEQ_signalflow.gif
Each filter section is 4th order and consists of a cascade of two Biquads. Each filter has a nominal gain of 0 dB (1.0 in linear units) and boosts or cuts signals within a specific frequency range. The edge frequencies between the 5 bands are 100, 500, 2000, and 6000 Hz. Each band has an adjustable boost or cut in the range of +/- 9 dB. For example, the band that extends from 500 to 2000 Hz has the response shown below:
GEQ_bandresponse.gif
With 1 dB steps, each filter has a total of 19 different settings. The filter coefficients for all possible 19 settings were precomputed in MATLAB and stored in a table. With 5 different tables, there are a total of 5 x 19 = 95 different 4th order filters. All 95 responses are shown below:
GEQ_allbandresponse.gif
Each 4th order filter has 10 coefficents for a grand total of 950 different filter coefficients that must be tabulated. The input and output data is in Q31 format. For better noise performance, the two low frequency bands are implemented using the high precision 32x64-bit Biquad filters. The remaining 3 high frequency bands use standard 32x32-bit Biquad filters. The input signal used in the example is a logarithmic chirp.
GEQ_inputchirp.gif
The array bandGains specifies the gain in dB to apply in each band. For example, if bandGains={0, -3, 6, 4, -6}; then the output signal will be:
GEQ_outputchirp.gif
Note
The output chirp signal follows the gain or boost of each band.
Variables Description:
  • testInput_f32 points to the input data
  • testRefOutput_f32 points to the reference output data
  • testOutput points to the test output data
  • inputQ31 temporary input buffer
  • outputQ31 temporary output buffer
  • biquadStateBand1Q31 points to state buffer for band1
  • biquadStateBand2Q31 points to state buffer for band2
  • biquadStateBand3Q31 points to state buffer for band3
  • biquadStateBand4Q31 points to state buffer for band4
  • biquadStateBand5Q31 points to state buffer for band5
  • coeffTable points to coefficient buffer for all bands
  • gainDB gain buffer which has gains applied for all the bands
CMSIS DSP Software Library Functions Used:
  • arm_biquad_cas_df1_32x64_init_q31()
  • arm_biquad_cas_df1_32x64_q31()
  • arm_biquad_cascade_df1_init_q31()
  • arm_biquad_cascade_df1_q31()
  • arm_scale_q31()
  • arm_scale_f32()
  • arm_float_to_q31()
  • arm_q31_to_float()

Refer arm_graphic_equalizer_example_q31.c