I am working on a very simple voice recognition system using the msp430. In my research I've read that for real life audio signals its necessary to apply a window to the FFT data because the audio signals won't be periodic. In my code, I've applied the hamming window and plotted it against the non-windowed FFT spectrum. It appears that the hamming attenuates the signal in the lower valued N data points.

enter image description here

I think this makes sense based upon the equation of the hamming window, but why would I want this attenuate for my signal? It seems that identifying the spectral characteristics would be more difficult after the window. Any thoughts?

  • $\begingroup$ Welcome to DSP.SE! The attenuation in your graph looks much more pronounced than I would expect when applying any window. $\endgroup$ – Peter K. Nov 25 '15 at 1:21
  • $\begingroup$ As it was mentioned many times on this forum. It is because in case of DFT you must divide results by sum of of window samples. In case of rectangular window it is obviously equal to $N$ but in case of Hamming window it is something like $0.5364 N$, where $0.5364$ is the so-called Coherent Gain. I suggest you to read at least this document. Also if you could post your code that would help. I have a feeling that there is bug somewhere. Plot is not exactly what I expect it to be... $\endgroup$ – jojek Nov 25 '15 at 8:44
  • 1
    $\begingroup$ His DFT is length 256 and plot is to 100, if you look, the difference is almost nothing at 100. (I would assume no difference around 127-128) the window was applied after the transform, I'm sure. $\endgroup$ – johnnymopo Nov 25 '15 at 15:35
  • $\begingroup$ Yes I did window after taking the fft, I thought that was the correct procedure? The graph only shows up to 100 simply because I didn't grab all 256 data points for the example. $\endgroup$ – Mtk59 Nov 25 '15 at 16:21
  • $\begingroup$ No, as the others have pointed out the procedure is: X = FFT( WINDOW .* SIGNAL ). $\endgroup$ – Peter K. Nov 25 '15 at 16:25

You can figure the change in energy applied to your signal by analyzing the energy in your window. The Hamming window's energy (or scaling) is well known and Google will tell you what it is. You are doing something different. Can you post your code for further help?

From your code, ans your image, it really appears that you applied the window to your transformed data. The window (in this case) is applied to the time data before the transform. The window will reduce sidelobes from strong frequency components. Take note that taper windows cause the so-called "spectral leakage" where energy leaks into other frequency bins

  • $\begingroup$ Sure. for (i = 0; i < 255; i++) { double multiplier = 0.54 - .46*cos(2*PI*i/255); winFFT[i] = multiplier * FFT_data[i]; } $\endgroup$ – Micah Nov 25 '15 at 8:24
  • 1
    $\begingroup$ that looks like you are applying the window to the spectral information? Your plot shows 0-100 and your FFT is 256 and it looks like the ratio near 100 is unity. It really looks like you are windowing after the FFT. You need to window the time-domain stuff before computing the DFT $\endgroup$ – johnnymopo Nov 25 '15 at 8:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.