# Windowing and FFTs

Remember that the Fourier Transform was meant to be used with periodic functions. Most of the time, when we pick a chunk of signal to analyze it's not periodic, and this results in spectral "leakage."

I took nf's guitar sample and cut out a 65536-sample chunk. Here's what the beginning of that chunk looked like:

This "leakage" can be reduced (at the cost of peak resolution) by "windowing" the non-periodic waveform to make it look a little more periodic. Windowing means multiplying the signal we have by a tapering function (sometimes called an apodization function). Different windows give different frequency responses.

Here are some of the more common windows, and the frequency responses they give:

## Rectangle

When no window is being used, we can say we're using the "rectangle window."

## Hann

Named after the Austrian meteorologist Julius von Hann. Some people call it the "Hanning" window, to help confuse it with the "Hamming" window. If you think back to your trigonometric identities, you'll find that an alternative representation of the cosine-squared Hann looks a lot like the formula for the Hamming window, although they are different.

## Gaussian

Remember how derivatives and integrals of natural exponents (ex) stay natural exponents? The Fourier Transform of a Gaussian function is still a Gaussian funcion.

## Bartlett

Sometimes known as the "triangle" window.

## Code

As always: window.c

Graphs drawn by gnuplot.
Math rendered by MiKTeX.

If you spot any mathematical inaccuracies, please let me know.