-
Notifications
You must be signed in to change notification settings - Fork 70
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
wrong results with different buffer sizes in the sinewave example #72
Comments
Is this using the sinewave from https://github.com/sevagh/pitch-detection/blob/master/test/util.cpp#L14 ? I can confirm I see the same behavior. However, I just downloaded a clip of guitar B3 (~247Hz), and created some resampled versions at 22050 and 16000, and the results were mostly OK (except with a buffer size of 256, which is probably too small). I'm most surprised at |
Thanks for your quick reply. I did use test_util::sinewave. And yes, a buffer size of 256 at 16kHz doesn't really make sense since it only contains a couple of periods... FYI I tried to replace the yin algorithm your mpm and I get the same nonsense, so you're probably right that the sinewave generator has a problem. Anyway, thanks for making these algorithms available 👍 I'll keep exploring... |
If you make a better sinewave generator, I'd be happy to merge it. Good luck. |
Hi @jeychenne It's been a long time but I finally found an explanation for this. FFTS has a strange behavior in the complex-to-complex FFT: anthonix/ffts#65 You can see some of my posts in that issue from ~2020 (which is after you posted this issue), but I never put two and two together. I've been diving deep into fixing some of the corner cases and have settled on:
I've incorporated your original reported failing test cases into some new test cases and they all pass now:
256 is understandably poor (it's too short for that pitch, probably), but the others have been improved. I also generate tones with numpy/librosa and write them to text files for my old unit tests. This is being worked on in this PR: #87 |
I tried to play with the sinewave example, changing the buffer size and sampling rate. Perhaps I'm missing something obvious, but it looks like depending on the buffer size, the results are wrong. Here is the test I ran, using the current master version of FFTS:
And here is the output on my machine (debian x64):
Can you confirm this problem, and do you have an explanation for it? Thank you!
The text was updated successfully, but these errors were encountered: