-
Notifications
You must be signed in to change notification settings - Fork 2
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
Algorithm Flaws #1
Comments
After adding weighting to compensate for band variable width, I get pretty good results! Ideally would add a weighting curve to favor middle-tones on top of that, but the math can be delicate to get right.
https://github.com/mysteryx93/NaturalGroundingPlayer/blob/master/BassAudio/PitchDetector.cs |
I refreshed my parabolic math skills and created a nice curve for 80 tones.
Unfortunately, I get better results with 60 flat values than with 80 parabolic values. It was worth a try. I also tried doing proper rounding instead of rounding down to find the FFT band, but rounding down gave better results somehow.
I'm pretty satisfied with the results. Source code here. |
wow!! |
Actually, according to my tests, weighting middle tones more somehow gave worse results than flat weighting; but also discarding extreme highs and lows. |
I've taken your pitch-detection idea to convert it to C#, and am getting wildly inconsistent results. So I started to look at the code and saw a few problems.
You're scanning from the whole range of notes, valuing extreme lows/highs as much as mid-tones. It makes more sense to analyze mid-tones between around 80hz and 1400hz. Or, apply a curve to value mid-tones more in a smoother way, but haven't worked out the right math yet.
Even with FFT32768, there are only 2-3 FFT band differences between notes in the lower tones, and 6-7 FFT band differences between notes in the higher tones. That's not quite enough for the kind of measurements we're trying to do with 0.1hz precision... That alone can explain the flaky results.
In lower tones, FFT bands are larger (band = 1/3 of a note) than in higher tones (band = 1/4 of a note). As a result, lower-pitch analysis like 424hz and 330hz get a higher score than higher pitch like 440hz+.
I've also found a series of algorithms here, but I'm not sure whether it's doing the same thing as what we're doing here.
https://github.com/sevagh/pitch-detection
The text was updated successfully, but these errors were encountered: