#pitch #frequency #detection #audio

no-std dywapitchtrack

A Rust implementation of dywapitchtrack by Antoine Schmitt

2 unstable releases

0.2.0 Jan 4, 2025
0.1.0 May 24, 2023

#71 in Multimedia

Download history 1/week @ 2024-09-25 1/week @ 2024-10-30 1/week @ 2024-11-06 1/week @ 2024-12-04 1/week @ 2024-12-11 129/week @ 2025-01-01 15/week @ 2025-01-08

144 downloads per month

MIT license

330KB
389 lines

crates.io

dywapitchtrack

Usage

use dywapitchtrack::DywaPitchTracker;

fn main() {
    const SAMPLE_RATE: usize = 44100;
    const SIZE: usize = 1024;

    let dt = 1.0 / SAMPLE_RATE as f32;
    let freq = 300.0;

    // Sound samples
    let samples: Vec<f32> = (0..SIZE)
        .map(|x| (2.0 * std::f32::consts::PI * x as f32 * dt * freq).sin())
        .collect();

    let mut pitch_tracker = DywaPitchTracker::new();
    let pitch = pitch_tracker.compute_pitch(&samples, 0, SIZE)

    println!("Frequency: {}", pitch);
}

No runtime deps