Module pitch_detection::detector
source · [−]Expand description
Pitch Detectors
Each detector implements a different pitch-detection algorithm. Every detector implements the standard PitchDetector trait.
Modules
Autocorrelation is one of the most basic forms of pitch detection. Let $S=(s_0,s_1,\ldots,s_N)$ be a discrete signal. Then, the autocorrelation function of $S$ at time $t$ is $$ A_t(S) = \sum_{i=0}^{N-t} s_i s_{i+t}. $$ The autocorrelation function is largest when $t=0$. Subsequent peaks indicate when the signal is particularly well aligned with itself. Thus, peaks of $A_t(S)$ when $t>0$ are good candidates for the fundamental frequency of $S$.
The McLeod pitch detection algorithm is based on the algorithm from the paper A Smarter Way To Find Pitch. It is efficient and offers an improvement over basic autocorrelation.
The YIN pitch detection algorithm is based on the algorithm from the paper YIN, a fundamental frequency estimator for speech and music. It is efficient and offers an improvement over basic autocorrelation.
Traits
A uniform interface to all pitch-detection algorithms.