Fourier transform works on repetitive signals. (google "wiki FFT"). In theory these signals repeat until eternity. If you take a snapshot of these signals (i.e. 10 sine waves) the beginning and the end of the 10 sine waves represent a distortion of the "eternal signal", they are distortions.
To minimize the disruption effect of the beginning and end of the snapshot, each sample in the snapshot is "weighted". It's contribution to the Fourier Transform is made more -or less- important. The "weighting" is called "windowing".
There are many types of windows. There is a rectangular window (meaning all samples have the same weight), there is triangular weighting (the first and last samples have zero weight, the centre samples have maximum weight. Samples in between have a weight that is a linear interpolation between first and centre sample. If you execute the program in my post, and press "w" a few times, you see a number of windowing techniques, and the effect on waveform and FFT.
One of the weighting standards is the "Hann Window". This is similar to the triangular windowing, but samples between first and centre are weighted with a sine^2 function.
Play with the program, and experience.
Vohout
note: the FFT window shows linear magnitude FFT for demonstration purpose (the lin2log function is commented out). Edited 2022-03-03 20:24 by Volhout