# Windowing
The most common way to remedy the problem of spectral leakage is to apply a *window* to the input data before calculating the DFT. *Windowing* can reduce spectral leakage by attenuating the sidelobes of the DFT"s sinc response. A window is simply a mask that truncates and scales the input data across the window. The rectangular window is the simplist form of a window. This is what the truncated sinusoid example in the [spectral leakage notebook](spectral_leakage.ipynb) used to truncate the input data before applying the DFT. The rectangular window only applies a mask to the data, but it does not apply any scaling. In order to reduce spectral leakage, the window must force the amplitude of the endpoints of an input signal towards a common amplitude. The example below illustrates a variety of window functions.
## Using Windowing to Detect Small Signals
Windowing is particularly important when we are trying to detect a low level signal in the presence of a near by high level signal. The example below demonstrates the effects that a Hanning window has when taking the 64 point DFT of an input buffer that contains a strong signal with 3.4 cycles per input buffer and a weak signal with 7 cycles per input buffer.