Digital Audio: Part 15 - Filters

Digital filters are ubiquitous. That has happened because they have significant advantages over the technology they widely replaced.

As a subject, filtering does not really need to make a distinction between analog and digital, because the principles are the same for both. A waveform expressed as a time variant voltage and a waveform expressed by a series of samples are just different ways of expressing the same information. It follows that filtering is possible either by messing with the time variant voltage or by messing with the samples.

A filter is defined as a device whose behavior is frequency dependent. That behavior will include changing some combination of signal amplitude and phase as a function of frequency. In fact the filtering action is completely defined by the plots of amplitude and phase against frequency and once that is known there is nothing left to say. Considered in that way, a filter is a good example of the electronic engineer's "black box" where we are unsure what is inside it but everything it does can be predicted from external measurements.

Filters are found everywhere in audio but they can be categorized according to their general function. In many cases the filter is accidental. Fig.1 shows an analog audio signal being fed from one device to another by a cable. The cable consists of two conductors separated by insulation. Whether we like it or not as well as being a cable it's also a capacitor connected in parallel with the audio signal and a series inductor.

Fig.1 - The inadvertent filter lurking in all cables due to stray capacitance and inductance. Longer cables require to be equalized.

Fig.1 - The inadvertent filter lurking in all cables due to stray capacitance and inductance. Longer cables require to be equalized.

If the cable is short these stray components don't have enough effect, but where longer cables are used, the stray components can act like a filter, meaning that the response of the cable to all frequencies is no longer equal. At the receiving end, we need another filter whose response opposes the effects of the stray components. After that filter the response to all meaningful frequencies was once more equal, so the device was called an equalizer.

Subsequently the meaning of the term was broadened to include any device that messed with the frequency response of an audio signal, whether to correct a technical shortcoming or to achieve some creative effect. At the same time equalization was abbreviated to EQ.

Anything to do with transducers invariably results in filters being needed. Microphones need high-pass filters to deal with the proximity effect, loudspeakers need crossovers so that different drive units can operate on different parts of the audio band and analog recording media such as vinyl disk or tape need equalization of the replay signal to allow the use of pre-emphasis on the record side to improve SNR.

In digital audio the audio spectrum may be divided into a large number of narrow frequency bands as part of the action of a compressor.

In general a real world temporal filtering process will always alter the phase of any signal. This is because all real world processes are causal, meaning that the output is caused by the input and of course cannot occur before it. Fig.2a) shows that the impulse response of a causal filter is generally asymmetrical because nothing can happen before the input impulse. The asymmetry of the impulse response means that there must be phase shifts in the output.

Fig.2b) shows a filter having a symmetrical impulse response, which means it has linear phase. If this filter is working on images that exist with respect to space rather than time, the problem of causality does not occur. Lenses and digital camera sensors act like linear phase filters.

However, if the filter works in the time domain, the only way in which a symmetrical impulse response is possible in the absence of clairvoyant powers is for the impulse response to be finite in duration and for the filter to incorporate a delay of half the impulse length as shown in Fig.2c). These restrictions lead to such filters being described as having a finite impulse response (FIR). They are commonly used in image processing for applications such as image re-sizing.

Fig.2 - At a) any causal filter must have an asymmetrical impulse response. The linear phase filter at b) is common in spatial filtering where causality is not a requirement. At c) the linear phase filter can be used for audio by incorporating delay to make the response causal.

Fig.2 - At a) any causal filter must have an asymmetrical impulse response. The linear phase filter at b) is common in spatial filtering where causality is not a requirement. At c) the linear phase filter can be used for audio by incorporating delay to make the response causal.

Referring back to Fig.1, in which a stray capacitance acted like a filter, the impulse response of that filter would be an exponential decay, which is theoretically infinite in extent. We can therefore divide filters into finite impulse response (FIR) and infinite impulse response (IIR) categories.

FIR filters can suffer from pre-ringing if they are made to alter low audio frequencies. The impulse response becomes broad and it may be possible to hear the filter response begin before the original sound, which is most unnatural. As a result, most audio EQ is done with IIR filters that cannot pre-ring. They cannot have linear phase; the best they can manage is to display minimum phase, which is where the phase response is the best that can be managed whilst remaining causal.

In general, the stronger the EQ applied in audio the greater will be the phase changes and the greater the chance that the original phase structure of the sound is obviously altered. In general if it is found that a large amount of EQ seems to be necessary it is always a good idea to find out why. The invisibility of sound means that it is very good at teasing by coming up with a room resonant mode no one has heard before. You put your microphone there and the response is highly irregular. It may be more effective to move the microphone than to try to equalize it.

Experienced audio engineers have a habit of walking around recording spaces making noises to see how the space reacts before siting a microphone. The chorus from Stan Freberg's Banana Boat Song seems to be made for exploring a reverberant acoustic.

Another point to bear in mind is that most audio monitoring is mediocre because the time response of the speakers has been destroyed by the use of resonance in a misguided attempt to improve the frequency response. Any equalizing done in an attempt to compensate for inferior monitor speakers in a questionable room is unlikely to succeed. One should always listen elsewhere before committing to the use of a lot of EQ just in case the monitoring is teasing.

In audio the FIR filter finds use in sampling rate conversion and in oversampling, where the goal is to preserve the waveform as accurately as possible. In such applications the frequencies at which the FIR filter is operating is beyond the range of human hearing, so pre-ringing is not likely to be a concern. For example in an oversampling DAC, the filter frequency will be at 22 or 24kHz and no one is going to hear any pre-ringing on such a short impulse response, except possibly dogs, bats and hi-fi enthusiasts.

The FIR filter has the advantage that it is relatively easy to see how it works. What actually matters is the arithmetic that goes on. How that arithmetic is implemented does not change the response. For example a digital filter can be implemented in software so that the necessary calculations are performed in a general-purpose processor. On the other hand the filter may be built as a dedicated device implemented in, for example, a gate array.

Fig.3 - In the frequency domain (right) the input spectrum is multiplied by the filter frequency response. In the time domain (left) the input waveform is convolved with the impulse response.

Fig.3 - In the frequency domain (right) the input spectrum is multiplied by the filter frequency response. In the time domain (left) the input waveform is convolved with the impulse response.

Amplitude and phase response are measured in the frequency domain, but audio signals also carry information about the time domain and filters also have an impulse response, which is the waveform they output when excited by a transient.

Fig.3 shows the alternative ways of looking at how a filter works.

For a given frequency and phase response there will be a corresponding impulse response. The two are completely equivalent and either one completely specifies the filter. The equivalence exists because the frequency and phase responses are the Fourier transform of the impulse response.

There appears to be a deep-rooted mythology in audio that transients are somehow treated differently from other waveforms in audio equipment. In fact a transient is just another waveform that must fit within the available bandwidth. The only significant feature of a transient is that it represents a single event rather than something repetitive.

If the frequency and phase domain is considered, on the right of Fig.3, the output frequency response of a filter is the product of the input spectrum and the filter frequency response, which has the characteristics of a spectrum. The phase of the output is the input shifted by the phase response of the filter.

However, if the time domain is considered, on the left, Fig.3 shows that input waveform needs to be convolved with the corresponding impulse response in order to produce the output waveform. Fig.3 also shows that the output spectrum and the output waveform are related by the Fourier transform.

It should be apparent from Fig.3 that we could begin with a time domain audio waveform, transform it to the frequency domain, carry out multiplicative filtering and then perform an inverse transform to get back to the time domain. It's a bit round-the-houses, but that is exactly what happens in a lot of compression algorithms.

Broadcast Bridge Survey

You might also like...

Standards: Part 6 - About The ISO 14496 – MPEG-4 Standard

This article describes the various parts of the MPEG-4 standard and discusses how it is much more than a video codec. MPEG-4 describes a sophisticated interactive multimedia platform for deployment on digital TV and the Internet.

Chris Brown Discusses The Themes Of The 2024 NAB Show

The Broadcast Bridge sat down with Chris Brown, executive vice president and managing director, NAB Global Connections and Events to discuss this year’s gathering April 13-17 (show floor open April 14-17) and how the industry looks to the show e…

Comms In Hybrid SDI - IP - Cloud Systems - Part 1

We examine the demands placed on hybrid, distributed comms systems and the practical requirements for connectivity, transport and functionality.

Audio For Broadcast - The Book

​Audio For Broadcast - The Book gathers together 16 articles into a 78 page eBook which explores the science and practical applications of audio in broadcast.  This book is not aimed at audio A1’s, it is intended as a reference resource for …

Standards: Part 5 - Standards For Audio Coding

This article describes the various AES, MPEG, Proprietary and Open Standards that pertain to audio.