đ” YIN Pitch Detection in Rust
Implementation of the YIN algorithm for estimating the fundamental frequency of an audio signal in Rust. Optimized for speed, and with parabolic interpretation for refining the result.
Background
The YIN algorithm (CheveignĂ© & Kawahara, 2002) estimates the fundamental frequency (fâ) of a signal by minimizing the Cumulative Mean Normalized Difference Function (CMNDF).
This implementation follows the standard YIN steps:
- Difference function (DF)
- Cumulative mean normalization (CMNDF)
- Absolute thresholding
- (Parabolic interpolation for refined lag estimate)
The resulting best lag gives the estimated period, and therefore the frequency:
$$ f = \frac{f_s}{\text{lag}} $$
De CheveignĂ©, A., & Kawahara, H. (2002). YIN, a fundamental frequency estimator for speech and music. The Journal of the Acoustical Society of America, 111(4), 1917â1930. https://doi.org/10.1121/1.1458024
@article
Example Usage
use Yin;