Is it customary to correct for the gain of a window?

Consider how the Hanning window is defined:

0.5 - 0.5 * cos(n*2*Pi/(N-1))

By this definition, it has a gain of 0.5, which is simply the average value of the coefficients. By contrast, Flattop windows, as defined, have unity gain, presumably by design.

It would seem appropriate to scale the Hanning window by a factor of 2, but I have never seen this discussed anywhere. It would seem that all windows should be scaled for unity gain.

In practice, are windows typically corrected for their gain? If not, why not?

EDIT:

Since nobody has given an answer, I'll elaborate a bit.

It is quite easy to find papers that report the gain of the more common windows. But nowhere have I seen anyone refer to correcting the gain before using it for spectral analysis. Maybe I have always missed that statement, or everyone assumes gain correction to be an obvious requirement.

It seems like common sense to set the gain of a window to unity so that signal's energy level is preserved. Furthermore, how can one compare the various windows for amplitude accuracy if one has 0 dB gain, as a flattop does, and the other has nearly 10 dB loss, as the Gauss does.

Windows are also widely used for FIR filter design. In this application, it should be clear that the signal to be windowed, a sinc pulse, has most of its energy in the center of the window. Consequently, the window does little to reduce the sinc pulse's total energy. Thus, when used for filter design, we don't want unity gain, but rather unity peak amplitude, as most windows have, except the flattops. Something other than unity peak amplitude would affect the gain of the resulting FIR filter.

• It depends on the application and how the window is to be applied (e.g. either via multiplication or convolution). Some common types of normalization are scaling to unity DC gain or to unit energy. – Jason R Sep 10 '14 at 17:15
• I was referring to applying via multiplication. – user5108_Dan Sep 10 '14 at 17:22
• Due to scalloping, the gain of the window is not constant at all frequencies, depending on the window. Therefore any scaling depends on the type of analysis one is doing. – hotpaw2 Sep 10 '14 at 21:38
• What do you call the gain of a window ?? – Yves Daoust Sep 9 '15 at 12:18
• The gain of a window, as I understand it, is the average value of the coefficients (i.e. Sum/N). Here are two papers that use this definition Fred Harris (see table 1 for a comparison of window gains) and Max Planck Inst (see their definition and use of S1). This definition seems clear enough if you simply look at the effect of applying a window to a pure sine wave. – user5108_Dan Sep 10 '15 at 0:31

Yes, it is customary to correct for the gain of a window, except for some cases I refer to later. (If you are interested only in the relative amplitude, of course you do not need to correct for the gain.)

Because the window reduces the gain of the original signal (time domain), the amplitude obtained through FFT need to be corrected. For example, if you use the Hanning window, you need to multiply all the amplitudes by 2 (the reciprocal of 0.5). As I understand it, most of the software packages for FFT automatically correct for the window used.

However, such correction is good only when all the frequencies of interest distribute throughout the time domain window. For example, suppose you have 1024 data with all signal levels of zero except for #512 point which has a value of 1 (impulse signal). Obviously, any windows do nothing to the data. So, if you correct the amplitudes for the window gain (multiply by 2), then you will end up with overestimation of the amplitude. If your 1024 data are all zero except for the very 1st point with a value of 1, then every point has a value of zero after windowing, and you lose the signal.

So, if you are dealing with random signals, with all the frequency components expected to lie almost evenly over the length of the signal, you need (or should) correct for the gain of the window you use.

• Thank you. This is what I thought should be the case, but had never seen it stated anywhere. – user5108_Dan Jun 8 '16 at 20:23

one way of "correcting the gain of a window" is to do that in the definition of the window. what would this mean? correcting the gain where? at which frequency? at DC? if you're correcting the gain, at DC, of a window, it means that all coefficients add to 1.

$$\sum\limits^{+\infty}_{n=-\infty} w[n] = 1$$

or

$$\int\limits^{+\infty}_{-\infty} w(t) \ dt = 1$$

• Are you saying the gain of a window is a function of frequency? I calc the gain a window as the sum of the coeff divided by N, the average. I want this to be 1, not the sum, as you have shown. Thus the gain correction factor for a Hanning is 2. When I use gain corrected windows with an fft, I get amplitude values that are correct. Which is to say; all the windows I test give the same amplitudes for each spectral component, and they all agree with a non-windowed fft. If I use windows with uncorrected gain, they all give different results and only the flattop gives the correct amplitude values. – user5108_Dan Sep 14 '14 at 13:13
• "Are you saying the gain of a window is a function of frequency?" well, only if $$W(f) = \int\limits_{-\infty}^{\infty} w(t) e^{-j 2 \pi f t} dt$$ is not constant with $f$ or if $$W\left(e^{j \omega}\right) = \sum\limits_{n=-\infty}^{\infty} w[n] e^{-j \omega n}$$ is not constant in $\omega$ . but if either of those change when frequency changes, then by definition, the gain of the window is a function of frequency. the gain correction for the Hann window might be $2$ because, without it, the gain at DC is $\frac{1}{2}$. – robert bristow-johnson Sep 15 '14 at 1:32
• The way I see it, the gain of the Hann window is 1/2 at all frequencies, not just DC. In other words, every spectral component in the fft is 6 dB lower than it ought to be. When I use a flattop window which has unity gain, every spectral component is at the correct level. I must be doing something completely wrong. – user5108_Dan Sep 15 '14 at 11:56
• dunno how you see it that way. how are you using your Hann window? at what places of your original signal are you applying the window and then what do you do with the windowed data? – robert bristow-johnson Sep 15 '14 at 20:34
• I create a multi tone signal, then window it like this, where N = 1024 sig(n) = 1 + sin(50*n*2*Pi/N) + sin(75*n*2*Pi/N) win(n) = 0.5 - 0.5*cos( n*2*Pi/(N-1) ) windowed_sig(n) = sig(n) * win(n) Then I take the fft of windowed_sig. The results look correct. Its just that the fft of windowed signals appear to be in error. The error is 6 dB for a Hann window, about 10 dB for a Gauss, and 0 dB for a flattop. – user5108_Dan Sep 16 '14 at 0:28

The half factor normalizes to unit amplitude.

• This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post. – jojek Sep 9 '15 at 10:22
• @jojek: there is no need for a longer explanation, this is an elementary question. – Yves Daoust Sep 9 '15 at 11:24
• I agree with Yves here: the question seems elementary. And this answer certainly indicates the fallacy of the questioner's statement By this definition, it has a gain of 0.5. – Peter K. Sep 9 '15 at 12:08
• @PeterK.: thanks for the support. After all, I was wrong to answer a meaningless question: the "gain" of a window isn't defined. – Yves Daoust Sep 9 '15 at 12:20
• @PeterK.: thanks, I'll do it myself, depending to what the OP answers to my request for clarification. – Yves Daoust Sep 9 '15 at 12:28