<< Chapter < Page Chapter >> Page >

Inlab report

For both the pcm signal and the filtered output, submit the following:
  • The time domain plot of the signal for 101 points.
  • The plot of the magnitude of the DTFT computed from 1001 samples of the signal.
  • The plot of the magnitude of the DTFT for ω in the range [ θ - 0 . 02 , θ + 0 . 02 ] .
Also hand in the code for the IIRfilter filtering function. Comment on how the signal looks and sounds before and after filtering.How would you expect changes in r to change the filtered output? Would a value of r = 0 . 9999999 be effective for this application? Why might such a value for r be ill-advised? (Consider the spectrum of the desired signal around ω = θ .)

Lowpass filter design parameters

Download the file nspeech2.mat for the following section.

Tolerance specifications for the frequency response of a filter.

Oftentimes it is necessary to design a good approximation to an ideal lowpass, highpass or bandpass filter. [link] illustrates the typical characteristics of a real low-pass filter.The frequencies | ω | < ω p are known as the passband, and the frequencies ω s < | ω | π are the stopband. For any real filter, ω p < ω s . The range of frequencies ω p ω ω s is known as the transition band. The magnitude of the filter response, H ( e j ω ) , is constrained in the passband and stopband by the followingtwo equations

| H ( e j ω ) - 1 | δ p for | ω | < ω p | H ( e j ω ) | δ s for ω s < | ω | π

where δ p and δ s are known as the passband and stopband ripple respectively.Most lowpass filter design techniques depend on the specification of these four parameters: ω p , ω s , δ p , and δ s .

DTFT of a section of noisy speech.

To illustrate the selection of these parameters consider the problem of filtering out backgroundnoise from a speech signal. [link] shows the magnitude of the DTFT over a window of such a signal, called nspeech2.Notice that there are two main components in nspeech2: one at the low frequenciesand one at the high. The high frequency signal is noise, and it is band limitedto | ω | > 2 . 2 . The low frequency signal is speech and it is band limited to | ω | < 1 . 8 . Download the file nspeech2.mat . and load it into the Matlab workspace.It contains the signal nspeech2 from [link] . Play the nspeech2 using the sound command and note the quality of the speech and background noise.

In the following sections, we will compute low-pass filters for separating the speech and noiseusing a number of different methods.

Filter design using truncation

Ideally, a low-pass filter with cutoff frequency ω c should have a frequency response of

H i d e a l ( e j w ) = 1 | ω | ω c 0 ω c < | ω | π

and a corresponding impulse response of

h i d e a l ( n ) = ω c π sinc ( ω c n π ) for - < n <

However, no real filter can have this frequency response because h i d e a l ( n ) is infinite in duration.

One method for creating a realizable approximation to an ideal filter is totruncate this impulse response outside of n [ - M , M ] .

h t r u n c ( n ) = ω c π sinc ( ω c π n ) n = - M , ... , 0 , 1 , ... , M 0 otherwise
Frequency response of low-pass filter designed using the truncation method.

[link] shows the magnitude response of the lowpass filter with cutoff frequency ω c = 2 . 0 , with the impulse response truncated to n [ - 10 , 10 ] . Notice the oscillatory behavior of the magnitude response nearthe cutoff frequency and the large amount of ripple in the stopband.

Due to the modulation property of the DTFT, the frequency response of the truncated filter is the result of convolving the magnitude response of the ideal filter (a rect) with the DTFT of the truncating window . The DTFT of the truncating window, shown in [link] , is similar to a sinc function since it is the DTFT of a sampledrectangular window. Notice that this DTFT has very large sidelobes, which leadto large stopband ripple in the final filter.

DTFT of a rectangular window of size 21.

A truncated impulse response is of finite duration, yet the filter is still noncausal.In order to make the FIR filter causal, it must be shifted to the right by M units. For a filter of size N = 2 M + 1 this shifted and truncated filter is given by

h ( n ) = ω c π sinc ω c π ( n - N - 1 2 ) n = 0 , 1 , ... , N - 1 0 otherwise .

This time shift of ( N - 1 ) / 2 units to the right corresponds to multiplying the frequency response by e - j ω ( N - 1 ) / 2 . It does not affect the magnitude responseof the filter, but adds a factor of - j ω ( N - 1 ) / 2 to the phase response. Such a filter is called linear phase because the phase is a linear function of ω .

It is interesting to see that the filter formula of [link] is valid for N both even and odd. While both of these filters are linear phase,they have different characteristics in the time domain. When N is odd, then the value at n = ( N - 1 ) / 2 is sampled at the peak of the sinc function, but when N is even, then the two values at n = N / 2 and n = ( N / 2 ) - 1 straddle the peak.

To examine the effect of filter size on the frequency characteristics of the filter,write a Matlab function LPFtrunc(N) that computes the truncated and shifted impulse response of size N for a low pass filter with a cutoff frequency of ω c = 2 . 0 . For each of the following filter sizes,plot the magnitude of the filter's DTFT in decibels. Hints:The magnitude of the response in decibels is given by | H d B ( e j ω ) | = 20 log 10 | H ( e j ω ) | . Note that the logcommand in Matlab computes the natural logarithm.Therefore, use the log10 command to compute decibels.To get an accurate representation of the DTFT make sure that you compute at least 512 sample points using the command [X,w]=DTFT(filter_response,512) .

  • N = 21
  • N = 101

Now download the noisy speech signal nspeech2.mat , and load it into the Matlab workspace. Apply the two filters with the above sizes to this signal.Since these are FIR filters, you can simply convolve them with the audio signal.Listen carefully to the unfiltered and filtered signals, and note the result. Can you hear a difference between the two filteredsignals? In order to hear the filtered signals better, you may want to multiply each of them by 2 or 3 before using sound .

Inlab report

  • Submit the plots of the magnitude response for the two filters (not in decibels).On each of the plots, mark the passband, the transition band and the stopband.
  • Submit the plots of the magnitude response in decibels for the two filters.
  • Explain how the filter size effects the stopband ripple. Why does it have this effect?
  • Comment on the quality of the filtered signals. Does the filter size have a noticeable effect on the audio quality?

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




Source:  OpenStax, Purdue digital signal processing labs (ece 438). OpenStax CNX. Sep 14, 2009 Download for free at http://cnx.org/content/col10593/1.4
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Purdue digital signal processing labs (ece 438)' conversation and receive update notifications?

Ask