1. Home
  2. Signal processing

Signal processing · window functions

Blackman Window: Formula and Properties

Eigenfield editorial team ·

The Blackman window is a smooth taper applied to a block of samples before a Fourier transform or when truncating a filter. Its formula is a sum of a constant and two cosines, with the classic coefficients 0.42, 0.5 and 0.08. Compared with simpler windows it gives much lower sidelobes, so weak spectral components next to strong ones are not buried under leakage from the strong one, and the cost is a broader peak for each sinusoid. Windows of this kind are standard equipment in signal processing.

The formula

For a window of N points numbered n = 0 to N − 1,

w(n) = 0.42 − 0.5 cos(2πn/(N − 1)) + 0.08 cos(4πn/(N − 1))

At the ends, n = 0 and n = N − 1, both cosines equal 1 and the value is 0.42 − 0.5 + 0.08 = 0. At the center the first cosine is −1 and the second is +1, so w = 0.42 + 0.5 + 0.08 = 1. The window rises from 0 to 1 and falls back to 0, symmetrically.

Worked values

For N = 5 the angle step is 2π/4 = π/2, and the entries are:

  • n = 0: 0.42 − 0.5·cos 0 + 0.08·cos 0 = 0
  • n = 1: cos(π/2) = 0 and cos π = −1, so 0.42 − 0 − 0.08 = 0.34
  • n = 2: cos π = −1 and cos 2π = 1, so 0.42 + 0.5 + 0.08 = 1
  • n = 3 and n = 4 mirror n = 1 and n = 0

The window is [0, 0.34, 1, 0.34, 0]. With N = 7 the step is 2π/6 = π/3, and the values come out as 0, 0.13, 0.63, 1, 0.63, 0.13, 0. Check n = 1: cos(π/3) = 0.5 and cos(2π/3) = −0.5, so 0.42 − 0.25 − 0.04 = 0.13. For n = 2: cos(2π/3) = −0.5 and cos(4π/3) = −0.5, so 0.42 + 0.25 − 0.04 = 0.63.

Notice the zeros at both ends. Some libraries generate the periodic form, with N instead of N − 1 in the denominator, for spectral analysis, and the symmetric form above for filter design. The two differ slightly, and mixing them up is a frequent source of mismatched results between programs.

What the window buys

The coefficients are chosen so the sum of the three cosine terms nearly cancels the first sidelobes of the rectangular window’s spectrum. The peak sidelobe of the Blackman window is about −58 dB relative to the main lobe. For comparison, the rectangular window has about −13 dB, the Hann window about −31 dB and the Hamming window about −43 dB.

The main lobe pays for it. Measured null to null, the rectangular window’s lobe is 2 bins wide, Hann and Hamming 4, and Blackman 6. Two sinusoids closer than roughly 3 bins cannot be told apart in a Blackman-windowed spectrum, while a rectangular window might still separate them but then smears each across all the other frequencies.

A rule of thumb for decibels may help: the ratio −58 dB corresponds to an amplitude factor of 10−58/20 ≈ 0.0013, so leakage is about 1/800 of the main peak. How that conversion works is on the decibels page.

When to choose it

Pick Blackman when the signal has a large dynamic range: a strong tone with weak ones nearby or far away, or any measurement where far-off leakage matters more than frequency resolution. Choose a narrower window, rectangular or Hann, when two tones are close and similar in level.

For finite impulse response filters the same shape tapers the truncated sinc function, giving a stopband attenuation near 74 dB at the cost of a wide transition band. An alternative with a tunable trade-off is the Gaussian window.

Pseudocode

function blackman(N):
    for n in 0 .. N-1:
        a = 2*pi*n/(N-1)
        w[n] = 0.42 - 0.5*cos(a) + 0.08*cos(2*a)
    return w

Applying it is an entry-by-entry product with the data block, taken before the transform is computed. Remember to divide spectrum amplitudes by the window’s mean value, 0.42, if absolute tone heights are wanted, since the taper lowers the overall level.

Back to top