This sketch demonstrates the inverse FFT.
The inverse FFT is how you turn frequency domain information into time-domain information. Time-domain information is what you have in a sample buffer and is what can be sent to the system for playback.
All this sketch does is allow you to take the forward FFT of a static buffer and then perform the inverse FFT on the resulting spectrum. You should notice no change in the waveform when you do this. Note however, that if you perform the inverse FFT twice in a row, the waveform will change. This is because the inverse FFT is performed in-place inside of the FFT object. So when you take the inverse the first time, the internal frequency spectrum is transformed into the waveform. Taking the inverse of *that* is the same thing as taking the forward FFT of the waveform, such is the nature of the FFT. What you wind up with in your buffer is the Real part of the frequency spectrum.
Press 'f' to take the forward FFT, and 'd' to take the inverse.
Source code: InverseFFT
Built with Processing