WindowingFunction class query

I’ve been using this class with the FFT and noticed the output wasn’t scaled correctly. I’m using a Hann window but I noticed that the generated window is between 0 - 2.0 rather than 0 - 1.0. Looking at the code, it seems this is due to the normalisation code. My window is getting multipled by a factor of 2. This is enabled by default. Is this the expected behavior?

Hello !

In the WindowingFunction class, all the functions have as an argument an option to either enable or disable the normalization of the generated window. So you can just use the value that suits your specific application, right ?

Right, that’s what I’ve done now. I guess what I’m asking is if that should be the default behaviour, to normalise the window. If I use the following constructor, I’d expect it to produce a window in the normal range (0.0-1.0)

WindowingFunction(1024, WindowingFunction::hann);

But that’s not what’s returned. I have to use

WindowingFunction(1024, WindowingFunction::hann, false, 0.f);

If nobody else has a problem with it then I guess it’s just me but it wasn’t immediately obvious to me why the window wasn’t generated as expected, I had to look at the source. I think adding a couple more constructors for the sake of the user wouldn’t be a bad idea. The docs also don’t mention the normalisation or what the beta argument does either.

Anyway, the class is working for me as expected outside of those issues thanks!

I might add some extra information in the documentation, thanks for the report :wink:

About the beta parameter, it is specific to the Kaiser windowing method.

Hi, you are not alone, I think they accidentally made it wrong, the normalization is inverted per its behavior.

1 Like