introduction to audio and music engineering · topics:! • from simple filters to echo and...
TRANSCRIPT
Topics: • From simple filters to echo and reverb • Variable delay single tap FIR filter • Variable delay single tap IIR filter • Plucked string filters • Karplus - Strong plucked string models
3
Introduction to ���Audio and Music Engineering
Lecture 22
Back to the simple filter …
4
Y = X + a 1z −1X
1 unit delay a1
+ input X output Y
x (n − 1) a 1x (n − 1)
Multiply by z/z: zz1 + a 1z −1
1 =z + a 1z
Y = H (z)XH (z) = 1 + a 1z
−1
We want to know the magnitude of H(z). H (z) =z + a 1
z
We are interested in |H(z)| for the allowed frequencies (on unit semicircle in z-plane). z → e jω
Continued …
5
but H (z) =z + a 1
z→ H (e jω ) =
e jω + a 1
e jω e jω = 1
H (e jω ) = e jω + a 1 = e jω − (−a 1 )so
This is simply the distance from the point to –a1 on the real axis. e jω
–a1
e jω
1
e jω − (−a 1 )
e jω
−a 1
c b
a
a +b =c
b =c −a
The further away is from –a1 the larger the filter response. e jω
“zero” of H(z)
What does look like?
6
H (e jω )
Low pass
–a1
e jω
1
ω = 0
π
H (e jω )
ω
1
1 + a1 2
0
1 - a1 ω = π
High pass
a1
e jω
1
ω = 0
π
H (e jω )
ω
1
1 + a1 2
0
1 - a1 ω = π
ω = π4
ω = π2
ω = 3π4
ω = π4
ω = π2
ω = 3π4
Feed-forward and feed-back filters
7
x (n) = [1, 0, 0, 0, 0, 0...]
Z-1 a1
+ input X output Y
feed-forward
Response is non-zero only for n = 0,1 .
y (n) = [1,a 1 , 0, 0, 0, 0...]
y (n) = x (n) + a 1x (n − 1)
impulse
response
Finite impulse response filter : FIR
feed-back
Z-1 b1
+ input X output Y
y (n) = x (n) + b 1y (n − 1)
x (n) = [1, 0, 0, 0, 0, 0...]
Response never returns to zero!
y (n) = [1,b 1 ,b 12 ,b 1
3,b 14...]
impulse
response
Infinite impulse response filter : IIR
Frequency response of feedback filter
8
Z-1 b1
+ input X output Y
Y = X + b 1z −1Y
zz
multiply by
Y (1 − b 1z −1 ) = XY = 1
(1 − b 1z −1 ) X H (z) = 11 − b 1z
−1
zz
11 − b 1z −1 = z
z − b 1H (z) =
zz − b 1
H (ω ) =e jω
e jω − b 1
= 1e jω − b 1
z → e jω
b1
e jω
1
e jω − b 1e jω
-1 So the feedback filter response is proportional to the inverse of the distance from a point on the unit semicircle to the point b1. “pole” of H(z)
π
H (e jω )
ω
1
2
0 - b1
e jω
1
1/(1+b1)
1/(1-b1)
Frequency response of the feedback filter
9
low pass
b1
e jω
1
ω = 0
π
H (e jω )
ω
1
2
0
ω = π
ω = π4
ω = π2
ω = 3π4
1/(1+b1)
1/(1-b1)
high pass
ω = 0ω = π
ω = π4
ω = π2
ω = 3π4
Feedback filter stability
10
e jω
1 π
H (e jω )
ω
1 2
0
3 4 5
As the pole moves closer to the unit circle the response increases.
As the pole moves out past the unit circle the filter response diverges. … the filter is unstable.
Z-1 b1
+input X output
Y
y (n) = x (n) + b 1y (n − 1)
x (n) = [1, 0, 0, 0, 0, 0...]
y (n) = [1,b 1 ,b 12 ,b 1
3,b 14...]
If b1 > 1, y(n) grows without bound!
input impulse
response
Poles must remain within the unit circle to make the filter stable.
Higher order filters
11
feed-forward
Z-1
-1
+ input X
Z-1
+ output Y
Y = X − z −1X + z −1z −1XY = X − z −1X + z −2X = (1 − z −1 + z −2 )X
H (z) = (1 − z −1 + z −2 )1
z2
z2 = (z2 − z + 1)z2
H (z) =(z2 − z + 1)
z2
z → e jωThe denominator is always 1.
e jω( )2 = e j2ω = 1
(z2 − z + 1) = 0Where are the zeros?
Finding the zeros of H(z)
12
(z2 − z + 1) = 0
→ z = 1 ± 1 − 42 = 1
2 ± j 32
Convert to polar form
r = 1 2( )2 + 3 2( )2⎡
⎣⎢
⎤
⎦⎥
1/2
= 1 4 + 3 4⎡⎣ ⎤⎦1/2
= 1
θ = tan−1 3 21 2
⎛
⎝⎜
⎞
⎠⎟ = tan−1 3( ) = ± π 3 ±60( )
z = e + jπ 3 and z = e − jπ 3zeros are at …
e jω
1
e jω
“zeros” of H(z)
ω = 0ω = π
Finding the transfer function
13
num(H (z)) = z − e jπ/3( ) z − e − jπ/3( ) = z − e jπ/3( ) ⋅ z − e − jπ/3( )
e jω
1
e jω
ω = 0ω = π
Just the product of the distances from to each of
the two zeros. e jω
π
H (e jω )
ω0 π / 3
General filters
14
+ input X
output Y
a0
Z-1 a1
Z-2 a2
Z-1 b1
Z-2 b2
. . .
. . .
Y = a0 + a 1z −1 + a2z −2 + ...( )X − b 1z −1 + b2z −2 + ...( )Y
Y =a0 + a 1z −1 + a2z −2 + ...( )1 + b 1z −1 + b2z −2 + ...( ) X H (z) =
z − z 1( ) z − z2( ) z − z3( ) ...z − p 1( ) z − p2( ) z − p3( ) ...
Solve for Y You can factor the numerator and denominator
But it might not be easy!
-1
Finding the frequency response …
15
H (ω ) =e jω − z 1( ) e jω − z2( ) e jω − z3( ) ...e jω − p 1( ) e jω − p2( ) e jω − p3( ) ...
Multiply the distances to each zero then divide by the products of the distances to each of the poles.