This week I verified the pitch detection accuracy of the Yin pitch detection algorithm as implemented by a third-party. In inspecting their code, I noticed that they did not implement every step of the algorithm and described in the paper, therefore, its accuracy is lower than reported in the paper. While the algorithm has 6 steps, only 4 were implemented. I considered implementing the extra steps myself, but I found the code difficult to work with and sought other options. I found another implementation for the algorithm on GitHub, but it had similar issues: not all steps were implemented, and it was written in Python 2.
In response, I sought other successful pitch detection algorithms, particularly the one implemented in the Phonetics program Praat. In my research, I found a paper that compared results for the Yin, Praat, and RAPT pitch detection algorithms and found that the Praat algorithm was most accurate. Luckily, there exists a Python interface for Praat by the name of Parselmouth which unfortunately does not have the best documentation, but is intuitive enough to use for pitch detection.
I tested both algorithms against pure tones from C2 to C6 with added noise, and modulation by 2 to 8 hertz to simulate voice vibrato. This is the result of the two different algorithms against a randomly generated assortment of pitches.
.
I haven’t yet done a note to note comparison between these two, but I think the ease of use of Parselmouth has convinced me to go this route. In the coming week, I hope to complete the clap detection algorithm and the pitch to note converter.