MUS420 Lecture Computational Acoustic Modeling with Digital Delay Julius O. Smith III ([email protected]) Center for Computer Research in Music and Acoustics (CCRMA) Department of Music, Stanford University Stanford, California 94305 February 11, 2020 Outline • Lumped and Distributed Modeling • Delay lines • Filtered Delay lines • Digital Waveguides • Echo simulation • Comb filters • Vector Comb Filters (Feedback Delay Networks) • Tapped Delay Lines and FIR Filters • Allpass filters • Artificial Reverberation 1
51
Embed
MUS420 Lecture Computational Acoustic Modeling with ...jos/Delay/Delay.pdf · longitudinal waves, where Y is Young’s modulus = “spring constant” for solids (stress/strain =∆
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
MUS420 LectureComputational Acoustic Modeling with Digital Delay
Julius O. Smith III ([email protected])Center for Computer Research in Music and Acoustics (CCRMA)
Department of Music, Stanford UniversityStanford, California 94305
K/ǫ, the wave equation is satisfied forany shape traveling to the right at speed c (butremember slope ≪ 1)
• Similarly, any left-going traveling wave at speed c,yl(t + x/c), satisfies the wave equation (show)
5
• General solution to lossless, 1D, second-order waveequation:
y(t, x) = yr(t− x/c) + yl(t + x/c)
• yl(·) and yr(·) are arbitrary twice-differentiablefunctions (slope ≪ 1)
• Important point: Function of two variables y(t, x)is replaced by two functions of a single (time) variable⇒ reduced computational complexity.
• Published by d’Alembert in 1747(wave equation itself introduced in same paper)
6
Sampled Waves and Lumped Filters
We have that the wave equation Y d′′ = ǫd is obeyed byany pair of traveling waves
d(t, x) = dr
(
t−x
c
)
+ dl
(
t +x
c
)
• dl(·) and dr(·) are arbitrary twice-differentiabledisplacement functions
• c =√
K/ǫ for transverse waves, and c =√
Y/ρ forlongitudinal waves, where Y is Young’s modulus =“spring constant” for solids (stress/strain ∆
=
force-per-unit-area / relative displacement),ρ is mass per unit volume (rods), andǫ is mass per unit length (ideal strings)
• We can sample these traveling-wave components toobtain the super-efficient digital waveguide modelingapproach for strings and acoustic tubes (and more)
• Any acoustic “ray” or propagating wave can beimplemented digitally using a simple delay linefollowed by linear filtering to implement loss and/ordispersion:
y(n)x(n) z−M HM (z)
7
Delay lines
Delay lines are important building blocks for many audioeffects and synthesis algorithms, including
Direct-Form-I Difference Equation(commute gain b0 to the input):
y(n) = b0 x(n)− aM y(n−M)
Transfer Function
H(z) =b0
1 + aMz−M
Frequency Response
H(ejωT ) =b0
1 + aMe−jMωT
42
Simplified Feedback Comb Filter
Special case: b0 = 1, −aM = g ⇒
y(n) = x(n) + g y(n−M)
H(z) =1
1− g z−M
• Impulse response is a series of echoes, exponentiallydecaying and uniformly spaced in time:
H(z) =1
1− g z−M= 1 + g z−M + g2 z−2M + · · ·
←→ δ(n) + g δ(n−M) + g2 δ(n− 2M) + · · ·
= [1, 0, . . . , 0︸ ︷︷ ︸
M−1
, g, 0, . . . , 0︸ ︷︷ ︸
M−1
, g2, 0, . . . ]
• Models a plane wave between parallel walls
• Models wave propagation on a guitar string
• g = round-trip gain coefficient:
– two wall-to-wall traversals (two wall reflections)
– two string traversals (two endpoint reflections)
43
Simplified Feedback Comb Filter, Cont’d
g
x(n)
y(n)
z−M
y(n) = x(n) + g y(n−M)
H(z) =1
1− g z−M
For a sinewave input and 0 < g < 1:
• Gain is maximum [1/(1− g)] when a whole numberof periods fits in M samples:
ωkT = k2π
M, k = 0, 1, 2, . . .
These are again the DFTM basis frequencies
• Gain is minimum [1/(1 + g)] when an odd number ofhalf-periods fits in M samples:
ωkT = (2k + 1)π
M, k = 0, 1, 2, . . .
44
Feed-Back Comb-Filter Amplitude Response
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 10
2
4
6
8
10
12
Normalized Frequency (cycles per sample))
Ma
gn
itu
de
(L
ine
ar)
a)
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1−10
−5
0
5
10
15
20
Normalized Frequency (cycles per sample))
Ma
gn
itu
de
(d
B)
b)
g=0.1g=0.5g=0.9
• Linear (top) and decibel (bottom) amplitude scales
• H(z) = 11−gz−M
•M = 5, g = 0.1, 0.5, 0.9
• G(ω)∆=∣∣H(ejωT )
∣∣ =
∣∣∣
11−ge−jMωT
∣∣∣ →
g = 1
1
2 sin(M2 ωT)
45
Inverted-Feed-Back Comb-Filter AmplitudeResponse
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 10
2
4
6
8
10
12
Normalized Frequency (cycles per sample))
Ma
gn
itu
de
(L
ine
ar)
a)
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1−10
−5
0
5
10
15
20
Normalized Frequency (cycles per sample))
Ma
gn
itu
de
(d
B)
b)
g=−0.1g=−0.5g=−0.9
• Linear (top) and decibel (bottom) amplitude scales
• H(z) = 11−gz−M
•M = 5, g = −0.1,−0.5,−0.9
• G(ω)∆=∣∣H(ejωT )
∣∣ =
∣∣∣
11−ge−jMωT
∣∣∣ →
g = −1
1
2 cos(M2 ωT)
46
Schroeder Allpass Filters
b0
y(n)x(n)
−aM
z−M
• Used extensively in artificial reverberation
• Transfer function:
H(z) =b0 + z−M
1 + aMz−M
• To obtain an allpass filter, set b0 = aM
Proof:
∣∣H(ejωT )
∣∣ =
∣∣∣∣
a + e−jMωT
1 + ae−jMωT
∣∣∣∣=
∣∣∣∣
a + e−jMωT
ejMωT + a
∣∣∣∣
=
∣∣∣∣∣
a + ejMωT
a + ejMωT
∣∣∣∣∣= 1
47
First-Order Allpass Filter
Transfer function:
H1(z) = S1(z)∆=
k1 + z−1
1 + k1z−1
k1
−k1
x(n)
y(n)
−k1
k1y(n)x(n)
(a)
(b)
z−1
z−1
(a) Direct form II filter structure
(b) Two-multiply lattice-filter structure
48
Nested Allpass Filter Design
Any delay-element or delay-line inside a stableallpass-filter can be replaced by any stable allpass-filter toobtain a new stable allpass filter:
z−1 ← Ha(z) z−1
(The pure delay on the right-hand-side guarantees nodelay-free loops are introduced, so that the originalstructure can be used)
Proof:
1. Allpass Property: Note that the above substitution isa conformal map taking the unit circle of the z planeto itself. Therefore, unity gain for |z| = 1 is preservedunder the mapping.
2. Stability: Expand the transfer function in series form:
S([Ha(z)z
−1]−1)
= s0+s1Ha(z)z−1+s2H
2a(z)z
−2+· · ·
where sn = original impulse response. In this form, itis clear that stability is preserved if Ha(z) is stable.