Expand description
Streaming pitch (f0) tracker. Pure-DSP backends only — neural
backends live in the companion crate pitch-core-onnx.
§Quick start
use pitch_core::{PitchTracker, SwipeEstimator};
let est = SwipeEstimator::new()?;
let mut tracker = PitchTracker::new(est, 48_000, 1024)?;
for frame in tracker.process(&chunk)? {
if frame.confidence > 0.3 {
println!("{:.3}s {:.1} Hz", frame.time_s, frame.pitch_hz);
}
}§Adding ONNX backends
Add pitch-core-onnx as a dependency and pass any of its estimators
to the same PitchTracker::new. The trait surface is identical:
ⓘ
use pitch_core::PitchTracker;
use pitch_core_onnx::{SwiftF0Estimator, Mode};
let est = SwiftF0Estimator::new("path/to/swift_f0.onnx", Mode::Balanced)?;
let mut tracker = PitchTracker::new(est, 48_000, 1024)?;Re-exports§
pub use estimator::calibrate_confidence;pub use estimator::EstimatorError;pub use estimator::PitchEstimator;pub use estimator::PitchFrame;pub use estimator::Result;pub use praat_ac::PraatAcEstimator;pub use pyin_est::PyinEstimator;pub use swipe::SwipeEstimator;
Modules§
- estimator
- praat_
ac - Praat-style autocorrelation pitch estimator (Boersma 1993).
- pyin_
est - pYIN (probabilistic YIN, Mauch & Dixon 2014) via the
pyincrate (Sytronik, pure-Rust port of sevagh/pitch-detection). - resample
- swipe
- SWIPE’/SWIPE pitch estimator — thin adapter over the public
swipe-rscrate (Apache-2.0). The pitch detection algorithm itself is implemented in https://crates.io/crates/swipe-rs; this file just plugs it into pitch-core’sPitchEstimatortrait and adds theis_preliminary: falsefield that swipe-rs (deliberately) doesn’t know about.
Structs§
- Pitch
Tracker - High-level streaming pitch tracker. Combines any
PitchEstimatorwith a linear resampler that converts the host’s sample rate to the estimator’s target rate.