I am trying to implement MFCC by following this and I found that there is a step in which signals are divided into frames and then passed on to Hamming windowing process. The reason given there is to correct the discontinuity at the start and last samples of the frame. OK that sounds good, then the output of the window is fed for FFT process. So I thought of doing this sample code separately.

My code:-

%Creating a signal to perform hamming windowing on.

figure,subplot(221),plot(t,x,'.-'),title('Original Speech'),xlabel('Time');grid on
subplot(223),plot(f,fftshift(abs(fft(x)))),title('Frequency Spectrum'),xlabel('Freq (Hz)');grid on
subplot(222),plot(t,windowed,'.-'),title('Hamming Window Applied'),xlabel('Time');grid on
subplot(224),plot(f,fftshift(abs(fft(windowed)))),title('Frequency Spectrum After Hamming'),xlabel('Freq (Hz)');grid on 

The plot generated is:-

enter image description here

My Problem is:-

What is the advantage of Hamming Windowing. I am a noob, so according to me, firstly we are loosing the amplitude at the staring and ending of the signal in the time domain and secondly, in the frequency domain, there is very little difference. So what is the advantage of doing all this much computation. Please explain with as much detail as possible.

And it would be nice if someone could point out to more detailed (according to them) tutorial then what I am referencing or what they read while learning MFCC themselves.

  • 1
    $\begingroup$ Window is used to reduce side lobe. The idea is not to allow sudden jump at the ends of the signal. $\endgroup$
    – Creator
    Sep 22 '15 at 21:23
  • $\begingroup$ Zoom in closer to that frequency and show the magnitude in decibels to better see the difference. $\endgroup$ Sep 23 '15 at 8:57
  • $\begingroup$ @olli the difference that I see is that in fft of original wave, the two spikes are connected at the bottom whereas in the fft of windowed signal there is a small lobe between the two spikes....does that states something? Please explain. $\endgroup$
    – Mohit
    Sep 23 '15 at 9:40
  • $\begingroup$ IF you don't apply any window, you actually apply square window. If you transform square window into frequency you will get main lob with additional side lobes, in most caseses something we don't want because it contaminates signal. If you apply hamming window, the side lobes are reduced. However, there is traide off, depending on the window, and considering the same width of each windows, you increase the width of the main lobe. There are windows such as Kaiser which take an extra parameter. The parameter let you control, side lobes aplitude over main lobe width in cost of one another. $\endgroup$
    – Celdor
    Sep 23 '15 at 14:15
  • 1
    $\begingroup$ There is difference in frequency. The difference is that, your frequency will have additional components caused by sinc function which is a transform of a square window in time domain. This sinc function is convolved with a frequency signal which intriduces additional lobes. You cannot avoid this effect but you can reduce its influence by applying different windows. $\endgroup$
    – Celdor
    Sep 23 '15 at 14:23

Ideally you would only see that frequency as a narrow peak but because of the finite-length window you also get that other artificial crud: Windowing equals time domain multiplication by the window function (here rectangular or Hamming). Time domain multiplication equals frequency domain convolution: All frequencies will be replaced by the Fourier transform of the window function. This is what those look like:

Rectangular window and its Fourier transform Hamming window and its Fourier transform

The convolution spreads the true frequency to frequency bins around it. By using a window function other than the rectangular one there is less of the sidelobes compared to the main lobe, so less artificial long-distance spread making the result cleaner and better suited for frequency-selective analysis. You seem to have by accident chosen a frequency where you don't see the sidelobes with the rectangular window because the dips between the sidelobes land between your frequency bins. So you just see slopes.

  • $\begingroup$ But as the hamming window reduces the amplitude of both sides, the fft will be more focused on the middle part of time domain i.e. frequencies in the middle of the signal will have more preference. Correct me if I am wrong. $\endgroup$
    – Mohit
    Sep 23 '15 at 10:20
  • $\begingroup$ That is correct. But using overlap (one window beginning at the middle of the previous one) you can cover everything equally. $\endgroup$ Sep 23 '15 at 10: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.