E85.2607: Lecture 2 -- Filtersronw/adst-spring2010/lectures/lecture… · E85.2607: Lecture 2 {...
Transcript of E85.2607: Lecture 2 -- Filtersronw/adst-spring2010/lectures/lecture… · E85.2607: Lecture 2 {...
E85.2607: Lecture 2 – Filters
1 Basic IIR filters
2 Applications
E85.2607: Lecture 2 – Filters 2010-01-28 1 / 15
Basic filters
LP BP
HP BR
H(f)
f/Hzfc0
H(f)
f/Hzfc0
H(f)
f/Hzfch0
H(f)
f/Hz0
fcl
fchfcl
Resonator
Notch
H(f)
f/Hz0
H(f)
f/Hz0 fc
fc
fc cutoff or center frequency
fb bandwidth
Q “quality factor” Q = fbfc
E85.2607: Lecture 2 – Filters 2010-01-28 2 / 15
IIR filter structures: Digital biquad
H(z) =B(z)
A(z)=
b0 + b1 z−1 + b2 z−2
1 + a1 z−1 + a2 z−2
Direct form 1 Direct form 2
zeros on left, poles on right canonical (minimum delays)
E85.2607: Lecture 2 – Filters 2010-01-28 3 / 15
Building blocks: Allpass filter
H(z) =B(z)
z−NB(z−1)
=b0 + b1 z−1 + . . .+ bN−1 zN−1 + bN z−N
bN + bN−1 z−1 + . . .+ b1 zN−1 + b0 zN
Where are the poles and zeros?
What about the frequency response?
E85.2607: Lecture 2 – Filters 2010-01-28 4 / 15
Building blocks: Allpass filter
H(z) =B(z)
z−NB(z−1)
=b0 + b1 z−1 + . . .+ bN−1 zN−1 + bN z−N
bN + bN−1 z−1 + . . .+ b1 zN−1 + b0 zN
Where are the poles and zeros?
What about the frequency response?
E85.2607: Lecture 2 – Filters 2010-01-28 4 / 15
Parametric first order allpass filter
A(z) =c + z−1
1 + c z−1
c =tan(πfc/fs)− 1
tan(πfc/fs) + 1
Flat magnitude response, butintroduces phase distortion
Group delay = − ∂∂ω∠H(e jω)
0 0.1 0.2 0.3 0.4 0.5−10
−5
0
Magnitude Response, Phase Response, Group Delay
Mag
nitu
de in
dB
0 0.1 0.2 0.3 0.4 0.5−200
−150
−100
−50
0
Phas
e in
deg
rees
0 0.1 0.2 0.3 0.4 0.50
1
2
3
4
f/fS !
Gro
up d
elay
in s
ampl
es
E85.2607: Lecture 2 – Filters 2010-01-28 5 / 15
Tunable lowpass/highpass filters
x(n-1)x(n)
y(n-1)
y(n)
-c
c 1
T
T
-c
x(n) y(n)T
c
Direct-form structure Allpass structure
x (n)h x (n-1)h
A(z)x(n) y(n)1 /2
LP/HP+/-
x(n-1)x(n)
y(n-1)
y(n)
-c
c 1
T
T
-c
x(n) y(n)T
c
Direct-form structure Allpass structure
x (n)h x (n-1)h
A(z)x(n) y(n)1 /2
LP/HP+/-
Why does this work?
E85.2607: Lecture 2 – Filters 2010-01-28 6 / 15
LP/HP frequency response
0 0.1 0.2 0.3 0.4 0.5−10
−5
0
Magnitude Response, Phase Response, Group DelayM
agni
tude
in d
B
0 0.1 0.2 0.3 0.4 0.5−100
−50
0
Phas
e in
deg
rees
0 0.1 0.2 0.3 0.4 0.50
0.5
1
1.5
2
f/fS !
Gro
up d
elay
in s
ampl
es
0 0.1 0.2 0.3 0.4 0.5−10
−5
0
Magnitude Response, Phase Response, Group Delay
Mag
nitu
de in
dB
0 0.1 0.2 0.3 0.4 0.50
50
100
Phas
e in
deg
rees
0 0.1 0.2 0.3 0.4 0.50
0.5
1
1.5
2
f/fS !
Gro
up d
elay
in s
ampl
es
E85.2607: Lecture 2 – Filters 2010-01-28 7 / 15
Second order allpass
0 0.1 0.2 0.3 0.4 0.5−10
−5
0
Magnitude Response, Phase Response, Group Delay
Mag
nitu
de in
dB
0 0.1 0.2 0.3 0.4 0.5−100
−50
0
Phas
e in
deg
rees
0 0.1 0.2 0.3 0.4 0.50
0.5
1
1.5
2
f/fS !
Gro
up d
elay
in s
ampl
es
0 0.1 0.2 0.3 0.4 0.5−10
−5
0
Magnitude Response, Phase Response, Group Delay
Mag
nitu
de in
dB
0 0.1 0.2 0.3 0.4 0.50
50
100
Phas
e in
deg
rees
0 0.1 0.2 0.3 0.4 0.50
0.5
1
1.5
2
f/fS !
Gro
up d
elay
in s
ampl
es
c controls bandwidth
d controls cut-off
0 0.1 0.2 0.3 0.4 0.5−10
−5
0
Magnitude Response, Phase Response, Group Delay
Mag
nitu
de in
dB
0 0.1 0.2 0.3 0.4 0.5−400
−300
−200
−100
0
Phas
e in
deg
rees
0 0.1 0.2 0.3 0.4 0.50
10
20
30
f/fS !
Gro
up d
elay
in s
ampl
es
x(n)
y(n)
Tx(n-1)
y(n-2)
1d(1-c)-c
T
T Ty(n-1)
x(n-2)
-d(1-c)c
E85.2607: Lecture 2 – Filters 2010-01-28 8 / 15
Tunable bandpass/bandreject filters
A(z)x(n) y(n)
!BP/BR-/+
A(z)x(n) y(n)
!BP/BR-/+
typoE85.2607: Lecture 2 – Filters 2010-01-28 9 / 15
BP/BR frequency response
0 0.1 0.2 0.3 0.4 0.5−10
−5
0
Magnitude Response, Phase Response, Group DelayM
agni
tude
in d
B
0 0.1 0.2 0.3 0.4 0.5−100
−50
0
50
100
Phas
e in
deg
rees
0 0.1 0.2 0.3 0.4 0.50
5
10
15
f/fS !
Gro
up d
elay
in s
ampl
es
0 0.1 0.2 0.3 0.4 0.5−10
−5
0
Magnitude Response, Phase Response, Group Delay
Mag
nitu
de in
dB
0 0.1 0.2 0.3 0.4 0.5−100
−50
0
50
100
Phas
e in
deg
rees
0 0.1 0.2 0.3 0.4 0.5−6
−4
−2
0
2x 1014
f/fS !
Gro
up d
elay
in s
ampl
es
E85.2607: Lecture 2 – Filters 2010-01-28 10 / 15
Cascading filters
Make the frequency response sharper by passing the signal through the samefilter multiple times
2008-10-14Dan Ellis 17
Cascading Filters! Repeating a filter (cascade connection)
makes its characteristics more abrupt:
! Repeated roots in z-plane:
H(ejω)
H(ejω) H(ejω) H(ejω)
ω
|H(ejω)|
ω
|H(ejω)|3
1
ZP
h
h3
E85.2607: Lecture 2 – Filters 2010-01-28 11 / 15
Equalizers
MFPeakx(n) y(n)
LFShelving
MFPeak
HFShelving
Cut-off frequency fBandwidth fGain G in dB
c
b
Cut-off frequency fBandwidth fGain G in dB
c
b
+12+6
0-6
-12
Cut-off frequency fGain G in dB
c Cut-off frequency fGain G in dB
c
f
fc fc fc fc
fb fb
G/dB
A(z)x(n) y(n)
LF/HF+/-
x(n-1)x(n)
y (n-1)1
aB/C 1
T
T
y (n)1
y (n)1
-aB/C
H /20
Chain of simple filters to shape spectrum
Low/high shelf H(z) = 1 + (10G/20 − 1) HLP/HP(z)
Peak H(z) = 1 + (10G/20 − 1) HBP(z)
Parameters: Gain, center frequency, bandwidth (Q)
Applications: mixing, compensate for room acoustics, genre controls
E85.2607: Lecture 2 – Filters 2010-01-28 12 / 15
Time-varying filters: Wah
x(n) y(n)1-mix
mix
x(n) y(n)1-mix
mix
Bandpass filter with time varying center frequency
Mimics formant resonances in speech
E85.2607: Lecture 2 – Filters 2010-01-28 13 / 15
Time-varying filters: Phaser
Time
Freq
uenc
y
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.80
0.5
1
1.5
2
x 104
x(n) y(n)d
e
AP APAP
x(n) y(n)d
e
fb
x(n) y(n)
e1
e2
e3
e4
d
Notches with time varying center frequency
Controlled by a low frequency oscillator
E85.2607: Lecture 2 – Filters 2010-01-28 14 / 15
Reading
Introduction to Digital Filters
Elementary Audio Digital Filters
DAFX, Chapter 2 (if you have it)
E85.2607: Lecture 2 – Filters 2010-01-28 15 / 15