Implementation of equalizers and filters in the digital domain.

1. Analogue equalizers and filters

Although this document describes the digital implementation of equalizer controls, it is important to understand equalizers in the analogue domain first. The digital equalizers we are going to design are based on this analogue equalizers.

1.1 Low-cut filter:

The low-cut filter is used to cut low frequency noise, like rumble and hum, from the audio signal. The low-cut filter is nothing more than a multi-order high-pass filter with a variable cut-off frequency. The following equations are used to design a high-pass filter: (1st order) (2nd order)

Where wn is the cut-off frequency and Q is the Q-factor of the second-order filter. To get higher order-filters, one or more of the above filter equations are cascaded. There are various pole placement techniques. The Butterworth-filter has no magnitude ripple and is therefore the best choice. If the filter is second-order, it means the Q-factor must be 0.707. If the filter is of a higher order, it means that the poles are evenly spaced on a circle in the negative-half of the s-plane.

1.2 High-cut filter:

The high-cut filter is used to cut high frequency noise, like hiss, from the signal. The high-cut filter is nothing more than a multi-order low-pass filter with a variable cut-off frequency. The following equations are used to design a low-pass filter: (1st order) (2nd order)

Where wn is the cut-off frequency and Q is the Q-factor of the second-order filter. The same design criteria used in designing the low-cut filter are also used to design the high-cut filter.

1.3 Low shelving equaliser:

The low and high shelving equalisers are the simplest form of equalisers. This type of equalisers are also found on most hi-fi's. The low shelving equaliser is used to boost or cut the bass frequencies. The low shelving equaliser consists of one pole and one zero which moves around the shelving frequency. If both pole and zero are on the same spot, the boost/cut ratio, G, is unity. If the pole moves left form the zero, the high frequency gain decreases. To compensate for this, the signal is multiplied by G, which keeps the high frequency gain constant and causes the DC gain the increase. If the zero moves left from the pole, the opposite is true. Below are the equations for designing a low shelving equaliser: with or Where wo is the shelving frequency and G is the amount of boost/cut. Normally the shelving frequency would be fixed and the boost/cut ratio would be adjustable.

1.4 High shelving equaliser:

The high shelving equaliser is used to boost or cut the high frequencies. The high shelving equaliser works on the same principle as the low shelving equaliser, the only difference is that the DC gain stays constant and the high frequency gain varies. with or Where wo is the shelving frequency and G is the amount of boost/cut. Normally the shelving frequency would be fixed and the boost/cut ratio would be adjustable.

1.5 Parametric equaliser:

There exists many types of parametric equalisers. The simplest type only has a boost/cut control, like in a graphic equaliser. The more common types on mixers also has a sweepable centre frequency, while the more complex paramtric equalisers also has a variable Q-factor.

There are also other important considerations in designing parametric equalisers. The Q-factor of a parametric equaliser must not be dependent on the boost/cut ratio. The problem with some analogue implementations is that the Q-factor is dependant on the amount of correction. The Q-factor is at it's peak at maximum correction and decreases with smaller corrections. This causes small corrections to influence a much wider frequency band than it is supposed to.

Another consideration is symmetrical boost/cut curves. This means that if two parametric equalisers has the same centre frequency and Q-factor, a boost by the one can be totally cancelled out by the same amount of cut by the other one.

A parametric equaliser has both a complex zero and a complex pole on the centre frequency. The boost/cut ratio is controlled by varying the Q-factors of the pole and zero. The equation for a parametric equaliser in the s-domain is as follows: Where wo is the center frequency. The boost/cut ratio G= az /ap. To understand the Q-factor of the equaliser, the transfer function can be written as follows: with For a constant Q-design, the Q-factor of the bandpass filter Z(s) must be constant, implying that ap must be equal to 1. az is then the boost/cut ratio. The trouble with this design is that although the equaliser is constant Q, the boost and cut curves are not symmetrical. A new equation for the cut curve is as follows: This implies that the roles of az and ap swap. az must now be constant and ap =1/G. This discontinuity in the values az and az is rather difficulty implemented in the analogue domain, but in the digital domain this of course is no problem.

1.6 Graphic equaliser:

A graphic equaliser consists of more than one parametric equaliser spaced at logarithmic even frequency intervals . The Q-factors are also fixed, the only adjustable parameter is the boost/cut ratio.

2. Digital implementation of above equaliser controls:

There are more than one way to implement equalisers in the digital domain. The most flexible way is by using an FFT. The input signal is converted to the frequency domain by means of the FFT algorithm. It is then multiplied by the arbitrary generated H(w), and then converted back to the time domain by means of the IFFT algorithm. Although this method is highly flexible concerning the selection of H(w), it takes too much processing power. This method is therefore not suitable for equalisation, especially if the digital equaliser is based on above mentioned analogue equations.

A better approach is to map the poles and zeros from the s-domain directly into poles and zeros in the z-domain. The specifications from the digital domain is converted to specifications in the analogue domain. The analogue filter H(s) is designed, and is than converted to the digital domain H(z). Various conversion techniques are available, the technique used here is bilinear transformation. The mapping from the s-plain to the z-plain is as follows: The jW -axis is transformed only once into the unit circle in the z-plane. The frequency mapping is non-linear and is given by the following equation: and Where w is the frequency in z-domain and W is the frequency in the s-domain. Below are commonly used equations in the s-domain and there corresponding transformations into the z-domain.

 Analog domain Digital domain Description  1st order low-pass  1st order high-pass  Shelving  2nd order low-pass  2nd order band-pass  2nd order high-pass  parametric

A generalised equation for all the equations listed in the table above can be written as follows: Note that all the coefficients are scaled so that a0 is unity. This equation can be implemented as follows on a computer or DSP:     Where x is the input, y is the output and b is the IIR buffer.

3. Spectrum analyser

An spectrum analyser consists of two parts, a bandpass filter and a peak level detector. The easiest way to implement the bandpass filter is to take an analogue filter and transform it into an IIR filter in the digital domain, just as we did with the equaliser controls. The analogue equation for a bandpass filter is as follows: The output form the bandpass filter is send to a peak level indicator. The peak level indicator is implemented as follows on a computer or DSP:

if(filter_output>peak) peak = filter_output;

peak = peak*decay_factor;

The logarithm of peak should then be caclulated and used to draw the PLI bar. The value, decay_factor, is used to set the decay time of the PLI and is in the range of 0,999. The same is done for every band of the spectrum analyser.