Summer 1995

# Digital Filter Response Curves

I have been following the discussion between Rune, Dr. David E. Hyre, and Jason about FIR-filters. I will admit now that I know very little about FIR filters, but I will take a stab at it and explain what I know. Maybe I can bring others up to speed as to what these three intellectuals are talking about. Tell me if I made mistakes.

## Impulse Response:

Digital equipment works at a sampling frequency (call it s). If we want to find the frequency response of that digital equipment, we can perform tests. One of these tests is the impulse response test. Because of the sampling frequency, the duration of this impulse will appear to the processor as no less than 1/s seconds. (Lets make the assumption now that there are no curve-smoothing functions in the equipment.)

Each '*' is a sample:

*<-our impulse spike

********************* *********************

->||<- 1/s

If we take the Fourier transform of this we can find the frequency response of the digital equipment. We will find that the response is:

K * sin(pi*f/s)

Resp = ----------------- (where K is some constant)

pi*f/s

It is interesting to notice that for any maximum frequency, F, we can find an s so that the function above is very close to K for all f<F. That means that if a digital circuit has a high enough s then it will have a flat frequency response in the 0 thru 20kHz range.

Unfortunately, s is not large enough in the digital equipment we have today. When s=44kHz then the response at 20kHz is .69*K, or in other words down by 3.2dB. You can see the amount of error can be reduced by using 96kHz sampling frequency, then the response is down to only .93*K, or .63dB. Here is a graph of the impulse response for 44kHz.

100**********

90 ******** Voltage wrt frequency response

80 ******

70 ******

60 ******

50 ******

40 ******

30 ******

20 *****

10 ****

0-----------------------------+---------------------------------***

20 22 44

This is what I think Rune is talking about; the sin(x)/x error at 20 kHz will be -3.2dB. Relatively lower sampling frequencies result in more deviation from the flat impulse response.

## Steady State Response:

Lets test the frequency response of digital equipment wrt constant sine waves. If you draw a sine wave on your piece of paper, and then place points equidistant along the x axis you will notice that some points will fall on the same x position as the maximum of the sine wave (if you're lucky). At other positions along the x axis you will notice that the maximum of the sine wave will fall right in-between two points.

Consider the sine wave as the input analog signal, and the points as the samples made by the digital equipment. From this you can understand how the equipment 'sees' the input wave form. There will be errors of course. Given a constant input sine wave, the digital filter will interpret the maximum amplitude differently depending on when the sampling points fell on the sine wave. For instance, the maximum amplitude is determined correctly when the sample point lands on the maximum of the sine wave, and is underestimated when the maximum lays between two adjacent points. The maximum underestimation error is a function of the input frequency (f) and the sampling frequency (s):

MAX UNDERESTIMATION ERROR = 1-cos(pi*f/s) (all f < s/2)

I think this function shows the "hole in the frequency response at 22kHz" Rune refered to. For a sampling frequency of 44kHz you find that a 22kHz signal could have up to 100% error; every sample falls on the null of the 22kHz sine wave. At 20kHz we have a maximum error of 86%. Every 44000/20000 = 11 sample points the error cycles between maximum error and minimum error (0%).

These diagrams are from Thomas Danley. Data was taken from the D/A converter (top) and passed through a 16th order, 1dB ripple FIR filter @ 20kHz (bottom). My analysis above only is relevant to the D/A output. But you do see the effects are still not totally removed by the steep filter. I believe there is some jitter in the output.

## Filtering:

A digital low pass filter has to use Fourier transforms to filter the response. But these transforms are defined for all t (the entire piece of music; let m(t) be the music signal). Suppose we want a Fourier transform at some time t0. To avoid transforming the entire piece of music we have to multiply the music signal by another function that approaches zero as t>>t0 and t<<t0. This function can be almost anything, call it g(t). The type of Fourier transform is sometimes named after the function g(t) it uses.

The Fourier transform of m(t)*g(t) over all time [-infinity, infinity] can be approximated by the Fourier transform over a finite interval [t0-R,t0+R]. Let R be large enough to produce a small error below the noise floor. Once the digital equipment has a transformed the music signal for a specific point in time, it can erase all the frequencies above the cutoff frequency (brick-wall like) and then recompile them back into the time domain signal.

If m(t) is an impulse then there will be ringing at the cutoff frequency; Ringing above cutoff was erased in the transformed stage, and if the ringing was below cutoff then the harmonics above the ringing frequency (but below cutoff) mysteriously do not exist. R will indicate how long before and after t0 the ringing will exist.