## Barlett, Hamming, Hanning etc?

aMUSEd
KVRAF

29289 posts since 14 Sep, 2002, from In teh net
I keep seeing these different FFT options in some plugins - what do they actually mean and which is the best one to use?
KVRian

944 posts since 1 Dec, 2004
https://en.wikipedia.org/wiki/Window_function
Personally, I like to use Blackman-Harris on my spectrograms.
quikquak
KVRist

351 posts since 6 Aug, 2005, from England
I use the 'Hann' window mostly.
aMUSEd
KVRAF

29289 posts since 14 Sep, 2002, from In teh net
What's the difference between them? Still not clear what they are actually.
aciddose
KVRAF

11842 posts since 7 Dec, 2004
They're different shapes. The Fourier transform only works on a continuous signal. That means something like a sine wave going to infinity in negative and positive directions, or at least to the ends of the blackboard.

Since we're using finite data that is discontinuous it means we need to apply some type of amplitude modulation such that a repeating version of our window of signal won't contain sudden discontinuities which introduce additional harmonic content not present in the signal we're interested in.

Hann is a simple "raised cosine" window. It is the most simple window with good properties possible. Others are Bartlett ("triangular") or a plain "no window" ("rectangular").

Other windows use other methods. For example Gaussian is a Gauss function with special properties. Sinc is another example of a type with special properties. Welch is a parabola. Additional examples are windows such as Dolph-Chebyshev (the "perfect" window) and Kaiser which approximates it.

Additional windows such as "flat top" windows are variations of summed raised cosine windows like Blackman or Nuttal and Sinc which are designed to create specific harmonics resulting in a wide "flat top" to each partial in the source signal. This makes it easier to find and measure these discrete harmonics.

Here is a tool set up to examine various windows. There are countless possible windows and this tool only includes a small subset of those available.

http://xhip.net/temp/xcope.7z

xcope.png

Configure it like so and you can compare the spectrum of different windows.
You do not have the required permissions to view the files attached to this post.
Free plug-ins for Windows, MacOS and Linux. Xhip Synthesizer v8.0 and Xhip Effects Bundle v6.7.
nonnaci
KVRist

245 posts since 7 Feb, 2017
These are windows functions for short-time FFTs which will effect the shape of the side-lobes of the convolution kernel in freq. domain.
aciddose
KVRAF

11842 posts since 7 Dec, 2004
Although you'll mostly just find it confusing: https://en.wikipedia.org/wiki/Window_function

I think my tool should help, look at the basic shapes and spectra by flipping the fourier switch and decades switch.

The decade/log option isn't perfect as ideally it should use a Gaussian kernel to filter the result (those special properties I mentioned) to get the best and most accurate display. Unfortunately I use a simple spline instead since it gets good enough results below 1/4; which is generally what we care about when using a log frequency display.

To get accurate results though you'll want to view the data with a linear x axis.

Note that using the additive waveforms (I've switched on ramp and sine only) you get perfect results from the Fourier transform without using a window! This is because the additive waveforms are genuinely continuous summations of sine functions and so contain zero discontinuities.

Using the mouse-wheel is highly recommended to get integer steps. If you set the frequency ("cycles") or other options to a fractional value the resulting waveform won't line up continuously at the edges of the fixed sampling window.

While it does though you might be interested to note the harmonics of the c-library sin() function at near -200 dB.
Free plug-ins for Windows, MacOS and Linux. Xhip Synthesizer v8.0 and Xhip Effects Bundle v6.7.
camsr
KVRAF

6820 posts since 16 Feb, 2005
The SSE implementations from intel were said to have some error as well.
aciddose
KVRAF

11842 posts since 7 Dec, 2004
Of course since any sin() is merely an approximation. -160~ dB is more than enough for general purpose (even -40 dB is better than typically needed: see squared parabolic sin approximation) and in instances where high precision is needed a better approximation must be used.

Lots of very simple things like this are often unknown to those who don't specialize in the field.
Free plug-ins for Windows, MacOS and Linux. Xhip Synthesizer v8.0 and Xhip Effects Bundle v6.7.
quikquak
KVRist

351 posts since 6 Aug, 2005, from England
camsr wrote:The SSE implementations from intel were said to have some error as well.

Really? How can they get that wrong. Is it a wrapping error, which is often -1 too short?
Miles1981
KVRian

1335 posts since 26 Apr, 2004, from UK
nonnaci wrote:These are windows functions for short-time FFTs which will effect the shape of the side-lobes of the convolution kernel in freq. domain.

They are used in FTs, not only short-time FFT, because you consider the signal as infinite and duplicating. So at the boundary, you get a jump that is not physical -> windowing solves that issue.
camsr
KVRAF

6820 posts since 16 Feb, 2005
quikquak wrote:
camsr wrote:The SSE implementations from intel were said to have some error as well.

Really? How can they get that wrong. Is it a wrapping error, which is often -1 too short?

Here's the article I read: https://randomascii.wordpress.com/2014/ ... intillion/
Christian Schüler
KVRist

245 posts since 23 Nov, 2004, from Hamburg, Germany
Sin() and Cos() are not meant to be used that way. The error of these functions wrt. to its argument should not be measured as a relative error, but as an absolute error. This is because sin and cos are special cases of exp, and convert from the log-polar domain to the cartesian domain. So a *relative error* in the cartesian domain becomes an *absolute error* in the log-polar domain. This is how these functions are designed. When you use sin/cos to plot a circle, the error at each point towards a true circle should bounded by 1 ulp.

It is totally besides the point to hammer on the 'missing accuracy' of fsin/fcos in terms of their relative error.

The only exception here is the special case that sin(x) = x for small x, which is trivially taken care of when the sin() polynomial contains x as a factor.

Moderator: Moderators (Main)