0
$\begingroup$

I'm sorry if pitch detection has become a stale topic here, but I'm really interested if anyone has any advice on this topic. I'm looking for the best pitch detection algorithm for stringed instruments, but I think this question will turn into "What else needs to be done to most accurately and reliably detect a pitch of a stringed instrument?".

So basically I applied all algorithms from here and they all differ, but they all have one thing in common, on any device I try, the algorithm reports -1 Hz after around a second of a string on an instrument being played.

Basically the magnitude needs to be really high in order for the algorithm to detect anything. Now, obviously it's nothing on my part since I literally just copied the exact code and got those results. So there are obviously methods of still detecting a pitch in low magnitudes ( other applications, not sure what they use, can detect the pitch in the same situation for around 4-5 seconds which is a lot longer then these algorithms ), but I'm not sure what they are. I'm not even talking about the fundamental being weak here, since the algorithm detects nothing.

Am I missing something, or is it the more likely option that something else needs to be done other than just applying a PDA to a sound buffer and if so, what is/are those things?

Thanks!

$\endgroup$
4
  • $\begingroup$ I think your question is not very clear. Can you narrow it down? As posted, it seems like you should direct your question to the autor of the code you're using. $\endgroup$
    – MBaz
    Aug 29, 2018 at 21:21
  • $\begingroup$ You're right. I'm trying to find a good algorithm for pitch detection ( more accurately for stringed instruments ) , but the ones I'm using ( which I thought were as pure as they get, I thought that the algorithms in that link are not THAT author-specific ) are not working all that well because of the reasons I mentioned. Is there a different source of Java applied Pitch Detection Algorithms? $\endgroup$ Aug 29, 2018 at 21:32
  • $\begingroup$ i cannot help you about those algorithms you cite at github. if you want to get down to the fundamentals, i can help. why a PDA "gives up" is a curiousity that i imagine has to do with specific code sorta unrelated to the algorithm. all of the PDAs that i have worked on always provide some answer while it may not be a good answer, it doesn't "give up", it just does what it does. search this SE archive of answers from me if you want to see how i approach the problem. i am quite specific about math and details on how the algorithm works. $\endgroup$ Aug 30, 2018 at 3:53
  • $\begingroup$ here is one older answer from me and here is another and here is another. $\endgroup$ Aug 30, 2018 at 4:09

1 Answer 1

-1
$\begingroup$

You might just have the magnitude or gain on your test input signals turned down too low. Or the threshold set too high. Or poor microphone placement. Or perhaps you need an AGC controlled gain block before the pitch estimation algorithms to stabilize the decay portion of any ADSR-"like" amplitude envelopes or sound evolutions.

The above assumes you have a decent S/N ratio (e.g. little background noise and no harmony or accompaniment).

Also, you use a singular "best algorithm", when multiple algorithms (plural) may more appropriate for different portions of a note's envelope, and/or different sized stringed instruments. In addition, your list of algorithms does not include any of the newer machine learning (ML or Convolutional DNN) inference methods of pitch detection/estimation or octave resolution. Perhaps even RNNs to use melodic history to improve prediction statistics.

$\endgroup$
2
  • $\begingroup$ Thanks for your comment! What would be your advice for achieving the best pitch detection mainly for guitars? What would YOU ( step by step, in order ) do in order to achieve this? What filters and window functions would you apply before using one/more PDA to correctly detect a pitch, or would you do something completely different? And also, how would you overcome weak fundamentals? Thanks! $\endgroup$ Aug 31, 2018 at 23:52
  • $\begingroup$ Got it, trade secrets and such. Thanks anyway! $\endgroup$ Sep 1, 2018 at 0:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.