ELEN E4896 MUSIC SIGNAL PROCESSING Lecture 7: Filters & Reverb 1. Filters & EQ 2. Time delay effects 3. Reverb Dan Ellis Dept. Electrical Engineering, Columbia University dpwe@ee.columbia.edu E4896 Music Signal Processing (Dan Ellis) http://www.ee.columbia.edu/~dpwe/e4896/ 2013-03-04 - 1 /17 1. Filters & EQ • EQ is a critical tool in audio mixing boost/cut on single control each instrument has its own “space” • Different formats Low/Mid/High, Parametric Graphic EQ E4896 Music Signal Processing (Dan Ellis) 2013-03-04 - 2 /17 EQ filters • How to get boost + cut from a single filter? 1 A(z) -0.5 -0.2π -0.4π 0 -0.6π -10 -1 0 1 Re{z} -20 ∠{A(z)} 0 10 0.5 -1 |A(z)| 20 level / dB Im{z} use allpass -0.8π 0 0.2π 0.4π 0.6π 0.8π -π π 0 0.2π 0.4π 0.6π 0.8π π then +/- to get phase cancellation/reinforcement + A(z) y[n] level / dB x[n] 1 + g A(z) 20 g = -1 10 g=0 0 g = -1...1 -10 -20 0 g=1 0.2π 0.4π 0.6π 0.8π π s03-allpass1.pd E4896 Music Signal Processing (Dan Ellis) 2013-03-04 - 3 /17 Allpass Filters • Allpass filters have flat gain: |A(ej)| = 1 from mirror-image numerator and denominator: A(z) = z 1 A(z) ) 0.6 + z A(z) = 1 0.6z 1 0 -0.5 0 1 Re{z} -20 1 ∠{A(z)} -0.4π 0 -0.6π -10 -1 1 -0.2π 10 0.5 -1 0.6z 1 |A(z)| 20 level / dB Im{z} e.g. for Dm (z) = 1 Dm (z Dm (z) m -0.8π 0 0.2π 0.4π 0.6π 0.8π -π π 0 0.2π 0.4π 0.6π 0.8π π slope governs phase interactions, group delay g ( c) E4896 Music Signal Processing (Dan Ellis) = d ( ) d = c 2013-03-04 - 4 /17 Group Delay • Local phase change of H(z) governs effective delay of that frequency region: “group delay” g ( c) d ( ) d = = c 8000 Frequency 6000 4000 2000 0 0 0.5 1 1.5 Time 2 2.5 3 0 0.5 1 1.5 Time 2 2.5 3 8000 Frequency 6000 4000 2000 0 E4896 Music Signal Processing (Dan Ellis) 2013-03-04 - 5 /17 Parametric EQ Im{z} • 2nd order Allpass → slope & place θ(ω) = π |A(z)| 10 dB 0.5 0 0 0 -0.5π -10 -π -20 -0.5 -1.5π -30 -1 -1 -0.5 0 0.5 0 Re{z} ∠{A(z)} 0.2π 0.4π 0.6π 0.8π -2π ω 0 0.2π 0.4π 0.6π 0.8π ω angle → frequency radius → slope → bandwidth x[n] + A(z) y[n] 1 + g A(z) 20 level / dB • Same structure for EQ g=1 10 g=0 0 g = -1...1 -10 -20 E4896 Music Signal Processing (Dan Ellis) g = -1 0 0.2π 0.4π 0.6π 0.8π π s06-allpass2.pd 2013-03-04 - 6 /17 Time-Varying Filters • Classic Wah-Wah ? • Iterated Filters... s07-wahwah.pd E4896 Music Signal Processing (Dan Ellis) 2013-03-04 - 7 /17 2. Time Delays • Delays correspond to sound propagation 340 m/s ≈ 1 foot / ms • Delays are a simple kind of filter can analyze from Fourier perspective... x[n] delay τ y[n] 1 |H(ejω)| h[n] = δ[n – τ] ω ⇒H(ejω) = e–jωτ ∠{H(ejω)} 1 0 τ E4896 Music Signal Processing (Dan Ellis) ω −jωτ n 2013-03-04 - 8 /17 Fractional Delays • For short delays, one sample quantization may be too coarse 1 sample @ 44.1 kHz = 22.7 µs • Fractional delay can be recovered from Fourier domain e sin (n (n j ) ) = sinc(n ) 1 0.8 sinc(n-τ) 0.6 0.4 h[n] 0.2 0 -0.2 -0.4 0 1 2 3 4 5 6 truncated FIR implementation E4896 Music Signal Processing (Dan Ellis) 7 8 9 10 time / samples 2013-03-04 - 9 /17 Comb Filters x[n] y[n] + delay τ g h[n] 1 g 0 τ • Delay added to direct path causes “comb” n Im{z} .. from phase interactions 1+g 1 0.5 1 0 -0.5 1- g 0 0 -1 π/τ 2π/τ 3π/τ 4π/τ 5π/τ ... • Range of perceptual effects < 10 ms - phasing (spectral structure) 20-100 ms - chorus/doubling > 100 ms - echo E4896 Music Signal Processing (Dan Ellis) -1 -0.5 0 0.5 1 Re{z} s10-comb.pd 2013-03-04 - 10/17 IIR Comb Filters x[n] • Feedback delay spreads out more in time y[n] + h[n] 1 delay τ g 0 g τ τ g2 τ g3 τ g4 ... n Im{z} • Poles can give unbounded gain 1 1+g 1 0.5 0 -0.5 1 1 1- g 0 -1 π/τ 2π/τ 3π/τ 4π/τ 5π/τ ... -1 -0.5 0 0.5 1 Re{z} s11-iircomb.pd E4896 Music Signal Processing (Dan Ellis) 2013-03-04 - 11/17 Time Varying Delay • Periodic variation over large range Pitch modulation analogous to Doppler shift x[n] delay line y[n] • Random (but smooth) shift over short delay Chorus pattern of cancellation “notches” like detuned voices s12-vardelay.pd E4896 Music Signal Processing (Dan Ellis) 2013-03-04 - 12/17 3. Reverberation • Received sound is direct path + reflections l(t) delayed relative to direct path different at each ear Direct-toReverberant... direct reflected t r(t) R R/ t c • Source→Ear is ~ LTI can use impulse response, convolution freq / Hz hlwy16 - 128pt window 0.1 0.05 0 -10 0.1 -20 6000 0.05 -30 0 -40 -0.05 -50 4000 -0.05 -0.1 8000 2000 0 0.2 0.4 0.6 0.8 time / s E4896 Music Signal Processing (Dan Ellis) -0.1 0 0 -60 0 0.01 0.1 0.2 0.02 0.3 0.4 time 0.5 /s 0.03 0.6 0.7 time / s -70 2013-03-04 - 13/17 Early Echoes & Late Reverb • Reflected paths are like “virtual sources” virtual (image) sources reflected path source listener first part of reverberant IR is sparse • Reflections quickly build up & merge later part of reverb is like decaying noise 0.1 0.05 0 -0.05 0 05 0.1 -0.1 0.05 0.01 0 0.2 0.4 0. .4 0.005 0.6 0 0 -0.05 -0.005 -0.1 E4896 Music Signal Processing (Dan Ellis) 0 0.01 0.02 0.03 -0.01 0.2 0.8 0.3 0.4 0.5 0.6 2013-03-04 - 14/17 Nested Allpass • Allpass efficiently creates decaying response multiple, combined filters for complex patterns FIR Comb 2 1.5 Allpass z-k 1 -g H(z) = 1 - g·z-k -g 0.5 0 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 6 4 x[n] y[n] + z-k + 2 h[n] 1-g2 g(1-g2) 2 g (1-g2) k g g,k 3k iIR Comb n 1 Imaginary Part -g Nested+Cascade Allpass 50,0.5 20,0.3 2k 0 Synthetic Reverb + 30,0.7 a0 + AP0 g E4896 Music Signal Processing (Dan Ellis) AP1 LPF 0 −0.5 −1 + a1 0.5 a2 −1 −0.5 0 0.5 Real Part 1 AP2 s15-gardnerverb.pd 2013-03-04 - 15/17 Feedback Delay Network • Matrix of feedbacks gives even more complex patterns from Stauter & Puckette 1982 “Unitary” matrix ensures decay s16-reverb.pd E4896 Music Signal Processing (Dan Ellis) 2013-03-04 - 16/17 • Filters: Summary EQ used to balance mixes Varying filters gives effects e.g. Wah-wah • Delays Wide range of effects: phasing ... echo Fractional delays • Reverb Just a complex pattern of echoes Discrete early echoes → reverberant tail E4896 Music Signal Processing (Dan Ellis) 2013-03-04 - 17/17