Institute of Phonetic Sciences University of Amsterdam First semester 2007
Digital s What is a digital filter? An algorithm that calculates with sample values Formant /machine H 1 (z) that: Given input value x n Calculates output value y n (no delay) One value per sampling period T (the clock)
Digital s What is a digital filter? An algorithm that calculates with sample values Formant /machine H 1 (z) that: Given input value x n Calculates output value y n (no delay) One value per sampling period T (the clock)
Digital s What is a digital filter? An algorithm that calculates with sample values Formant /machine H 1 (z) that: Given input value x n Calculates output value y n (no delay) One value per sampling period T (the clock)
Digital s What is a digital filter? An algorithm that calculates with sample values Formant /machine H 1 (z) that: Given input value x n Calculates output value y n (no delay) One value per sampling period T (the clock)
Usage? Formant Pre-emphasis od speech signals Formant synthesis ing in the time domain...
Simple Integrator : y n = 0.5x n + 0.5x n 1 (n = 1, 2,... ) x 1 =1.00 Formant y 1 =0.50 x 1 y 1 Calculations y 1 = 0.5x 1 + 0.5x 0 = 0.5 1 + 0.5 0 = 0.5 y 2 = 0.5x 2 + 0.5x 1 = 0.5 0 + 0.5 1 = 0.5 y 3 = 0.5x 3 + 0.5x 2 = 0.5 0 + 0.5 0 = 0 y 4 = 0.5x 4 + 0.5x 3 = 0.5 0 + 0.5 0 = 0
Simple Integrator : y n = 0.5x n + 0.5x n 1 (n = 1, 2,... ) x 2 =0 Formant y 2 =0.50 x 2 y 2 Calculations y 1 = 0.5x 1 + 0.5x 0 = 0.5 1 + 0.5 0 = 0.5 y 2 = 0.5x 2 + 0.5x 1 = 0.5 0 + 0.5 1 = 0.5 y 3 = 0.5x 3 + 0.5x 2 = 0.5 0 + 0.5 0 = 0 y 4 = 0.5x 4 + 0.5x 3 = 0.5 0 + 0.5 0 = 0
Simple Integrator : y n = 0.5x n + 0.5x n 1 (n = 1, 2,... ) x 3 =0 Formant y 3 =0 x 3 y 3 Calculations y 1 = 0.5x 1 + 0.5x 0 = 0.5 1 + 0.5 0 = 0.5 y 2 = 0.5x 2 + 0.5x 1 = 0.5 0 + 0.5 1 = 0.5 y 3 = 0.5x 3 + 0.5x 2 = 0.5 0 + 0.5 0 = 0 y 4 = 0.5x 4 + 0.5x 3 = 0.5 0 + 0.5 0 = 0
Simple Integrator : y n = 0.5x n + 0.5x n 1 (n = 1, 2,... ) x 4 =0 Formant y 4 =0 x 4 y 4 Calculations y 1 = 0.5x 1 + 0.5x 0 = 0.5 1 + 0.5 0 = 0.5 y 2 = 0.5x 2 + 0.5x 1 = 0.5 0 + 0.5 1 = 0.5 y 3 = 0.5x 3 + 0.5x 2 = 0.5 0 + 0.5 0 = 0 y 4 = 0.5x 4 + 0.5x 3 = 0.5 0 + 0.5 0 = 0
Simple Integrator : y n = 0.5x n + 0.5x n 1 (n = 1, 2,... ) x 4 =0 y 4 =0 Formant x 4 y 4 Calculations y 1 = 0.5x 1 + 0.5x 0 = 0.5 1 + 0.5 0 = 0.5 y 2 = 0.5x 2 + 0.5x 1 = 0.5 0 + 0.5 1 = 0.5 y 3 = 0.5x 3 + 0.5x 2 = 0.5 0 + 0.5 0 = 0 y 4 = 0.5x 4 + 0.5x 3 = 0.5 0 + 0.5 0 = 0 If x n = (1, 0, 0, 0,... ) then y n = (0.5, 0.5, 0, 0,... ) (Impulse response)
Simple Differentiator : y n = 0.5x n 0.5x n 1 (n = 1, 2,... ) x 1 =1.00 Formant y 1 =0.50 x 1 y 1 Calculations y 1 = 0.5x 1 0.5x 0 = 0.5 1 0.5 0 = 0.5 y 2 = 0.5x 2 0.5x 1 = 0.5 0 0.5 1 = 0.5 y 3 = 0.5x 3 0.5x 2 = 0.5 0 0.5 0 = 0 y 4 = 0.5x 4 0.5x 3 = 0.5 0 0.5 0 = 0
Simple Differentiator : y n = 0.5x n 0.5x n 1 (n = 1, 2,... ) x 2 =0 Formant y 2 =-0.50 x 2 y 2 Calculations y 1 = 0.5x 1 0.5x 0 = 0.5 1 0.5 0 = 0.5 y 2 = 0.5x 2 0.5x 1 = 0.5 0 0.5 1 = 0.5 y 3 = 0.5x 3 0.5x 2 = 0.5 0 0.5 0 = 0 y 4 = 0.5x 4 0.5x 3 = 0.5 0 0.5 0 = 0
Simple Differentiator : y n = 0.5x n 0.5x n 1 (n = 1, 2,... ) x 3 =0 Formant y 3 =0 x 3 y 3 Calculations y 1 = 0.5x 1 0.5x 0 = 0.5 1 0.5 0 = 0.5 y 2 = 0.5x 2 0.5x 1 = 0.5 0 0.5 1 = 0.5 y 3 = 0.5x 3 0.5x 2 = 0.5 0 0.5 0 = 0 y 4 = 0.5x 4 0.5x 3 = 0.5 0 0.5 0 = 0
Simple Differentiator : y n = 0.5x n 0.5x n 1 (n = 1, 2,... ) x 4 =0 Formant y 4 =0 x 4 y 4 Calculations y 1 = 0.5x 1 0.5x 0 = 0.5 1 0.5 0 = 0.5 y 2 = 0.5x 2 0.5x 1 = 0.5 0 0.5 1 = 0.5 y 3 = 0.5x 3 0.5x 2 = 0.5 0 0.5 0 = 0 y 4 = 0.5x 4 0.5x 3 = 0.5 0 0.5 0 = 0
Simple Differentiator : y n = 0.5x n 0.5x n 1 (n = 1, 2,... ) x 4 =0 y 4 =0 Formant x 4 y 4 Calculations y 1 = 0.5x 1 0.5x 0 = 0.5 1 0.5 0 = 0.5 y 2 = 0.5x 2 0.5x 1 = 0.5 0 0.5 1 = 0.5 y 3 = 0.5x 3 0.5x 2 = 0.5 0 0.5 0 = 0 y 4 = 0.5x 4 0.5x 3 = 0.5 0 0.5 0 = 0 If x n = (1, 0, 0, 0,... ) then y n = (0.5, 0.5, 0, 0,... ) (Impulse response)
Pre-Emphasis 1 : y n = x n ax n 1, where a [0, 1] What is the spectrum? take Z-transform on the left and the right sample sequences: k y kz k = k {x k ax k 1 }z k Formant Y (z) = {x k z k a k x k 1z k = {x k z k a k x k 1z k+1 1 = {x k z k az 1 k x k 1z (k 1) = X (z) az 1 X (z) The simplification: Y (z) = (1 az 1 )X (z) We define H(z) = Y (z)/x (z) as the filter s spectrum
Pre-Emphasis 2 : y n = x n ax n 1, where a [0, 1] Spectrum: H(z) = 1 az 1, this equals the sum of the spectrum of δ(n), H(z) = 1, and the spectrum of aδ(n 1), H(z) = az 1! 1em] H(z) shows the filter s amplitude response. We now write z = e +2πifT (f values are equidistant ) H(f ) = H(f )H (f ) = (1 ae 2πifT )(1 ae +2πifT ) = 1 + a 2 a(e +2πifT + e 2πifT ) = 1 + a 2 2a cos 2πfT Formant
Pre-Emphasis Response 20 log H(f ) = 20 log 1 + a 2 2a cos 2πfT 6 = 10 log(1 + a 2 2a cos 2πfT ) Formant Amplitude (db) 0 25 0 0.5 F s Frequency (Hz) a = 0.50 (dotted) a = 0.80 (dashed) a = 0.95 (plain) Extremes: 20 log H(F s /2)/H(0) = 20 log 1+a 1 a
Digital ing in the Time-Domain Most general linear digital filter formula: y n = M k=0 a kx n k + N j=1 b jy n j Output is linear combinantion of M + 1 inputs x k and N outputs y j. Formant Special Cases Finite Impulse response (FIR) filter, all b j = 0. y n = M k=0 a kx n k Non-recursive, output stops exactly M samples after the last input. Also called: Moving Average (MA) filter. Infinite Impulse Response (IIR) filter, some b j 0. Impulse response may be infinite. Auto Regressive (AR) filter if M = 0 ARMA if N 0 and M 0
Digital ing in the Time-Domain Most general linear digital filter formula: y n = M k=0 a kx n k + N j=1 b jy n j Output is linear combinantion of M + 1 inputs x k and N outputs y j. Formant Special Cases Finite Impulse response (FIR) filter, all b j = 0. y n = M k=0 a kx n k Non-recursive, output stops exactly M samples after the last input. Also called: Moving Average (MA) filter. Infinite Impulse Response (IIR) filter, some b j 0. Impulse response may be infinite. Auto Regressive (AR) filter if M = 0 ARMA if N 0 and M 0
Digital ing in the Time-Domain Most general linear digital filter formula: y n = M k=0 a kx n k + N j=1 b jy n j Output is linear combinantion of M + 1 inputs x k and N outputs y j. Formant Special Cases Finite Impulse response (FIR) filter, all b j = 0. y n = M k=0 a kx n k Non-recursive, output stops exactly M samples after the last input. Also called: Moving Average (MA) filter. Infinite Impulse Response (IIR) filter, some b j 0. Impulse response may be infinite. Auto Regressive (AR) filter if M = 0 ARMA if N 0 and M 0
Digital Layout Example Layout of the filter: y n = P 3 k=0 a kx n k + P 3 j=1 b jy n j = a 0x n + a 1x n 1 + a 2x n 2 + a 3x n 3 + b 1y n 1 + b 2y n 2 + b 3y n 3 Formant
Digital Frequency Response y n = M k=0 a kx n k + N j=1 b jy n j has : Formant Y (z) = P M k=0 a kz k 1 P N j=1 b j z j Numerator and denumerator are polynomials in z. A polynomial may become zero for certain combination of its coefficients. Numerator: no problem, i.e. H(z 0 ) = 0 Denumerator: unstable filter.
IIR Example: Formant Formant (1) y n q p = x n py n 1 qy n 2 = e 2πBT = 2 q cos 2πFT
The Formant y n = x n py n 1 qy n 2 A second order recursive filter with response: H(f ) = 1 1 + pz 1 + qz 2 = z 2 z 2 + pz + q Denominator is second degree polynomial in z. Zeros: z 1,2 = p 2 ± p 2 4 q H(f ) = 1 (z z 1 )(z z 2 ) Interesting (resonance) when zeros lie within the unit circle. Then p2 4 q < 0 and z 1,2 = p 2 ± i q p2 4 We see that z 1 = z2 Formant
The Formant Frequency Response F s /2 z 1 z 2 Formant 0 0.5 F s Given p and q, z 1 and z 2 are fixed. 1 To get the frequency response H(f ) = z z 1 (z z 2 we let z trace the upper part of the unit circle. When we start at z = 0 and end in z = 1 the response follows the curve on the right. When z is close to z 1, z z 1 is very small and 1 the response z z 1 very large. We have resonance. z = 0 means frequency f = 0. z = 1 means f = F s /2
Relations Between p, q and F, B p and q and F Solve re iφ = z 1 = p 2 + i p 2 4 q cos φ = p 2 q Because φ = 2πFT we get F = 1 p 2πT arccos 2 q Formant F, B and p, q F & B (p,q): F = 1 2πT arccos p 2 q B = 1 πt ln q p & q (F, B): q = e 2πBT p = 2 q cos 2πFT
More Formants: Serial Formant For the total filter response: H(z) = Y (z) X (z) = H 2(z)Y 1 (z) X (z) = H 2 (z)h 1 (z) If H 1 (z) and H 2 (z) only have poles than H(z) has only poles.
More Formants: Parallel Formant For the total filter response: H(z) = Y (z) X (z) = Y 1(z)+Y 2 (z) X (z = H 1 (z) + H 2 (z) If H 1 (z) and H 2 (z) only have poles than H(z) has poles and also may have zeros. These zeros depend on H 1 (z) and H 2 (z) and are fixed. This is not desireable.