Let’s now go back to the original DSP program and add the newly designed filter. Switch to the Block Diagram and Double-click on the DFD Filter Express VI you added on the Block Diagram in step 1. In “Path” section of the “Configure Filter” prompt, click the Browse button and navigate to the filter design you saved earlier, click “OK” to accept. Run the program.
Because the signal frequency is significantly lower than the passband cutoff frequency, the signal should pass through the filter with very little attenuation. Change the frequency plot to manual scale. Sweep the input signal frequency through the range 500 Hz. – 3000 Hz. and note the resulting time-domain and frequency-domain plots.
Set the input sine wave to the following frequencies: 1000 Hz, 1200 Hz, 1500 Hz, 2000 Hz, and 3000 Hz. For each frequency input, observe the corresponding filter output (both displays as well as the actual sound) and measure/record the exact amplitude of the output signal for each frequency. The easiest way to measure the amplitudes is to stop the simulation and then place your mouse pointer at the appropriate position on the graph. Note: You will need to change the scale of the graphs to read accurately. Call your lab assistant for help on how to change the scale.
Answer these questions
Record the amplitude and corresponding attenuation (in dB) of the filtered sinusoid for each of the frequencies below.
The equation for attenuation is:
attenuation = -20log(output amplitude/(maximum amplitude.
Take special note of the attenuations at 1000 Hz and 1500 Hz. What do you expect these values to be theoretically? (show work) How do your actual values compare to the theoretical values?
Put the input frequency to 800 Hz and run the program again. Without changing anything else, change the sampling frequency in the Analog Input and Analog Output elements to 8000 Hz and run the program. Observe what happens to the output signal. When done, set all sampling frequencies back to 16000 Hz.
Answer these questions
Explain what happens to the filter’s performance when the sampling frequency is changed from Fs = 16000 Hz to 8000 Hz. Specifically, what happens to the 800 Hz signal when it is passed through the filter now? Explain what this implies about the importance of operating a digital filter using the same sampling frequency that you used to design it.
Now deactivate the Line-In input in Surround Mixer and run the program again using your CD input instead. Listen to and observe the output of the filter (in both the time and frequency domain).
Answer these questions
Discuss the effect of the lowpass filter on the music signal.
To really see the effect of the filter more graphically, remove the Analog Input element and Add function from the Block Diagram and add a EMB Uniform White Noise Waveform node instead (Functions»Embedded Signal Generation»EMB Uniform White Noise Waveform.vi). This block generates white noise. White noise has energy spread equally across the frequency spectrum. For this reason, a white noise generator is often a good test of a filter’s performance. Connect this block to the input of the IIR Filter. Double click on the Noise block and set the Amplitude = 10000, save and close it.
Run the program and observe the sound of the noise and take note of both its spectrum and time-domain shape. Now remove the lowpass filter block completely from the worksheet and connect the output of the Noise block directly to the Analog Output element. Re-run the program and observe the signal again. This is what unfiltered white noise looks/sounds like.
Answer these questions
Discuss how the shape of the white noise signal changes when it is passed through the lowpass filter. Also, describe how the sound changes.
Re-add an IIR filter block back into your system and connect it to the system the same way you did the previous IIR block. Load your new filter coefficient file into the IIR filter block. Keeping the Noise Generator as your input signal, run the program again and note the difference between how the noise gets filtered by the bandpass and lowpass filters.
Remove the Noise block and re-add the Analog Input node and the Add Function. Connect these to the rest of the system as you did earlier and run the system using your CD input. Observe the output signal.
Add a second IIR filter block to your system in parallel with the first block. Load the original lowpass filter coefficient file into this block. Double-click on the Analog Output Element and select 2 channels multiple samples. Now send the output of one filter to one of the channels of the Analog Output element and the output of the other filter to the other channel. (Note: Only one of the filter outputs can be connected to the displays. It doesn’t matter which one you have connected). Run the program using your CD input, and listen to the filtered output. You should hear a different signal in each ear.
As a final experiment, break the parallel filter connections and connect the 2 filter blocks in cascade rather than parallel by passing the output of one filter through the other filter and sending the output of the 2nd filter to the Analog Output element. Run the program using your CD input.
Answer these questions
When the lowpass and bandpass filters are cascaded together, what happens to the output signal? Why?
Call your TA over to verify that you have completed this last part of the lab. If time permits, feel free to design a few other types of IIR filters and connecting them in various ways.