You are on page 1of 8
Es 6.7 APPLICATION: SIGNAL ENHANCEMENT AND FILTERING 211 ‘The difference equations for the direct-form II realization have three parallel sections, expressed as pula) =1.39x(n) wal) —x(n) -0.4we2(1— 1) y2(nt) = 2.12(n) w3(n) =x(n) ~0.903(0~1) ys(nt) = -0.2w3(n) vn) = yuln)+y2(n) 9500) In practice, the second-order filter module using the direct-form I or ditect-form II is used. The high- order filter can be factored in the cascade form with the first- or second-crder sections, In case the first- order filter is required, we an still modify the second-order filter module by setting the corresponding filter coefficients to be zero. 6.7 APPLICATION: SIGNAL ENHANCEMENT AND FILTERING ‘This section investigates the applications of signal enhancement using a preemphasis filter and speech filtering using a bandpass filter. Enhancement also includes the biomedical signals such as an electro- cardiogram (ECG) signal. 6.7.1 PREEMPHASIS OF SPEECH ‘A speech signal may have frequency components that falloff at high frequencies. In some applications such as speech coding, to avoid overlooking the high frequencies, the high-frequency components are ‘compensated using preemphasis filtering. A simple digital filter used for such compensation is given as y(n) =a(n) —ax(n—1), 40, where ais the positive paremeter to control the degree of preemphasis filtering and usually is chosen to be <1. The filter described in Eq. (6.41) is essentially a highpass filter. Applying z-transform on both sides of Eq. (6.41) and solving for the transfer function, we have H “The magnitude and phase responses adopting the preemphasis parameter a@—=0.9 and the sampling rate f.=8, 000 Hz are plotted in Fig. 6.30A using MATLAB Fig. 6.30B compares the original speech waveform and the preemphasized speech using the filter in Eq, (6.42). Again, we apply the fast Fourier transform (FFT) to estimate the spectrum of the original speech and the spectrum cf the preemphasized speech. The plots are displayed in Fig. 6.31 From Fig, 6.31, we can conclude that the filter does its job to boost tre high-frequency components and attenuate the low-frequency components. We can also try this filter with different values of a to examine the degree of preemphasis filtering of the digitally recorded speech. The MATLAB list is given in Program 6.3. i (6.42) a 212 CHAPTER 6 DIGITAL SIGNAL PROCESSING SYSTEMS a Bo § 10-7 PAH i ! ae Te00Ta08 2000 2500 s000 3008 «o00 Frequency (Hertz) r Phase (degrses) 0 5c04000 1500 200025003000 500 «000 (a) Frequency (Hertz) x10 ‘Speech: We lost the golden chain Speech samples e Le 020408 08 1 12 14 4€ 182 ®) Number of samples a0! FIG. 6.30 (A) Frequency responses of the preemphasis fer. (B) Original speech and preeriphasized speech waveforms. Es 6.7 APPLICATION: SIGNAL ENHANCEMENT AND FILTERING 213 Original speech 8 a 3 8 Amplitude spectrum Ak 500 1000-1500 2000 2500 3000 3500 4000 Preemphasized speech 8 & 8 ‘Ampitude spectrum Ak 500 1000 1500 2000 2500 3000 35004000, Frequency (H2) FIG. 6.31 ‘Amplitude spectral plots for the original speech and preemphasized speech. Program 6.3. MALAB program for preemphasis of speech ‘Matlab program for Figs. 6.30 and 6.31 close all;clear all f5~8000; Sampling rate alpha -0.9; S Degree of pre-emphasis Figured) Freqz(Cl -alpha],151Z,fs); Calculate and display frequency response Toad speech.dat, Figure(2) y-filter({1-alpha}.1.speech); Filtering speech Subplot(2,1,1),plot:speech) ;arids ylabel(*Speech samples” ) Litle( ‘Speech: We lost the golden chain.") subplot(2,1,2),plotiy):arid ylabel (“Filtered samples") xTabel (‘Number of sanples") title “Preemphaci zed epeech.") Figure(3) as 214 CHAPTER 6 DIGITAL SIGNAL PROCESSING SYSTEMS Ne=Tength( speech) & Length of speech Axkwabs(fft(speech.*hamming(N)"))/W: Two-sided spectrum o* speech Ayk=abs(FftCy.*hanming(N)"))/Ns Two-sided spectrum of preemphasi zed speech £-[0:N/2}+Fo/Ns Axk(2:N)=2AKK(2 20) 4 Get one-side spectrum of speech Ayk(22N)=2AyK(2 210 4 Get one-side spectrum of filtered speech Subp]ot(2,1,1),plot(t.axk(1:M/2+1) );arid ylabel (*Anp!itude spectrum Ak title( ‘Original speech") subplot(2,1,2),plot(t.ayk(1:M/2+1) ):arid ylabel( Amp] i tude spectrum Ak” xlabel (“Frequency (Hz)"): title(*Preemphasized speech’); : 6.7.2 BANDPASS FILTERING OF SPEECH Bandpass filtering plays an important role in DSP applications. It can be used to pass the signals accord- ing to the specified frequency passband and reject the frequency other than the passband specification. Then the filtered signal can further be used for the signal feature extraction. Filtering can also be applied to perform applications such as noise reduction, frequency boosting, digital audio equalizing, and digital crossover, among others. Let us consider the following digital fourth-order bandpass Butterworh filter with a lower cutoff frequency of 1000Hz, an upper cutoff frequency of L400 Hz (i.e., the bandwidth is 400 Hz), and a sam- pling rate of 8000Hz: 0.0201 ~0.0402~* + 0.02012-4 MONT a Time 269525? — 1.692 HO.GNTE eae. Converting the z-transfer function into the DSP difference equation yields x(n) =0.0201 (2) ~0.0402x(n—2) +0.02014(0—4) 644) +2,1192y(n— 1) ~2,6952y(n—2) + 1,6924y(n—3) —O.6414y(—4) The filter frequency responses are computed and plotted in Fig. 6.32A with MATLAB, Fig. 6.32B shows the original speech and filtered speech, while Fig. 6.32C displays the spectral plots for the orig- inal speech and filtered speech. As shown in Fig. 6.32C, the designed bandpass filter significantly reduces low-frequency compo- nents, which are <1000Hz, end the high-frequency components above 140Hz, while letting the sig- nals with the frequencies ranging from 1000 to 1400 Hz pass through the filter. Similarly, we can design and implement other types of filters. such as lowpass. highpass, bandpass, and bandreject to filter the signals and examine the performances of their designs. MATLAB implementation detail is given in Program 6.4. es 6.7 APPLICATION: SIGNAL ENHANCEMENT AND FILTERING 215 Magnitude response (48) Las 0 600 10001600 2000 2600 3000 3600-4000 Frequency (Hertz) z ; osu Tu00 80020002800 SOON BOD atu A) Frequency (Hertz) x10! SSposch: We lest the golden chain 2 Original samples Lis & eon £2000 5 By cen 0 a2 a 08 B12 as te ©) Number sampies in FIG. 6.32 (A) Frequency responses of the designed bandpass filter. (B) Plots of the orignal speech and filtered speech. (Continued) a 216 CHAPTER 6 DIGITAL SIGNAL PROCESSING SYSTEMS Original speech 8 z ‘Amplitude spectum Ak $8 0 600 1000 15002000 2500 3000 3500 4000 Bandpass filtered speech s 8 ‘Amalitude spectrum Ak ‘50010001500 2000 2500 3000 3500 4000 Frequency (Hz) 5S Fie. 6.32, CONT'D (C) Amplitude spectra of the orginal speech and bandpass filtered speech. Program 6.4. MATLAB program for bandpass filtering of speech -8000 Sampling rate reqz( 0.0201 0.00-0.0402 0 0.0201),[1-2.1192 2.6952-1.6924 0 64141,512, fs); axis([0#S/2-40 1]; % Frequency response of bandpass filter figure load speech.dat yefilter({a 921A aa-n nang a azni}c1-7 11977 Ba57-1 BA7AA KA14I.cpesch) Subp10t(2,1,1),plot(speech): grid % Filtering speech ylabel(‘Origibal Samples") title( ‘Speech: We lost the golden chain.") subplot(2,1,2),plot(y): grid xlabel (‘Number of Samples” ):ylabel (“Fi Iter: LiLie( “Bandpass f/1Lereu speech.) Figure ength( speech) bs(FFt(speech. *hamming(N)"})/N; % Qne-sided spectrum 0° speech Ayk=abs( FF tCy.*hanmniing(N)*))/Ns ‘%One-sided spectrum 0° filtered speech =[02N/2}*FS/N AxK(2IN)=24Axk(2:N) sAyK(2:N)~2tAyk(220):& One-sided spectra subplot(2,1,1),plot(f,Axk(1:M/2+1) ):grid ylabel(*Anp]i tude spectrum Ak”) title(‘Original speech"): subplot(2,1,2),plot(t,ayk(1:W/2+1) ):grid ylabel( Amp] i tude epectrum Ak" ):xlabel (‘Frequency (Hz)*): title( ‘Bandpass filtered speech"); amples" ) a 6.7 APPLICATION: SIGNAL ENHANCEMENT AND FILTERING 217 6.7.3 ENHANCEMENT OF ECG SIGNAL USING NOTCH FILTERING A notch filter is a bandreject filter with a very narrow bandwidth, It can be applied to enhance the ECG signal corrupted during the data acquisition stage, where the signal contains a 60-He interference i duced from the power line, Let us consider the following digital second-order notch filter with a notch frequency of 60Hz and the digital system has a sampling frequency of S00Hz, We obtain a notch filter (details can be found in Crapter 8) as follows: (6.45) ‘The DSP difference equation is expressed as (2) =x(n) ~ 1.4579x(n — 1) +4(2—2) +1.38503(n ~ 1) -09025y(n 2). (6.46) ‘The frequency responses ere computed and plotted in Fig. 6.33. Comparison of the raw ECG signal corrupted by the 60-H1z interference with the enhanced ECG signal for beth time domain and frequency domain are displayed in F gs. 6.34 and 6.35. respectively. As we can see. the notch filter completely removes the 60-Hz interference. & Magnitude (68) 4 2 0 50 100 150 200 250 Frequency (Hz) 100 Phase idegrees) 100 0 150 Frequency (He) FIG, 6.33, Notch filter frequency resporses. a 218 CHAPTER 6 DIGITAL SIGNAL PROCESSING SYSTEMS Raw ECG corupted by 60 Hz intererence 10000; =— ovo : ‘Original samgles 0 80¢ 1000 1500 2000 2500 3000 3500 4000 4500 5000 Enhanced ECG signal Filtered samples 0 80¢ 1000 1500 2000 2500 3000 3500 4¢00 4500 5000 Number of samples FIG. 6.34 The corrupted ECG signal and the enhanced ECG signal. Raw ECG corrupted by 60 Hz interference ‘Amplitude spectrum Ak ‘Amplitude spectrum At 50 100 150 200 250 Frequency (H2) FIG. 6.95, The corrupted ECG signal spectrum and the enhanced ECG signal spectrum.

You might also like