flatTop windowingFunction not affected by normalize bool

When using fillWindowingTables and multiplyWithWindowingTable, the normalize bool affects all windows except the flatTop one. Is there a particular reason for this?

I also have two others remarks.
After struggling with the windowing functions and their doc (https://docs.juce.com/master/structdsp_1_1WindowingFunction.html), I found out that these remarks were discussed on another thread (WindowingFunction class query) dating back to November 2017.

  1. When normalize=true, the window values vary above 1 but when normalize=false the window values are “normalized” to a maximum value of 1. Am I wrong, of should this behavior be inverted?
  2. The beta parameter is only useful for the kaiser window, but this is not indicated in the doc yet.

Hello !

  • the Flat-Top method results are not modified by the normalisation boolean because the definition of the method itself make it normalised from the start
  • the definition I use in this context for normalisation isn’t that the coefficients shouldn’t be higher than 1 in absolute value, but that DC amplitude response should be 1, which is different, hence the confusion. I think it’s more useful this way, but nothing prevents you from doing anything else to the signal using the static function to fill a buffer, and the AudioBuffer::getMagnitude function to get the maximum absolute value.
  • you’re right anyway the documentation, I have just improved it so everything will be clear now

Thanks for the report !

1 Like


Thank you for your answers.

I succeed to have a maximum-normalized window with the following:

std::vector<float> buffer(1024);
window.fillWindowingTables(buffer.data(), buffer.size(), winName.second, normalize, beta);
float const maxVal = *std::max_element(buffer.begin(), buffer.end());
std::transform(buffer.cbegin(), buffer.cend(), buffer.begin(), [maxVal](auto value) { return value / maxVal; });

I first thought that the normalize boolean was specifying a maximum-normalization and not a DC-amplitude-normalization, hence my confusion.

Could you give me examples when a DC amplitude response of 1 is desired?

Could you give me the link to the updated doc, as I did not found updates on https://docs.juce.com/master/structdsp_1_1WindowingFunction.html, nor in the code https://github.com/WeAreROLI/JUCE/blob/master/modules/juce_dsp/frequency/juce_Windowing.cpp

Thank you,

Hello !

The DC amplitude response being 1 is something that generally just works to prevent any change of noticeable volume after the convolution / multiplication with the window

About the new documentation, it will be soon available on the develop branch

1 Like

Thank you for the informative details. I’ll dig more into this concepts.

1 Like

Here are some documentation updates, courtesy of Ivan:

1 Like

Thanks to all the Juce team!

1 Like