Week 7: DFT And Convolutions
Chris Tralie
In this exercise, we're going to explore what the DFT of signals looks like after convolution in terms of the DFTs of the original signal and the DFTs of the impulse responses. Below are some imports that you can throw into your notebook to get started
Also, recall how you can plot the DFT amplitudes with the correct frequencies as follows:
In all of the examples below, you should plot the DFT of the original signal, the DFT of the impulse response, and the DFT of the convolution
Part 1: Comb Filters
We made some observations a few weeks ago about comb filters, including the fact that we can control the pitch by changing the spacing between the echoes in the impulse response, and the fact that the pitch becomes clearer if we have more echoes. Load in the robot audio
and plot its DFT. Then, setup a comb impulse response, plot its DFT, and plot the DFT of the convolution. How do these change as you change the spacing of the comb and the number of echoes?
Part 2: Moving Average
Given audio of length N, create an impulse response that is all ones up to a certain index K, followed by all zeros after K up to N. The effect of convolution here is to perform a moving average, with a window length of K. What do you notice about the DFT of the impulse response and the DFT of the convolution as you vary window length in the moving average?
Try adding some noise to your signal with np.random.randn(N), and repeat this experiment.
Part 3: Discrete Derivative
Given audio of length N, create an N-length impulse response that is all zeros except for the first two samples; the first sample should be a 1, and the second sample should be a -1. What do you notice about the DFT of the impulse response and the DFT of the convolution?