Week 7: STFT Noise Shaping
Chris Tralie
In this exercise, students will use the short-time fourier transform to implement a lowpass filter that decays frequencies more and more over time. Students can use librosa.stft to compute the STFT, and librosa.istft to compute the inverse STFT (students will implement the inverse STFT themselves in homework 3).
Consider the following code
That will yield the following image
Note that librosa's stft does not include the redundant mirror images, so that makes this a little bit easier; you don't have to worry about mirror images, and you know that higher row indices correspond to higher frequencies. Your goal should be to change the amplitude only of the higher frequencies so that they die out more quickly than the lower frequencies over time, obtaining a spectrogram like this:
When you invert it, you should hear this
You can also use this to create a neat effect on music. Consider the clip Billy.wav
Which has this spectrogram
Then let's transform the spectrogram in the same way so the amplitudes are like this
which leads to the following