Low Pass Filter

Download as pdf or txt
Download as pdf or txt
You are on page 1of 14

Filtered Audio Demo

Max Kamenetsky
In this demo you'll listen to a 10 second segment of music, alternating with various ltered
versions of it. You should try to relate what you hear to the frequency response, impulse
and step responses, and snapshots of the input and output signals.

First order lowpass lter


The rst lter is a rst order lowpass with cuto frequency 1kHz, with transfer function
!c 1
H (s) = = ;
s + !c 1 + s=!c
where !c = 2  1000.
Note that it passes frequencies under around 500Hz or so, but attenuates high frequencies.
Since it attenuates high frequencies the ltered segment will sound a bit mued. (A higher
order lowpass lter, with a sharper cuto characteristic, would sound much more mued.)
The impulse response shows that this lter smooths out the input, giving a sort of averaging
over a few milliseconds. You can see that the ltered signal is a smoothed version of the
original signal.
1−pole lowpass (Fc = 1kHz) Bode plot

−5
Magnitude (dB)

−10

−15

−20

−25
2 3 4
10 10 10
Frequency (Hz)

−10
−20
−30
Phase (deg)

−40
−50
−60
−70
−80
2 3 4
10 10 10
Frequency (Hz)

1
1−pole lowpass (Fc = 1kHz) impulse response
6000

5000

4000
Amplitude

3000

2000

1000

0 1 2 3 4 5 6 7 8
Time (s) −4
x 10
1−pole lowpass (Fc = 1kHz) step response

0.8
Amplitude

0.6

0.4

0.2

0
0 1 2 3 4 5 6 7 8
Time (s) −4
x 10

Original signal
0.04

0.02
Amplitude

−0.02

−0.04
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5
Time (s) x 10
−3

1−pole lowpass (Fc = 1kHz) filtered signal


0.04

0.02
Amplitude

−0.02

−0.04
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5
Time (s) x 10
−3

2
First order highpass lter
The transfer function is
s s=!c
H (s) = =
s + !c 1 + s=!c
where !c = 2  1000.
This transfer function attenuates low frequencies, but lets frequencies above 2kHz or so
pass. You can hear that the bass is quite reduced. You can also see from the signal waveforms
that the fast wiggles in the signal come through, but the slower variations are quite reduced.
1−pole highpass (Fc = 1kHz) Bode plot

−5
Magnitude (dB)

−10

−15

−20

−25

−30

2 3 4
10 10 10
Frequency (Hz)

80
70
60
Phase (deg)

50
40
30
20
10
2 3 4
10 10 10
Frequency (Hz)

3
1−pole highpass (Fc = 1kHz) impulse response

2000
δ(t)
Amplitude 0

−2000

−4000

−6000
−1 0 1 2 3 4 5 6 7 8 9
Time (s) −4
x 10
1−pole highpass (Fc = 1kHz) step response
1

0.8
Amplitude

0.6

0.4

0.2

0
−1 0 1 2 3 4 5 6 7 8 9
Time (s) −4
x 10

Original signal
0.04

0.02
Amplitude

−0.02

−0.04
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5
Time (s) x 10
−3

1−pole highpass (Fc = 1kHz) filtered signal


0.04

0.02
Amplitude

−0.02

−0.04
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5
Time (s) x 10
−3

4
Low Q bandpass lter
This is a second order bandpass lter, with center frequency 1 kHz and Q = 4. Transfer
function: s
H (s) = K
(Q=!c)s + s + Q!c
2

where Q = 4, !c = 2  1000, and K = 6:7  16:5 dB is a scale factor to increase the volume
level.
Here frequencies between 500Hz and 2kHz or so are passed, and both low and high
frequencies are attenuated. The acoustic e ect is something like listening through a tube
(which has resonances | you'll learn about that in EE141!). You can also hear when a note
(or a harmonic) gets near 1kHz.
The impulse response is oscillatory, and you can see the e ect in the plot of the ltered
signal. Here both the fast wiggles and the slow undulatations are attentuated.
First order bandpass (center = 1kHz, Q = 4) Bode plot

10
Magnitude (dB)

−10

−20

2 3 4
10 10 10
Frequency (Hz)

50
Phase (deg)

−50

2 3 4
10 10 10
Frequency (Hz)

5
First order bandpass (center = 1kHz, Q = 4) impulse response
10000

Amplitude 5000

−5000

0 0.001 0.002 0.003 0.004 0.005 0.006 0.007 0.008 0.009 0.01
Time (s)

First order bandpass (center = 1kHz, Q = 4) step response

1
Amplitude

0.5

−0.5

0 0.001 0.002 0.003 0.004 0.005 0.006 0.007 0.008 0.009 0.01
Time (s)

Original signal
0.04

0.02
Amplitude

−0.02

−0.04
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5
Time (s) −3
x 10
First order bandpass (center = 1kHz, Q = 4) filtered signal
0.04

0.02
Amplitude

−0.02

−0.04
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5
Time (s) −3
x 10

6
High Q bandpass lter
Second order bandpass lter with center frequency 1kHz and Q = 40. Transfer function:
s
H (s) =K
(Q=!c) + s + Q!c
s2

where Q = 40, !c = 2  1000, and K = 28  29 dB is a scale factor to increase the volume


level.
Here the frequencies near 1kH are strongly emphasized, which is quite annoying. The
impulse response is quite oscillatory, which you can also see in the plots of the ltered signal.
First order bandpass (center = 1kHz, Q = 40) Bode plot

20

10
Magnitude (dB)

−10

−20

−30

2 3 4
10 10 10
Frequency (Hz)

50
Phase (deg)

−50

2 3 4
10 10 10
Frequency (Hz)

7
First order bandpass (center = 1kHz, Q = 40) impulse response
4000

2000
Amplitude

−2000

−4000
0 0.001 0.002 0.003 0.004 0.005 0.006 0.007 0.008 0.009 0.01
Time (s)

First order bandpass (center = 1kHz, Q = 40) step response

0.6

0.4

0.2
Amplitude

−0.2

−0.4

−0.6
0 0.001 0.002 0.003 0.004 0.005 0.006 0.007 0.008 0.009 0.01
Time (s)

Original signal
0.04

0.02
Amplitude

−0.02

−0.04
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5
Time (s) −3
x 10
First order bandpass (center = 1kHz, Q = 40) filtered signal
0.04

0.02
Amplitude

−0.02

−0.04
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5
Time (s) −3
x 10

8
Allpass lter
First order allpass lter with 90Æ phase shift at 1kHz. Transfer function:
s !c s=!c 1
H (s) = = ;
s + !c s=!c + 1

where !c = 2  1000.
This lter passes all frequencies with unity gain. It does, however, shift the phase of the
signal.
You really can't hear any di erence at all, since the ear is pretty insensitive to (moderate)
phase shift. The ltered signal looks quite a bit like the original signal, but is not the same.
First order allpass Bode plot
5
Magnitude (dB)

−5
2 3 4
10 10 10
Frequency (Hz)

160
140
120
Phase (deg)

100
80
60
40
20
2 3 4
10 10 10
Frequency (Hz)

9
First order allpass impulse response
4000
δ(t)
2000
0
Amplitude −2000
−4000
−6000
−8000
−10000
−12000
−1 0 1 2 3 4 5 6 7 8 9
Time (s) x 10
−4

First order allpass step response


1

0.5
Amplitude

−0.5

−1
−1 0 1 2 3 4 5 6 7 8 9
Time (s) x 10
−4

Original signal
0.04

0.02
Amplitude

−0.02

−0.04
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5
Time (s) −3
x 10
First order allpass filtered signal
0.04

0.02
Amplitude

−0.02

−0.04
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5
Time (s) −3
x 10

10
Moving average lter
This lter is a 10ms moving average lter. Impulse response:
(
K (1=0:1); 0  t < 0:01
h(t) =
0; t  0:01

The DC gain is K , which we take to be K = 3:5  10:9dB to increase the volume level.
In this case the ltered signal output is exactly (K times the) average of the input signal
over the last 10ms. Here the ltered signal sounds very mued; the high frequencies are
strongly attenuated.
10 ms moving average Bode plot

−20
Magnitude (dB)

−40

−60

−80

−100
2 3 4
10 10 10
Frequency (Hz)

11
−3 10 ms moving average impulse response
x 10
10

Amplitude 6

−2
0 0.005 0.01 0.015 0.02 0.025
Time (s)

10 ms moving average step response


4

3
Amplitude

0
0 0.005 0.01 0.015 0.02 0.025
Time (s)

Original signal
0.05
Amplitude

−0.05
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5
Time (s) −3
x 10
−3 10 ms moving average filtered signal
x 10
5
Amplitude

−5
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5
Time (s) −3
x 10

12
Filter with echos
Impulse response:
h(t) = Æ (t) + 0:75Æ (t 0:125) 0:1065Æ (t 0:1536)
0:4098Æ (t 0:1605) + 0:0308Æ (t 0:1788) + 0:0705Æ (t 0:1934)
0:2804Æ (t 0:2201) + 0:2906Æ (t 0:243) + 0:2898Æ (t 0:2567)
This represents 8 perfect echos. The rst one arrives 125ms after the rst impulse, and
the others come over the next 125ms or so.
Hall echos Bode plot
10

−5
Magnitude (dB)

−10

−15

−20

−25

−30
2 3 4
10 10 10
Frequency (Hz)

13
Hall echos impulse response
2.5

Amplitude 1.5

0.5

−0.5
0 0.1 0.2 0.3 0.4 0.5 0.6
Time (s)

Hall echos step response


2.5

1.5
Amplitude

0.5

−0.5
0 0.1 0.2 0.3 0.4 0.5 0.6
Time (s)

Original signal
0.2
Amplitude

−0.2
0.227 0.2275 0.228 0.2285 0.229 0.2295 0.23 0.2305 0.231 0.2315
Time (s)

Hall echos filtered signal


0.2
Amplitude

−0.2
0.227 0.2275 0.228 0.2285 0.229 0.2295 0.23 0.2305 0.231 0.2315
Time (s)

14

You might also like