Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windowing / Weighing Factor #76

Open
ghwaldo opened this issue Jan 30, 2023 · 1 comment
Open

Windowing / Weighing Factor #76

ghwaldo opened this issue Jan 30, 2023 · 1 comment

Comments

@ghwaldo
Copy link

ghwaldo commented Jan 30, 2023

Thnx for this lib, great work.

One thing: would it not be better to calculate the weighing factor only once and not in every computation ?
Or am i wrong ?
In the Windowing Function it says:
this->_vReal[i] *= weighingFactor;
and then factor is computed above.
If then factors where computed once (in the construnctor ??) one could use the factor, but it would not be neccessary to compute the factor each time, it would cost memory, ok, but one could perjhaps choose to do it that way or the other.

Today (31.01.2023) i measured the conversions:

  • with Windowing in every loop i get 20 FFTs per second in my code
  • in a test i filled the array with 1.0, d#started FFT.windowing() and stored the values in another array. then i multiplied the incoming values with this stored factors. now i get 30 FFTs per second.

2nd edit:
Still in the develop-branch the hann-windowing is wrong:
instead of
weighingFactor = 0.54 * (1.0 - cos(twoPi * ratio));
it hast to be
weighingFactor = 0.5 * (1.0 - cos(twoPi * ratio));
see https://en.wikipedia.org/wiki/Window_function

or just use https://www.desmos.com/calculator?lang=de and put in both variants, you will see the difference:

  • 0.54-(0.46*cos(2 * pi * x))
  • 0.5*(1-cos(2 * pi * x))
    with x from 0 to 1, which would represent the ratio.
@HorstBaerbel
Copy link

HorstBaerbel commented May 16, 2023

I vaguely remember doing something like this in the develop branch. You could pass in the memory for the weights in the constructor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants