Speech Signal Processing Problem 1 Speech Signal Processing
Solution Filter length estimation: from transition band width ∆ 𝑓 1 = 𝑓 𝑠𝑡𝑜𝑝 − 𝑓 𝑝𝑎𝑠𝑠 𝑓 𝑠 𝑎𝑛𝑑 𝑁= 3.3 ∆𝑓 We select N = 25 for the number of filter coefficients and using the Hamming window method. we next obtain from the transition band central frequency 𝑓 𝑐 = 𝑓 𝑝𝑎𝑠𝑠 +𝑠𝑡𝑜𝑝 2 The normalized lower and upper cutoff frequencies are calculated as: and 𝑁=2 𝑀+1=25 𝑀=12
Design using MATLAB
w : Window coefficients h: filter transfer function coefficients b: filter coefficients
Filter Coefficients
Original speech and processed speech using the band-pass filter. The band-pass frequency components contain a small portion of speech energy
Spectral comparison of the original speech and processed speech using the ban-dpass filter. low and high frequencies are removed by the band-pass filter. Low scale amplitude
Problem 2 1. Calculate the filter coefficients for a 5-tap FIR band-pass filter with a lower cutoff frequency of 1,000 Hz and an upper cutoff frequency of 1,500 Hz and a sampling rate of 5,000 Hz. 2. Determine the transfer function and plot the frequency responses with MATLAB. 3. apply the hamming window function to obtain windowed coefficients; 4. plot the impulse response ℎ(𝑛).and windowed impulse response ℎ 𝑤 (𝑛). Hamming window
Solution Calculating the normalized cutoff frequencies leads to Ω 𝐿 = 2𝜋 𝑓 𝐿 𝑓 𝑠 = 2𝜋 1000 5000 =0.4 𝜋 𝑟𝑎𝑑𝑖𝑎𝑛𝑠 Ω 𝐻 = 2𝜋 𝑓 𝐻 𝑓 𝑠 = 2𝜋 1500 5000 =0.6 𝜋 𝑟𝑎𝑑𝑖𝑎𝑛𝑠 Since 2M +1= 5 in this case, using the equation in Table ℎ 𝑛 = Ω 𝐻 − Ω 𝐿 𝜋 𝑛=0 sin(Ω 𝐻 𝑛) 𝑛𝜋 − sin(Ω 𝐿 𝑛) 𝑛𝜋 𝑛≠0 𝑎𝑛𝑑−2≤𝑛≤2 Calculations for non-causal FIR coefficients are listed as ℎ 0 = Ω 𝐻 − Ω 𝐿 𝜋 = 0.6𝜋−0.4𝜋 𝜋 =0.2 ℎ 1 = sin(Ω 𝐻 𝑛) 𝑛𝜋 − sin(Ω 𝐿 𝑛) 𝑛𝜋 = sin 0.6𝜋 ×1 1×𝜋 − sin 0.4𝜋 ×1 1×𝜋 =0.0035 ℎ 2 = sin(Ω 𝐻 𝑛) 𝑛𝜋 − sin(Ω 𝐿 𝑛) 𝑛𝜋 = sin 0.6𝜋 ×2 2×𝜋 − sin 0.4𝜋 ×2 2×𝜋 =0.0035
Problem 3 Let us design a first-order digital low-pass filter with a 3-dB cutoff frequency of 𝜔 𝑐 =0.25 𝜋 by applying the bilinear transformation to the analog Butterworth filter: 𝐻 𝑎𝑝 (𝑠)= 1 1+ 𝑠 Ω 𝑐
1. Frequency Warping (mapping digital frequency to analog frequency) Solution 1. Frequency Warping (mapping digital frequency to analog frequency) Because the 3-dB cutoff frequency of the Butterworth filter is Ω 𝑐 for a cutoff frequency 𝜔 𝑐 =0.25 𝜋 in the digital filter, we must have: Ω 𝑐 = 2 𝑇 𝑠 𝑡𝑎𝑛 0.25𝜋 2 = 0.828 𝑇 𝑠 2. Prototype Transformation (From Prototype analog LPF to desired analog filter) Therefore, the system function of the analog filter is (we use directly the given analog Butterworth filter ): 𝐻 𝑎 𝑠 = 1 1+ 𝑠 Ω 𝑐 = 1 1+ 𝑠𝑇 𝑠 0.828 3. Bilinear Transformation (From analog filter transfer function to digital filter Transfer Function) Applying the bilinear transformation to the analog filter gives 𝐻 𝑎 𝑧 = 𝐻 𝑎 𝑠 𝑠= 2 𝑇 𝑠 1− 𝑧 −1 1+ 𝑧 −1 = 1 1+ 2 0.828 1− 𝑧 −1 1+ 𝑧 −1 =0.292 1+ 𝑧 −1 1−0.4159 𝑧 −1 Note that the parameter 𝑇 𝑠 , does not enter into the design.
Matlab %- freqz returns the frequency response based on the current filter coefficients b=[0.292 0.292]; a=[1 -0.4159]; [hz,f]=freqz(b,a); % 512 nb of data plot %- angle(hz)returns the phase angles in radians, phi = 180*unwrap(angle(hz))/pi; %- unwrap Correct phase angles to produce smoother phase plots subplot(2,1,1), plot(f, abs(hz)),grid; %axis([0 fs/2 0 1]); %xlabel('Frequency (Hz)'); ylabel('Magnitude Response') subplot(2,1,2), plot(f, phi); grid; %axis([0 fs/2 -100 0]); %xlabel('Frequency (Hz)'); ylabel('Phase (degrees)')
Problem 4 Illustrating the simple pole-zero method of calculating filter coefficients a band-pass digital filter is required to meet the following specifications: Assuming a sampling frequency of 500 Hz, obtain 1. The transfer function of the filter by suitably placing z-plane poles and zeros. 2. its difference equations. 3. Block diagram representation of filter.
Solution Since a complete rejection is required at zero and 250Hz we need to: place zeros at the corresponding points on the z-plane. These are at angles of 0° and 360×250/500=180° on the unit circle. place zeros at : 𝜃= 𝑓 𝑓 𝑠 360 ° = 0 500 360 ° = 0 ° and 𝜃= 250 500 360 ° = 18 0 ° 𝑧 1 =1 𝑎𝑛𝑑 𝑧 2 =−1 To have the pass-band centered at 125Hz requires us to place poles at ±360×125/500=±90°. place poles at : 𝑝 1 =𝑟 𝑒 𝑗 𝜋 2 𝑎𝑛𝑑 𝑝 2 =𝑟 𝑒 −𝑗 𝜋 2 To ensure that the coefficients are real , it is necessary to have complex conjugate pole pair. The radius of the poles is determined by the desired bandwidth. An approximate relationship between r, for r > 0.9 , and bandwidth bw is: 𝑟~1− 10 500 3.14=0.937 for our specifications bw =10Hz and Fs = 500Hz . This leads to an r value of r = 0.937 The difference equation is
𝑓 𝑠 /2 Pole-zero dıagram Block diagram representation of filter
Matlab f0 = 125 ; bw = 10; fs= 500; r=1-(bw/fs)*pi; % magnitude of the pole theta=(f0/fs)*360; % angle of the pole k=((1-r)*sqrt(1-2*r*cos(2*theta*(pi/180))+r^2))/(2*abs(sin(theta*(pi/180)))); % the filter transfer function b=[k 0 -k];a=[1 -2*r*cos(theta*(pi/180)) r^2]; %- freqz returns the frequency response based on the current filter coefficients [hz,f]=freqz(b,a,512,fs); % 512 nb of data plot %- angle(hz)returns the phase angles in radians, phi = 180*unwrap(angle(hz))/pi; %- unwrap Correct phase angles to produce smoother phase plots subplot(2,1,1), plot(f, abs(hz)),grid; axis([0 fs/2 0 1.5]); xlabel('Frequency (Hz)'); ylabel('Magnitude Response') subplot(2,1,2), plot(f, phi); grid; axis([0 fs/2 -180 180]); xlabel('Frequency (Hz)'); ylabel('Phase (degrees)')