This sketch demonstrates very simply how you might use the inverse FFT to modify an audio signal.
Press 'f' to perform the forward FFT, then press 's' to set one of the frequency bands to 150.
Now press 'd' to take the inverse FFT. You will see that the wave form now looks like two sine waves that have
been added together. In fact, this is exactly the case. The sine wave that has been added has the
same frequency as the frequency band that we artificially changed the value of.
You might wonder what the actual frequency added to the spectrum is.
That frequency is a fraction of the sampling rate, which can be found with the formula f = i/N
where f is the fraction of the sampling rate, i is the index of the frequency band,
and N is the time-domain size of the FFT. In this case we have a 512 point FFT and we are
changing the frequency band at index 20. So in our case f = 20/512 = 0.0390625
Our sampling rate is 44100 Hz, a value passed in the Sine constructor,
so the frequency in Hz that is being added to the spectrum is 44100 * 0.0390625 = 1722.65625 Hz
Built with Processing