Parametric Equalizer Design

This example shows how to design parametric equalizer filters. Parametric equalizers are digital filters used in audio for adjusting the frequency content of a sound signal. Parametric equalizers provide capabilities beyond those of graphic equalizers by allowing the adjustment of gain, center frequency, and bandwidth of each filter. In contrast, graphic equalizers only allow for the adjustment of the gain of each filter.

Typically, parametric equalizers are designed as second-order IIR filters. These filters have the drawback that because of their low order, they can present relatively large ripple or transition regions and may overlap with each other when several of them are connected in cascade. The DSP System Toolbox™ provides the capability to design high-order IIR parametric equalizers. Such high-order designs provide much more control over the shape of each filter. In addition, the designs special-case to traditional second-order parametric equalizers if the order of the filter is set to two.

This example discusses two separate approaches to parametric equalizer design. The first is using designParamEQ and the second is using fdesign.parameq. designParamEQ should serve most needs. It is simpler and provides the ability for most common designs. It also supports C code generation which is needed if there is a desire to tune the filter at run-time with generated code. fdesign.parameq provides many advanced design options for ultimate control of the resulting filter. Not all design options are explored in this example.

Some Basic Designs

Consider the following two designs of parametric equalizers. The design specifications are the same except for the filter order. The first design is a typical second-order parametric equalizer that boosts the signal around 10 kHz by 5 dB. The second design does the same with a sixth-order filter. Notice how the sixth-order filter is closer to an ideal brickwall filter when compared to the second-order design. Obviously the approximation can be improved by increasing the filter order even further. The price to pay for such improved approximation is increased implementation cost as more multipliers are required.

One of the design parameters is the filter bandwidth, BW. In the previous example, the bandwidth was specified as 4 kHz. The 4 kHz bandwidth occurs at half the gain (2.5 dB).

Designs Based on Quality Factor

Another common design parameter is the quality factor, Q. The Q of the filter is defined as Wo/BW (center frequency/bandwidth). It provides a measure of the sharpness of the filter, i.e., how sharply the filter transitions between the reference value (0 dB) and the gain G. Consider two designs with same G and Wo, but different Q values.

Although a higher Q factor corresponds to a sharper filter, it must also be noted that for a given bandwidth, the Q factor increases simply by increasing the center frequency. This might seem unintuitive. For example, the following two filters have the same Q factor, but one clearly occupies a larger bandwidth than the other.

Low Shelf and High Shelf Filters

The filter's bandwidth BW is only perfectly centered around the center frequency Wo when such frequency is set to 0.5*pi (half the Nyquist rate). When Wo is closer to 0 or to pi, there is a warping effect that makes a larger portion of the bandwidth to occur at one side of the center frequency. In the edge cases, if the center frequency is set to 0 (pi), the entire bandwidth of the filter occurs to the right (left) of the center frequency. The result is a so-called shelving low (high) filter.

Cascading Parametric Equalizers

Parametric equalizers are usually connected in cascade (in series) so that several are used simultaneously to equalize an audio signal. To connect several equalizers in this way, use the dsp.FilterCascade.

Low-order designs such as the second-order filters above can interfere with each other if their center frequencies are closely spaced. In the example above, the filter centered at 1 kHz was supposed to have a gain of -2 dB. Due to the interference from the other filter, the actual gain is more like -1 dB. Higher-order designs are less prone to such interference.

Advanced Design Options: Specifying Low and High Frequencies

For more advanced designs, fdesign.parameq can be used. For example, because of frequency warping, in general it can be difficult to control the exact frequency edges at which the bandwidth occurs. To do so, the following can be used:

Notice that the filter has a gain of -2.37 dB at 3 kHz and 4 kHz as specified.

Shelving Filters with a Variable Transition Bandwidth or Slope

One of the characteristics of a shelving filter is the transition bandwidth (sometimes also called transition slope) which may be specified by a shelf slope parameter S. The bandwidth reference gain GBW is always set to half the boost or cut gain of the shelving filter. All other parameters being constant, as S increases the transition bandwidth decreases, (and the slope of the response increases) creating a "slope rotation" around the GBW point as illustrated in the example below.

The transition bandwidth and the bandwidth gain corresponding to each value of S can be obtained using the measure function. We verify that the bandwidth reference gain GBW is the same for the three designs and we quantify by how much the transition width decreases when S increases.

m1 = measure(BQ1);
get(m1,'GBW')

ans = 5

m2 = measure(BQ2);
get(m2,'GBW')

ans = 5

m3 = measure(BQ3);
get(m3,'GBW')

ans = 5

get(m1,'HighTransitionWidth')

ans = 0.0945

get(m2,'HighTransitionWidth')

ans = 0.0425

get(m3,'HighTransitionWidth')

ans = 0.0238

As the shelf slope parameter S increases, the ripple of the filters also increases. We can increase the filter order to reduce the ripple while maintaining the desired transition bandwidth.

This website uses cookies to improve your user experience, personalize content and ads, and analyze website traffic. By continuing to use this website, you consent to our use of cookies. Please see our Privacy Policy to learn more about cookies and how to change your settings.