Login / Register  0 items | $0.00 NewWhat is KVR? Submit News Advertise

Barlett, Hamming, Hanning etc?

User avatar
aMUSEd
KVRAF
 
27817 posts since 14 Sep, 2002, from In teh net

Postby aMUSEd; Tue Jun 06, 2017 1:31 pm Barlett, Hamming, Hanning etc?

I keep seeing these different FFT options in some plugins - what do they actually mean and which is the best one to use?
MadBrain
KVRian
 
941 posts since 1 Dec, 2004

Postby MadBrain; Tue Jun 06, 2017 1:35 pm Re: Barlett, Hamming, Hanning etc?

https://en.wikipedia.org/wiki/Window_function
Personally, I like to use Blackman-Harris on my spectrograms.
quikquak
KVRist
 
263 posts since 6 Aug, 2005, from England

Postby quikquak; Tue Jun 06, 2017 1:46 pm Re: Barlett, Hamming, Hanning etc?

I use the 'Hann' window mostly.
User avatar
aMUSEd
KVRAF
 
27817 posts since 14 Sep, 2002, from In teh net

Postby aMUSEd; Tue Jun 06, 2017 1:48 pm Re: Barlett, Hamming, Hanning etc?

What's the difference between them? Still not clear what they are actually.
User avatar
aciddose
KVRAF
 
11221 posts since 7 Dec, 2004, from Vancouver, Canada

Postby aciddose; Tue Jun 06, 2017 2:16 pm Re: Barlett, Hamming, Hanning etc?

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. :hyper:

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.
http://xhip.net/synth/ Xhip Synthesizer v8 released 21 May 2017
User avatar
nonnaci
KVRist
 
190 posts since 7 Feb, 2017

Postby nonnaci; Tue Jun 06, 2017 2:21 pm Re: Barlett, Hamming, Hanning etc?

These are windows functions for short-time FFTs which will effect the shape of the side-lobes of the convolution kernel in freq. domain.
User avatar
aciddose
KVRAF
 
11221 posts since 7 Dec, 2004, from Vancouver, Canada

Postby aciddose; Tue Jun 06, 2017 2:40 pm Re: Barlett, Hamming, Hanning etc?

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.
http://xhip.net/synth/ Xhip Synthesizer v8 released 21 May 2017
camsr
KVRAF
 
6628 posts since 16 Feb, 2005

Postby camsr; Tue Jun 06, 2017 3:40 pm Re: Barlett, Hamming, Hanning etc?

The SSE implementations from intel were said to have some error as well.
Image
User avatar
aciddose
KVRAF
 
11221 posts since 7 Dec, 2004, from Vancouver, Canada

Postby aciddose; Tue Jun 06, 2017 4:35 pm Re: Barlett, Hamming, Hanning etc?

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.
http://xhip.net/synth/ Xhip Synthesizer v8 released 21 May 2017
quikquak
KVRist
 
263 posts since 6 Aug, 2005, from England

Postby quikquak; Wed Jun 07, 2017 7:28 am Re: Barlett, Hamming, Hanning etc?

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
 
1251 posts since 26 Apr, 2004, from UK

Postby Miles1981; Wed Jun 07, 2017 8:22 am Re: Barlett, Hamming, Hanning etc?

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
 
6628 posts since 16 Feb, 2005

Postby camsr; Wed Jun 07, 2017 1:43 pm Re: Barlett, Hamming, Hanning etc?

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/
Image
User avatar
Christian Schüler
KVRist
 
245 posts since 23 Nov, 2004, from Hamburg, Germany

Postby Christian Schüler; Thu Jun 08, 2017 8:41 am Re: Barlett, Hamming, Hanning etc?

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)

Return to DSP and Plug-in Development