# Practical applications of digital filters

To provide additional insight in the application and impact of precision in digital filter, examples of two practical digital applications are shown. The first example is an equalization of a small monitor loudspeaker. The second example is an electronic crossover for a 3-way loudspeaker. The filter architecture chosen for both of these examples is a IIR filter structure which is composed of cascaded sections of second order Direct Form I filters that use magnitude truncation. The filters will use 28 bit coefficients. The processing architecture is a 48 bit fixed point architecture to support 24 data bits, 8 overhead and 16 noise bits. This architecture is illustrated in Figure 21. The multiplier accepts a 28 bit coefficient by 48 bit data multiplication to produces a 76 bit result. The Q block quantizes the signal from 76 bits to 48 bits. The adder and accumulators will support 76 bit add and accumulation. The signal path between each of the IIR filters is 48 bits. At the conclusion of processing, the result is truncated to the desired output length of 24 or 32 bits. Unless other wise specified, the data sample rate is 48 kHz for the examples.

**Figure 21. Processing Architecture**

**Loudspeaker Equalization Example**

In this example, a two-way bass reflex (or ported) monitor loudspeaker is equalized to provide a frequency response that is flat with a gradual --5 dB de-emphasis of the high frequencies. The monitor has a 5 inch woofer and a 1 inch soft dome tweeter. The port tuning is at 85 Hz. The uncorrected frequency response of the loudspeaker is shown in Figure 22.

The objectives of this equalization is to reduce the variations in the overall frequency response, extend the low frequency response, and improve the power handling of low frequency information. The improvement in the power handling of low frequency information is needed to eliminate distortion and noise that is produced by the loudspeaker by 50 Hz and lower tones when played at levels exceeding 15 watts.

**Figure 22. Frequency Response of Monitor Loudspeaker**

The equalization developed for this example uses eight cascaded second order IIR filters. Figure 23 shows the corrected loudspeaker response (shown in Red).

Tables 4a and 4b contain the filter parameters.

**Table 4a. High Pass Filters**

**Table 4b. Parametric Filters**

**Figure 23. Equalized Response**

The two high pass Butterworth filters provide a fourth order high pass filter that improves the loudspeaker power handling at low frequencies. This filter reduces low frequency energy that is sent to the loudspeaker for frequencies below the loudspeaker resonant frequency. For frequencies that are above the resonant frequency of the loudspeaker, the cabinet provides an acoustic load to the woofer, which dampens the woofer's motion. However, below the resonant frequency the woofer becomes acoustically unloaded. At these frequencies, only a relatively modest amount of energy is necessary to cause the woofer to move out to the suspension limits, thereby producing noise and distortion.

The equalization filters at 85, 135, and 188 Hz flatten and extend the low frequency response of the loudspeaker over the interval of 75 Hz to 210 Hz.

The 1300, 2100 and 5500 Hz equalization filters compensate for the response irregularities of the woofer and tweeter on either side of the crossover frequency of 3200 Hz.

The following set of figures show the individual and collective characteristics of the filters that are used to perform the equalization.

Figure 24 shows the transfer functions of the eight individual filters that were used to produce the equalized response.

**Figure 24. Transfer functions of the 8 individual filters**

Figure 25 shows the noise transfer functions of the eight individual filters that were used to produce the equalized response.

Figure 26 shows the difference transfer functions of the eight individual filters that were used to produce the equalized response.

**Figure 25. Noise Transfer Functions of the 8 individual filters -- 16 Noise Bits**

**Figure 26. Difference Transfer Functions of the 8 individual filters -- 16 Noise Bits**

**Figure 27. Total System Signal Transfer Function**

As shown Figure 28, the noise produced by the filter is less than the noise floor of an ideal 24 bit input (144.49 dB) for all frequencies. Figure 29 shows the signal to noise difference is better than an ideal input for all frequencies above 21 Hz. The SNR drops below 144 dB below 21 Hz as a result of the signal attenuation from two 2nd order high pass filters at 40 and 50 Hz. This excellent performance is a result of using 28 bit coefficient and 48 bit data word (24 data bits, 8 headroom bits, and 16 noise bits).

To illustrate the impact of 16 versus 8 noise bits, the total system noise and total system difference transfer functions are shown in Figures 30 and 31 for an eight noise bit system. These figures illustrate that, by using only 8 noise bits, the filter will only achieve 144 dB performance for frequencies above 500 Hz.

**Figure 28. Total System Noise Transfer Function -- 16 Noise Bits**

**Figure 29. Total System Difference Transfer Function -- 16 Noise Bits**

**Figure 30. Total System Noise Transfer Function -- Using 8 Noise bits**

**Figure 31. Total System Difference Transfer Function -- Using 8 Noise bits**

**Loudspeaker Crossover Example**

To gain additional insight into the effect of precision on filter performance, a digital crossover application is investigated. In this example a digital crossover is developed for a three-way loudspeaker. The loudspeaker is composed of a 12-inch woofer, a 5 inch midrange and a one inch soft dome tweeter. The woofer is in a vented cabinet. The midrange is in an acoustic suspension cabinet. The design objective is to develop a maximally flat response using crossovers that provide second order acoustic responses. The following figure depict the crossover and equalization filters that were developed for the three loudspeaker transducers.

Figure 32 shows the uncorrected woofer response (blue) the target response (black), and the maximum and minimum thresholds for the target response (magenta).

**Figure 32. Woofer Response and Target Response**

Figure 33 shows the preceding figure with the addition of the shaped woofer response (red).

**Figure 33. Woofer Target Crossover and Equalization**

Table 5 contains the filter descriptions used to develop the woofer response. The filter complement for the woofer contains a 15 Hz high pass Linkwitz Riley second order high-pass filter to decrease the electrical energy the woofer that is below the acoustic resonance of the tuned cabinet. The woofer high frequency response is shaped by the 100 Hz second order Linkwitz Riley low-pass plus the 200 and 532 Hz Equalization filters. Figure 34 shows the individual woofer signal transfer functions.

**Table 5. Woofer Crossover and Equalization filters**

**Figure 34. Woofer Signal Transfer Functions**

Figure 35 shows the uncorrected midrange response (blue) and the shaped midrange response (red).

**Figure 35. Midrange Target Crossover and Equalization**

Table 6 contains the filter descriptions used to develop the midrange response. The midrange low frequency response is shaped by the 250 Hz second order Linkwitz Riley high-pass plus the 125, 240, and 321 Hz Equalization filters. The midrange high frequency response is shaped by the 3600 Hz second order Linkwitz Riley low-pass and the 7397 Hz Equalization filters.

**Table 6. Midrange Crossover and Equalization filters**

Figure 36 shows the individual midrange signal transfer functions.

**Figure 36. Midrange Signal Transfer Functions**

Figure 37 shows the uncorrected tweeter response (blue) and the shaped tweeter response (red).

**Figure 37. Tweeter Target Crossover and Equalization**

Table 7 contains the filter descriptions used to develop the tweeter response. The tweeter low frequency response is shaped by the 3600 Hz second order Linkwitz Riley high-pass plus the 2000 Hz bass shelf filters. The high frequency response of the tweeter is shaped by the 3000 Hz treble shelf and the 18939 Hz equalization filters.

**Table 7. Tweeter Crossover and Equalization filters**

**Figure 38. Tweeter Signal Transfer Functions**

Figures 39 a, b and c show the woofer, midrange and tweeter signal transfer functions.

**Figure 39a. Woofer Signal Transfer Function**

**Figure 39b. Midrange Signal Transfer Function**

**Figure 39c. Tweeter Signal Transfer Function**

Figures 40 a, b and c show the woofer, midrange and tweeter noise transfer functions.

**Figure 40a. Woofer Noise Transfer Function**

**Figure 40b. Midrange Noise Transfer Function**

**Figure 40c. Tweeter Noise Transfer Function**

Figures 41 a, b and c show the woofer, midrange and tweeter difference transfer functions.

**Figure 41a. Woofer Difference Transfer Function**

**Figure 41b. Midrange Difference Transfer Function**

**Figure 41c. Tweeter Difference Transfer Function**

As can been seen in the Noise Transfer Function plots, Figures 40 a, b and c, the noise produced by the filters is less than the noise floor of an ideal 24 bit input (144.49 dB) for all frequencies. This is substantiated in the difference transfer functions, Figures 41 a, b and c, which show that the system performance drops below an ideal 24 bit input only at very low signal output levels. This excellent performance is a result of using 28 bit coefficients and 48 bit data word (24 data bits 8 head room bits, and 16 noise bits).

**SUMMARY AND CONCLUSIONS**

Digital filters are becoming ubiquitous in audio applications. As a result, good digital filter performance is important to audio system design. Digital filters differ from conventional analog filters by their use of finite precision to represent signals and coefficients and finite precision arithmetic to compute the filter response. The precision that is used determines the digital filter's response accuracy and the filter signal to noise ratio.

The coefficient precision determines the accuracy of the digital filter response in comparison to an ideal filter. As was shown, a second order Direct Form 1 filter using 24 bit coefficients can achieve a 1 dB or better response accuracy in implementing a modest parametric equalization filter with a 6 dB gain and a Q of 6 over the range of 50 Hz to 20,000 Hz at a 48kHz sample rate. However, when the sample rate is increased to 96 or 192 kHz, additional precision, 28 bits, is required to obtain similar performance. When less than this precision is used, the resulting filter response deviates substantially from the desired response.

Similarly, the precision that is used in computing the filter response plus the computation method determines the signal to noise performance of the filter. Noise arises in a digital filter as a result of the quantization that occurs in computing the filter response. The precision that is maintained throughout the computation determines the noise amplitude. As was shown, 16 noise bits are sufficient to preserve the SNR performance of the input signal for a parametric equalization filter with a gain of 12 dB and a Q of 6.7 from 100 to 20,000 Hz at sample rates of 48 and 96 kHz. If fewer noise bits are used, the SNR performance can degrade substantially. An example of this degradation is for the filter at 100 Hz, where 8 noise bits produce a loss of 40 dB in SNR at a 48 kHz sample rate and a loss of 50 dB SNR at a 96 kHz sample rate.

Finite precision representation also imposes a limitation on the maximum signal magnitude that can be represented. To permit positive gains to be used in forming intermediate values within and between cascaded stages, additional precision is required to avoid numeric overflow. As was discussed, 8 bits of additional precision provides sufficient headroom for a majority of cases.

In conclusion, the quality of 24 bit data at 48 and 96 kHz sample rates can be preserved during digital filtering applications by using: 48 bits of data precision (24 bits of data, 8 headroom bits and 16 noise bits) 28 bit coefficients An IIR filter structure that is composed of cascaded sections of second order Direct Form I filters that use magnitude truncation.

**Credits:**

The author is very grateful to Dr. Rusty Allred for his contributions to this paper.

**References:**

A.Oppenheim and R.Schafer, Discrete-Time Signal Processing, Prentice -- Hall, 2nd Edition, 1998, ISBN 0-13-754920-2

P. Kraniauskas, Transforms in Signals and Systems, Addison -- Wesley, 1993, ISBN 0-201-10694-8

E.C. Ifeachor and B.W. Jervis, Digital Signal Processing A Practical Approach, Addison -- Wesley, 1993, ISBN 0-201-54413-X

post a commentregarding this story.