1
$\begingroup$

I just studied an implementation (Matlab) of a windowed FFT and saw the following line of code:

w = sqrt(hann(fft_length, 'periodic'))

and later:

spectogram(:, column) = fft(ringbuffer.*w, fft_length) %why .*w ? 

The ringbuffer obviously contains the current frame of the signal and the overlap so its's obvious to me that this needs to be multiplied with the Hanning Window but why is the square-root being taken first?

$\endgroup$
1
  • 1
    $\begingroup$ i don't know anything about the specific functions, but it has the general smell of a power-vs-amplitude question, with signal power varying with the square of the signal amplitude. $\endgroup$ Apr 19, 2018 at 17:14

1 Answer 1

4
$\begingroup$

The purists will tell you it should be called a Hann window, or VonHann, but not Hanning.

From a math perspective, the Hann window is also equivalent to a sine squared window at half the frequency, so by taking the square root you are getting a sine window.

Why use a window at all? The seminal paper on the topic is:

harris, fred. (Jan 1978). "On the use of Windows for Harmonic Analysis with the Discrete Fourier Transform"

A link to the paper can be found in reference [10] of the Wikipedia article on windows.

Hope this helps.

Ced

$\endgroup$
3
  • $\begingroup$ Thanks, that actually helped a lot. I was unaware of the fact that there are more windows with a name that starts with Ha..something.. Now that you pointed out that fact I found lots of research on the topic $\endgroup$
    – Alon
    Apr 19, 2018 at 12:18
  • $\begingroup$ It's either Hamming (MM) or Hann (NN). Hanning mixes the two, making it ambiguous which of the two was meant. $\endgroup$
    – MSalters
    Apr 19, 2018 at 14:33
  • $\begingroup$ @MSalters, I was trying to point that out to the OP without being overbearing. The use of the term "Hanning" is quite prevalent for it being incorrect, so the OP can certainly be forgiven. The Hann window is my preference for spectrogram usage. For numerical analysis of DFT results, I believe that no window should be used at all. Applying a window complicates the underlying math. See my blog (dsprelated.com/blogs-1/nf/Cedron_Dawg.php) for novel exact equations concerning pure tones in a DFT. P.S. fred harris likes his name in lower case. $\endgroup$ Apr 19, 2018 at 15:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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