signal system project
ECE334 Discrete Signals and Systems Laboratory Project - IIR Notch Filter Design
Dr. Ratliff, Fall 2018
1 Project Definition:
In this project, you are given two digital audio clips that have been corrupted by DTMF tones resulting from pressing the numeric ‘1’ and ‘*’ keys on a Touch-Tone phone. The goal is to remove the tones from each signal by designing cascaded digital notch filters. The digital audio clips are sampled at different sampling rates (16kHz and 8kHz) with the tone signals being added at varying times for varying durations. This project is designed to make use of the mathematical tools we have learned this semester and introduce you to MATLAB tools that are useful for this type of filter design.
2 Problem Description:
The Touch-Tone phone system, developed during the 1960’s by AT&T, was created to eliminate the need for rotary-dialing telephone systems. This is accomplished using Dual-Tone Multi-Frequency (DTMF) signaling and has resulted in the familiar tones we hear when dialing a telephone. As the name implies, each tone is generated by introducing a sinusoidal wave at two distinct frequencies. As such, the DTMF telephone keypad is laid out in a 4 × 4 matrix of push buttons in which each row represents the low frequency component and each column represents the high frequency component of the DTMF signal. Pressing a key sends a combination of the row and column frequencies, as described in the figure below:
For example, pressing the ‘1’ key produces a superposition of tones at 697 and 1209 hertz (Hz). When these keys are pressed, they are mixed with the audio signal from the phone microphone. When such an audio stream is digitized and recorded, it may be desirable to later remove these tones from the audio stream. One way to do this is to design a group of filters such that each respective filter removes the content at a single frequency. Such filters are called digital notch filters (also called bandstop or band-reject filters). A block diagram for such a system can be represented by:
In this case each hk[n], for k = 1, 2, . . . , 8, represents a digital notch filter for one of the numeric tone frequencies from the DTMF keypad. Thus, if such an ideal filter bank is employed, it would indeed remove the tones resulting
1
from any key-press. Notice that the total impulse response of such a filter bank can be obtained as
h[n] = h1[n] ∗ h2[n] ∗ . . . ∗ h8[n].
In this project we are going to design second order recursive filters, i.e., infinite impulse response (IIR) filters to remove each sinusoidal frequency term. Thus, we expect to have two poles and two zeros for each filter. For notch filters of this type the design is straight-forward. For each frequency we want to filter, we simply place a pole and zero along a line corresponding to the digital frequency we wish to notch, along with their respective complex conjugate pairs, as shown in the pole-zero diagram below.
Notice that the zero is placed upon the unit circle with a magnitude of 1, i.e., znk = e ±jθk , and each pole is
placed at the same angle, θk, only at a magnitude of α, i.e., zdk = αe ±jθk , where 0 < α < 1, znk denotes system
zeros and zdk denote system poles. Here θk corresponds directly to the digital frequency of the sinusoid to be notched. Later we will use α as a tuning parameter to optimize our system. We can directly write the transfer function, Hk(z) for this filter from the pole-zero plot above. Once we do this for each frequency we wish to notch, we can form the total system transfer function, i.e,
H(z) = H1(z)H2(z) . . . H8(z).
Once we obtain the total transfer function we can obtain the difference equation for the system and then implement it in a for loop in MATLAB to actually apply it to digital audio signals.
3 Design Tasks:
In this section we will make the computations necessary to design our cascaded digital notch filter. In the document you submit online, create a Design section and provide the information requested below in each task.
1. Based upon the two keys that were pressed, determine the sinusoidal frequencies imposed by the DTMF tones. Then, compute the corresponding digital frequencies that need to be removed from our signals–thus, we do not need to remove all eight possible frequencies, only the ones that are present in the signals. Notice that we have to compute these digital frequencies for each sampling rate of interest. Create the following table with your results in the document you submit.
Frequency (Hertz) θk at 8kHz (radians/sample) θk at 16kHz (radians/sample)
2
2. Using these digital frequencies, determine the locations of the poles and zeros for each notch filter (use polar coordinates). Use a magnitude of 1 for all zeros and assume a magnitude value of α for the poles, where |α| < 1 (this will be a tuning parameter). Create the following table with your results in the document you submit.
fs zn1 , z ∗ n1 zn2 , z
∗ n2 zn3 , z
∗ n3 zd1 , z
∗ d1
zd2 , z ∗ d2
zd3 , z ∗ d3
8kHz
16kHz
3. For each sampling rate, determine Hk(z) for k = 1, 2, 3.
4. Now, for each sampling rate, determine the total system transfer function H(z).
5. Determine an expression for the frequency response, H(ejω), for each cascaded system.
6. Finally, determine the difference equation corresponding to each cascaded transfer function (use only the real part of each coefficient).
4 Implementation and Analysis:
In this section we will implement and apply our notch filter to digital audio data. Download the audio files crows tones.wav (16kHz) and voice tones.wav (8kHz), and the MATLAB function IIRNotchFilter.m from the class website. In your submitted document create an Implementation and Analysis section and include the figures generated any discuss any analysis in this section.
1. Use the IIRNotchFilter(. . .) function to process each audio file. Open the IIRNotchFilter function in the MATLAB editor and examine the code for usage instructions and an explanation of the implemen- tation details. In each case provide the audio filename and the analog frequencies to notch (as a vector). Set β = 1.0 and then choose a starting value for α, where 0 < α < 1.
2. Now, experiment with the value of α (i.e., placing the poles different distances from their corresponding zeros) until you determine a value for α that removes the tones to your satisfaction. We are trying to remove the tones while preserving the underlying audio signal as best as possible. Note the value of α you find works best for each audio signal.
3. Generate a pole-zero plot for both cascaded systems using the MATLAB function zplane. Assume that α = 0.9 for this plot and include it in your submitted document as Figure 1.
4. Plot the magnitude and phase response for each analytical cascaded transfer function (i.e., |H(ejω)| and ∠H(ejω)) you determined above in 2.5 (again assume α = 0.9). Verify that the notched frequencies occur at the digital frequencies you expect. Be sure to properly label all axes and plot these for ω ∈ [−π, π]. Include this plot in your document as Figure 2.
5. Plot the audio sequences as a function of n before and after processing each audio file. Include this plot as Figure 3.
6. Compute the Fourier Transform of each audio signal before and after processing and plot the mag- nitude response of each signal and its processed version on the same plot for ω ∈ [−π, π]. Note: to compute the Fourier Transform use: X = abs(fftshift(fft(x))), where x is the audio data and X is its corresponding Fourier Transform. Then, generate the frequency vector for the FFT using w = linspace(−pi, pi, length(x)). Include this plot as Figure 4.
7. Now, convert the frequency axis to its corresponding analog frequencies (in Hertz) and plot the mag- nitude response plots against this analog frequency vector. Be sure and properly label all axes for these plots. Include this plot as Figure 5.
3
5 Questions:
Create a section entitle Results and Discussion and answer the following questions, making use of the design results from Section 2 and the implementation experience and figures generated in Section 3.
1. Given the constraints of our 2nd order filters, were you able to find a setting for α that removes the tones and does not distort the underlying audio signal?
2. Instead of designing a different set of filters for each sample rate, describe another approach you could have taken to design only one set of filters (think of how you could change the signal, rather than the filter), along with the benefits and tradeoffs this approach brings.
3. What were the values of α you found work best for each audio signal? Keep in mind that there is a subjective aspect to this so your answers may not agree with others.
4. Describe the relationship between Figures 1 and 2. Do the notches appear to be at the correct frequencies in the magnitude and phase response plots of Figure 2?
5. Is the phase response of each filter in Figure 2 linear? Explain the behavior of the phase response at the notched frequencies.
6. In regards to Figure 3, can you identify where the tones were added to the signal? Is it obvious that they have been (completely) removed after processing?
7. In regards to Figures 4 and 5, can you identify the tone frequencies? What is their shape? Do the tones show up at the proper analog frequencies? Are they removed after application of your designed filters?
8. Overall, what are your conclusions as to how effective the notch filters are at removing the tones from each signal?
4