GestureSynth.me

Music calculator

Window Function Calculator

Generate Hann, Hamming, Blackman or rectangular window coefficients with symmetric or periodic sampling and inspect their coherent gain.

window function calculator

Window Function Calculator guide

Window coefficients weight time samples before spectral analysis or apply a taper while designing a finite filter. Choose the number of coefficients, the family and the sampling convention. Read the table in index order beginning at zero. Its mean is the coherent gain, a useful reference for an on-bin sinusoid.

Play the instrument ↑
Default result
8 window coefficients

Calculation and units

Write the angle as two pi times the sample index divided by the chosen denominator. A symmetric window uses N minus one; a periodic window uses N. Hann uses one half minus one half cosine, Hamming uses 0.54 minus 0.46 cosine, and Blackman uses 0.42 minus 0.5 cosine plus 0.08 cosine of twice the angle. Rectangular weights are all unity.

Worked examples

Select a named case in the Worked example control to load these values. You can then edit any input to compare the result.

Symmetric Hann taper

Window length = 8 · Window family = Hann · Sampling convention = Symmetric.

8 window coefficients. First 0, last 0. Coherent gain (mean coefficient) 0.4375. Coefficients are unscaled. Table readings (Sample index, Window coefficient): 0, 0; 1, 0.1882551; 2, 0.6112605; 3, 0.9504844; 4, 0.9504844; 5, 0.6112605; 6, 0.1882551; 7, 0.

For an even length there is no sample exactly at the center. The two central coefficients have equal height and the endpoints meet zero.

Periodic Hann taper

Window length = 8 · Window family = Hann · Sampling convention = Periodic.

8 window coefficients. First 0, last 0.1464466. Coherent gain (mean coefficient) 0.5. Coefficients are unscaled. Table readings (Sample index, Window coefficient): 0, 0; 1, 0.1464466; 2, 0.5; 3, 0.8535534; 4, 1; 5, 0.8535534; 6, 0.5; 7, 0.1464466.

Keeping the same family and sample count changes the denominator. The right endpoint is omitted so the list can tile an FFT interval.

Symmetric Hamming taper

Window length = 8 · Window family = Hamming · Sampling convention = Symmetric.

8 window coefficients. First 0.08, last 0.08. Coherent gain (mean coefficient) 0.4825. Coefficients are unscaled. Table readings (Sample index, Window coefficient): 0, 0.08; 1, 0.2531947; 2, 0.6423596; 3, 0.9544457; 4, 0.9544457; 5, 0.6423596; 6, 0.2531947; 7, 0.08.

The endpoints remain above zero by design. Check those values before interpreting an edge discontinuity as a calculation error.

Three term Blackman

Window length = 9 · Window family = Blackman · Sampling convention = Symmetric.

9 window coefficients. First 0, last 0. Coherent gain (mean coefficient) 0.3733333. Coefficients are unscaled. Table readings (Sample index, Window coefficient): 0, 0; 1, 0.0664466; 2, 0.34; 3, 0.7735534; 4, 1; 5, 0.7735534; 6, 0.34; 7, 0.0664466; 8, 0.

An odd length includes a true center sample. Roundoff at a theoretical zero can appear as a tiny signed floating point value.

Rectangular weights

Window length = 5 · Window family = Rectangular · Sampling convention = Symmetric.

5 window coefficients. First 1, last 1. Coherent gain (mean coefficient) 1. Coefficients are unscaled. Table readings (Sample index, Window coefficient): 0, 1; 1, 1; 2, 1; 3, 1; 4, 1.

All five weights are one. A tone multiplication by this window leaves each input sample unchanged and the coherent gain is unity.

Minimal Hann example

Window length = 3 · Window family = Hann · Sampling convention = Symmetric.

3 window coefficients. First 0, last 0. Coherent gain (mean coefficient) 0.3333333. Coefficients are unscaled. Table readings (Sample index, Window coefficient): 0, 0; 1, 1; 2, 0.

Only the center coefficient survives in this deliberately short symmetric window. The small mean gain illustrates the effect of tapering at very short lengths.

Interpreting the result

Use symmetric weights when matching an end-to-end symmetric finite impulse response design. Compare periodic weights when preparing a fixed FFT frame. To apply the sequence, multiply each input sample by its corresponding coefficient before transforming it. Keep the gain correction separate from the coefficient generation so that a later power estimate can use the proper normalization.

Measurement and model limits

Coherent gain is the arithmetic mean of the weights. It describes coherent amplitude loss under suitable bin alignment and scaling, while noise power depends on squared weights. The table does not estimate sidelobe peaks or equivalent noise bandwidth. Very short tapers may differ substantially from their familiar long-window shape, especially around the center and endpoints.

Answers before you play

Common questions

Why is the last periodic coefficient different?

The point that would match the first sample belongs to the next period. Omitting this duplicated endpoint keeps the requested number of samples in the interval.

Why are there two largest coefficients?

An even-length symmetric window is centered halfway between samples. Both neighboring samples have the same weight at equal distances from that center.

Will a rectangular window remove leakage?

A rectangular window preserves time samples. Noninteger cycles in the frame generally still cause leakage across frequency bins.

Is the maximum always exactly one?

The continuous family may reach unity between sample positions. These discrete coefficients are emitted without an additional peak normalization.