-
Notifications
You must be signed in to change notification settings - Fork 161
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
high frequency artifacts in spectrograms with reduced max_freq #132
Comments
Thanks @egitto for this very clear report ! Obviously we have a sampling problem... As you found, decimating without pre-filtering is a perfect recipe for artifacts... I guess I wrote that part when I was not clear enough on sampling theory! I'll try to look at whether there is a fast-enough and correct-enough way to do that. Using an average as you did in #133 is a step in the proper direction, but we might be able to do better (by using a filter to do the downsampling instead of an average). I don't have a lot of spare time these days, so I can't promise any ETA unfortunately. |
Addresse #132. When the FFT spectrum is cropped by lowering the max frequency, the signal was decimated N times by taking one sample every N samples. This is not correct, produces many artifacts. To keep decimation, we would need to use a proper low-pass filter (as implemented for the octave spectum for example), but it does not really seem worth it. We will just apply the FFT on top of the undecimated signal.
I've removed the decimation completely in #137 |
Steps to reproduce:
I understand that this is due to the decimator using the "simplest way"
I propose using the full way rather than the simplest way, as that should mostly eliminate this problem (as the higher-than-threshold frequencies should approximately cancel themselves out), while maintaining the presumable performance benefit of giving a smaller set of samples to the FFT.
At the moment, the decimator seems to be optimizing performance when the window is cropped, but at the cost that the spectrogram has ghosts if there are significant harmonics above some threshold frequency. I expect that in most use cases of the app, there will be significant harmonics; human vocalizations and musical instruments are full of them; so probably this is also the case for times when one would want to crop the window?
I have created a PR for this. Some additional details including costs and benefits are there. #133
The text was updated successfully, but these errors were encountered: