Im also now searching for a pitch detection algo š (though I want it in C++)
my first go today, trying a different approach that doesn't use FFT, rather its based on "Dynamic Wavelet Algorithm Pitch Tracking", and a C implementation from Antoine Schmitt (see repo below for reference)
in my tests it seems to track pretty, but it seems heavy on cpu š
https://github.com/TheTechnobear/BelaPatches/tree/dev/c%2B%2B/pitchd
my patch, runs puts out a sine on out1, which you can feed into in1, and then out 2 has a sine of that generated frequency. of course, you can run any signal into in1... does have to be the test sine.
the "dywapitchtracker" is pretty straightforward - but does not seem optimised.
for example, I changed it to not allocate memory on every pitch computation.
i also converted it from using doubles to float (which bizarrely (?) seems to make it slightly more cpu intensive)
so not sure if it's a dead loss.. or if there are some easy wins, that i missed.
also though its saying 74% cpu, this I guess would not cause audio disruption, since its no a non-RT thread.
hmm, what next?
if the above is not going to work, Im thinking to implementing something based on KissFFT and this implementation of wsnac.
https://github.com/kpe/zerotune/blob/master/src/wsnac.c
alternative, I could look at using some code from pd - sigmund~, fiddle~, or helmholtz~ using KissFFT for the fft.
thoughts?