I am in the process of trying to understand FFT analysis as it pertains to audio, and I have come across the concept of FFT windowing. Am I understanding it correctly that the main use of FFT windowing is to get better results in the frequency domain (ex. minimizing Gibbs Phenomenon) ?
It seems that one of the most common window functions used is the Hamming window. If I want to use the Hamming window do I just apply and upward slope from the first sample in my data chunk to the center sample and a downward slope from the center sample to the last sample? (This is what the graph in front of me shows) Or is there an explicit mathematical method I am not aware of?
Edit: Is the Hamming window good for complex signals too? (the example I read about had only one frequency involved)
http://www.cg.tuwien.ac.at/studentwork/CES...ussl/node9.html (http://www.cg.tuwien.ac.at/studentwork/CESCG99/TTheussl/node9.html) for info on the Hamming window.
FFT windowing is required to minimize bin "bleed" or "leakage" that occurs in frequency components that are not related to the sampling rate and fall outside the nearest FFT frequency bin. This naturally occurs in all normal audio. An example of where windowing is not required is a test tone that would be used to measure distortion in a conversion process, where the test tone is related to the sampling rate and falls into one of the FFT's frequency bins.
Your windowing example would be "triangular" windowing (assuming a constant slope).
Try this link...
Thanks for the link, but I must say, I don't really understand what a "frequency bin" is, or any other sort of "bin" in audio. What do you mean by "bin" and "leakage"?
I will read the link and try to get it from there.
Let me express the windowing issue in different terms.
Windowing is needed i.e. in generating lowpass filters. In frequency domain a "lowpass filter kernel" is basically a bunch of scale factors. In frequency domain, such signal has values of 1 in the passband and 0 in the stopband. So it looks something like this:
Mathematically a perfect lowpass filter kernel can be obtained by the sinc function (sin x / x) but the problem is that in time-domain, the sinc function continues to positive and negative infinity, asymptotically approaching zero. But in real world, signals always must have finite size, and just plain cutting the signal edges away (=truncating) could distort the signal noticably.
This is where window functions step in. The purpose of the windowing functions is to make that truncation smoother. A windowing function usually looks like a downward-open parabel or a triangle (like the letter A). Basically the windowing function yields again a bunch of scale factors. The filter kernel (this could be i.e. 1024 points) are multiplied with the points generated by the window function, thus lowering the signal amplitude at the "edges" of the signal. This process hopefully makes the lowpass filter kernel more accurate. At least more accurate than just truncating the signal.
However, all of the windowing functions do add some distortion to the signal (remember, in ideal world we don't need windowing) and it depends on the situation which window function is the "best". Some common windowing functions are triangle, Hanning, Hamming and Blackman. The Hamming window you mentioned is a good all-round window function, but the others may be more suitable for a given situation.
This following chapter of a freely downloadable DSP book will explain the whole thing in detail, yet comprehensibly:
Added a phrase "in time domain".
Now you already have two applications of windowing
But FFT frequency analysis relies heavily on lowpass, highpass and bandpass filters.
A frequency bin is simply an FFT output value which represents a specific frequency. If you perform, for instance, a 16-point FFT, you're computing 8 frequency components equally spaced between DC and Nyquist (Fs/2). You now have an 8-frequency spectrum analysis of the signal. Frequencies in the source data that fall outside the 8 frequency bins or slots bleed onto adjacent bins. In order to reduce the bleeding and improve resolution, windowing of the source data is used.