Keyboard Commands
Window Functions
|
Interval adjustment
Waveform
Frequency adjustment
|
This program demonstrates the use of window functions to dampen spectral leakage in FFT bins.
The first waveform is a repetitive sine wave signal, the second waveform is what the FFT perceives the signal to be, and the third waveform is what the FFT perceives the signal to be after the windowing function has been applied. In the first waveform the Red lines indicate the measured signal interval, this interval can be phase shifted left or right, or size extended or contracted. The final Result is indicated with the yellow line which is the FFT output. Note: increasing the interval length has the side effect of increasing FFT output interpolation resolution (the yellow line will expand horizontally). The height of the blue vertical lines in the second waveform represent the sharpness of the discontinuity. Discontinuities introduce spectral leakage into the final FFT output.
Harmonics are not to be confused with leakage, they are real frequencies cast off by the various waveforms. A sine wave has no harmonics, while a square wave has a great deal of harmonic energy. Waveforms are made up of sinusoids, a square wave is actually many, many additive sine waves at higher and higher octaves. The FFT will show these harmonics at octave intervals from the fundamental frequency.
Try this: Keep the interval start position at 0, keep the interval size at 256 samples, and decrease the frequency to 690 Hz (Press D), and select the Rectangular Window (Press 0) Notice how there is no spectral leakage in the final FFT output without windowing applied (Rectangular Window is analogous to using no window at all). Now try adjusting the frequency slightly to see how even a small discontinuity will add a lot of leakage.
Source code: leakage
Built with Processing