Digital Filters in Audio ELEC-E5620 - Audio Signal Processing, Lecture #2

Digital Filters in Audio ELEC-E5620 - Audio Signal Processing, Lecture #2

1/25/2019 25 January 2019 Digital Filters in Audio ELEC-E5620 - Audio Signal Processing, Lecture #2 Sound check Vesa Välimäki Acoustics Lab, Dept. Signal Processing and Acoustics, Aalto University Course Schedule in 2019 (Periods III-VI) 0. General issues (Vesa & Benoit) 11.1.2019 1. History and future of audio DSP (Vesa) 18.1.2019 2. Digital filters in audio (Vesa) 25.1.2019 3. Audio filter design (Vesa) 1.2.2019 4. Analysis of audio signals (Vesa) 8.2.2019 5. Audio effects processing (Benoit) 15.2.2019 * No lecture (Evaluation week for Period III) 22.2.2019 6. Synthesis of audio signals (Fabian) 1.3.2019 7. Reverberation and 3-D sound (Benoit) 8.3.2019 8. Physics-based sound synthesis (Vesa) 15.3.2019 9. Sampling rate conversion (Vesa) 22.3.2019 10. Audio coding (Vesa) 29.3.2019 @2018-2019 Vesa Välimäki 25.1.2019 2 1 1/25/2019 Outline • Digital filters are basic tools in audio signal processing – Simple FIR & IIR filters – Comb filters – Resonators – Allpass filters – Shelving filters – Equalizing filters – Fractional delay filters Contains figures taken from Ken Steiglitz, A Digital Signal Processing Primer with Applications to Digital Audio and Computer Music, Addison-Wesley, 1996. 25.1.2019 © 2001-2019 Vesa Välimäki ELEC-E5620 Audio Signal Processing 3 Lecture #2: Digital Filters @2018-2019 Vesa Välimäki What’s a Digital Filter? • Digital filter = Computational algorithm to modify a digital signal – Often some frequencies may need to be attenuated or amplified • Two main types 1. Feedforward or FIR filters 2. Feedback or IIR filters 25.1.2019 © 2001-2019 Vesa Välimäki ELEC-E5620 Audio Signal Processing 4 Lecture #2: Digital Filters @2018-2019 Vesa Välimäki 2 1/25/2019 FIR Filters • FIR = Finite Impulse Response – Impulse response = Output signal of the filter when the input signal x(n) is a unit impulse – Unit impulse = Digital signal whose first sample is 1 and the rest are 0 – Impulse response h(n) of an FIR filter consists of its coefficients x(n) z-1 z-1 z-1 h(0) h(1) h(2) ... h(N) y(n) 25.1.2019 © 2001-2019 Vesa Välimäki ELEC-E5620 Audio Signal Processing 5 Lecture #2: Digital Filters @2018-2019 Vesa Välimäki First-Order FIR Filter • Add the input signal with its delayed and scaled version – Real weights h1 and h2 for the input and the delayed input signal • Difference equation: x(n) z-1 y(n) = h1x(n) + h2x(n –1) h1 h2 • Impulse response: [h1 h2] • Z transform: y(n) -1 -1 Y(z) = h1X(z) + h2X(z)z = [h1 + h2z ]X(z) -1 • Transfer function: H(z) = h1 + h2z (roots = zeros) • Frequency response (set z = ej ) j j j –j H(e ) = Y(e )/ X(e ) = h1 + h2e • Magnitude |H(ej) | is the filter gain; angle is the phase 25.1.2019 © 2001-2019 Vesa Välimäki ELEC-E5620 Audio Signal Processing 6 Lecture #2: Digital Filters @2018-2019 Vesa Välimäki 3 1/25/2019 Magnitude Response Interpretation • Magnitude response |H(ej)| is a vector length on the z plane – Travel along the unit circle and measure the distance from the zero Imaginary axis Z plane H (e j ) Real axis See: K. Steiglitz, A Digital Signal Processing Primer with Applications to Digital Audio and Computer Music, Addison-Wesley, 1996. 25.1.2019 © 2001-2019 Vesa Välimäki ELEC-E5620 Audio Signal Processing 7 Lecture #2: Digital Filters @2018-2019 Vesa Välimäki Magnitude Response Interpretation • Magnitude response |H(ej)| is a vector length on the z plane – Travel along the unit circle and measure the distance from the zero j H (e ) HighLow frequenciesfrequencies See: K. Steiglitz, A Digital Signal Processing Primer with Applications to Digital Audio and Computer Music, Addison-Wesley, 1996. 25.1.2019 © 2001-2019 Vesa Välimäki ELEC-E5620 Audio Signal Processing 8 Lecture #2: Digital Filters @2018-2019 Vesa Välimäki 4 1/25/2019 Magnitude Response Evaluation • Magnitude response of the 1st-order FIR filter: 2 2 1/2 |H()| = |h1 + h2 + 2h1h2cos()| Example: h1 = 1.0 h2 = -0.7 25.1.2019 9 @2018-2019 Vesa Välimäki First-Order FIR Filtering of Music • A music signal is processed 1) Original with the FIR filter 2) Filtered when h2 = –0.7 -1 3) Filtered when h2 = –0.9 H(z) = h1 + h2z , 4) Filtered when h2 = –1.0 where h1 = 1.0 and 5) Original h2 is varied (44.1 kHz, 16 bits) @2018-2019 Vesa Välimäki 25.1.2019 10 5 1/25/2019 IIR Filters a b0N • IIR = Infinite Impulse x(n) y(n) Response 1 1 – The impulse response z z ab1 a usually decays N 1 1 exponentially to zero • IIR filter structures are … … based on feedback z 1 z 1 baN1–1 aN 1 • The transfer function has poles in addition to 1 1 z a z zeros bN N 25.1.2019 © 2001-2018 Vesa Välimäki ELEC-E5620 Audio Signal Processing 11 Lecture #2: Digital Filters @2018-2019 Vesa Välimäki The Simplest IIR Filter: One-Pole Filter • Add the input and the delayed and scaled output signal – Magnitude of feedback coefficient must not be larger than 1 • Difference equation: x(n) y(n) y(n) = x(n) + a1y(n –1) • Z transform: a1 Y(z) = X(z) + a Y(z)z–1 1 z-1 • Transfer function: –1 H(z) = Y(z)/X(z) = 1/(1 – a1z ) (Minus sign!) • Frequency response: Often called the j –j “leaky integrator” H(e ) = 1/(1 – a1e ) (when 0 < a1 < 1) 25.1.2019 12 @2018-2019 Vesa Välimäki 6 1/25/2019 IIR Filter’s Magnitude Response • Magnitude response: Z plane –j |H()| = 1 / |1 – a1 e | • Zero of the denominator, or the pole • Geometrical interpretation – Mark the pole on the Z plane – Travel along the unit circle from 0 to – Measure the distance from the pole – Compute the inverse of the distance 25.1.2019 13 @2018-2019 Vesa Välimäki Magnitude Response Evaluation –j • Magnitude response of |H()| = g / |1 – a1 e | where g controls the gain of the filter • The choice g = 1 – a1 maintains the dc gain* of 0 dB (DC gain = gain at 0 Hz) (Steiglitz 1996) 25.1.2019 © 2001-2019 Vesa Välimäki ELEC-E5620 Audio Signal Processing 14 Lecture #2: Digital Filters @2018-2019 Vesa Välimäki 7 1/25/2019 Comb Filter (1) • The name stems from the shape of magnitude response • Obtained from a one-pole filter by replacing z–1 with z–L • Example: a1 = 0.999, L = 8 x(n) y(n) a1 z-L 25.1.2019 © 2001-2019 Vesa Välimäki ELEC-E5620 Audio Signal Processing 15 Lecture #2: Digital Filters @2018-2019 Vesa Välimäki Comb Filter (2) • When the unit delay is replaced with a delay line, the pole of the first-order filter is duplicated L times on the z plane • Example: a1 = 0.999, L = 8 x(n) y(n) a1 z-L 25.1.2019 © 2001-2019 Vesa Välimäki ELEC-E5620 Audio Signal Processing 16 Lecture #2: Digital Filters @2018-2019 Vesa Välimäki 8 1/25/2019 Comb Filter (3) • When the feedback coefficient is negative, peaks occur at odd harmonics • Example: a1 = –0.999, L = 8 x(n) y(n) a1 z-L 25.1.2019 © 2001-2019 Vesa Välimäki ELEC-E5620 Audio Signal Processing 17 Lecture #2: Digital Filters @2018-2019 Vesa Välimäki Inverse Comb Filter (1) • Sometimes called the FIR comb filter • Obtained by inverting the comb filter transfer function • Example: L = 8 + x(n) y(n) _ a1 z-L 25.1.2019 © 2001-2019 Vesa Välimäki ELEC-E5620 Audio Signal Processing 18 Lecture #2: Digital Filters @2018-2019 Vesa Välimäki 9 1/25/2019 Inverse Comb Filter (2) • Poles become zeros • Digital simulation of direct sound and a single reflection (e.g. floor) • Example: L = 8 + x(n) y(n) _ a1 z-L 25.1.2019 © 2001-2019 Vesa Välimäki ELEC-E5620 Audio Signal Processing 19 Lecture #2: Digital Filters @2018-2019 Vesa Välimäki Resonance • A bump in the magnitude response – E.g. a formant, or a mode of a vibrating structure • Sharpness is described by bandwidth: – Usually, the difference of points where the gain is 3 dB below the peak • Other properties: center frequency & peak value (gain) • Quality factor: Q = center frequency / bandwidth – Large Q value sharp resonance – Small Q value wide resonance 25.1.2019 © 2001-2019 Vesa Välimäki ELEC-E5620 Audio Signal Processing 20 Lecture #2: Digital Filters @2018-2019 Vesa Välimäki 10 1/25/2019 Pole Radius • Resonance is caused by a pole close to the unit circle • Distance can be deduced from bandwidth: R 1 – B/2 where B = 2f and f is normalized frequency – Alternative form: R 1 – f •Example: fs = 44.1 kHz and bandwidth is 20 Hz: R 1 – (20/44100) = 0.998575 25.1.2019 © 2001-2019 Vesa Välimäki ELEC-E5620 Audio Signal Processing 21 Lecture #2: Digital Filters @2018-2019 Vesa Välimäki Digital Resonator • Resonators are crucial in audio DSP – Subtractive synthesis, formant filters, parallel equalizers... • To generate a resonance between 0 Hz and the Nyquist frequency, a pole pair is needed – A pole and its complex conjugate • Transfer function: H(z) = 1 / (1 – Rejz–1) (1 – Re–jz–1) or H(z) = 1 / (1 – 2Rcos()z–1 + R2 z–2 ) • Difference equation: y(n) = x(n) + 2Rcos()y(n –1)–R2y(n –2) 25.1.2019 © 2001-2019 Vesa Välimäki ELEC-E5620 Audio Signal Processing 22 Lecture #2: Digital Filters @2018-2019 Vesa Välimäki 11 1/25/2019 Digital Resonator • Examples of magnitude responses of second-order IIR filters (with scaling) 25.1.2019 © 2001-2019 Vesa Välimäki ELEC-E5620 Audio Signal Processing 23 Lecture #2: Digital Filters @2018-2019 Vesa Välimäki Interactive Design With Matlab Matlab-demo: restoola.m 25.1.2019 © 2001-2019 Vesa Välimäki ELEC-E5620 Audio Signal Processing 24 Lecture #2: Digital Filters @2018-2019 Vesa Välimäki 12 1/25/2019 How to Choose Resonator Parameters • Sometimes it is enough to choose parameters ja R – is resonance frequency and R = 1 – B/2 pole radius • However, at low frequencies, the pole and its mirror are close to each other and can bias the peak location – Peak is not exactly at the frequency corresponding to ! 25.1.2019 © 2001-2019 Vesa Välimäki ELEC-E5620 Audio Signal Processing 25 Lecture #2: Digital Filters

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    47 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us