# What is the advantage of applying a Hamming window for MFCC calculations?

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.
fs=8000;
ts=1/fs;
N=1000;
t=(0:ts:(N-1)*ts);
x=sin(2*pi*60*t);

figure,subplot(221),plot(t,x,'.-'),title('Original Speech'),xlabel('Time');grid on
f=(-fs/2:fs/(N-1):fs/2);
subplot(223),plot(f,fftshift(abs(fft(x)))),title('Frequency Spectrum'),xlabel('Freq (Hz)');grid on
windowed=x.*hamming(length(x))';
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:-

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.

• Window is used to reduce side lobe. The idea is not to allow sudden jump at the ends of the signal. – Creator Sep 22 '15 at 21:23
• Zoom in closer to that frequency and show the magnitude in decibels to better see the difference. – Olli Niemitalo Sep 23 '15 at 8:57
• @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. – Mohit Sep 23 '15 at 9:40
• 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. – Celdor Sep 23 '15 at 14:15
• 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. – Celdor Sep 23 '15 at 14:23