A modular pitch detection library for Rust.
Lightweight, fast, and suitable for real-time audio analysis.
- Zero dependencies
- Designed for real-time use (no heap allocations during detection)
- Simple
PitchDetectortrait for pluggable algorithms
| Algorithm | Status | Description |
|---|---|---|
| Autocorrelation | Available | Time-domain autocorrelation with first-peak detection and parabolic interpolation |
| More algorithms | Coming soon | — |
use autopitch::algorithm::Autocorrelation;
use autopitch::detect::PitchDetector;
let mut detector = Autocorrelation::default();
let samples: Vec<f32> = /* your audio samples */;
let sample_rate = 44100.0;
if let Some(pitch) = detector.detect(&samples, sample_rate) {
println!("Detected pitch: {:.2} Hz", pitch);
}MIT