dywapitchtrack

Crates.iodywapitchtrack
lib.rsdywapitchtrack
version0.1.0
sourcesrc
created_at2023-05-24 14:11:35.058901
updated_at2023-05-24 14:11:35.058901
descriptionA Rust implementation of dywapitchtrack by Antoine Schmitt
homepagehttps://github.com/ZerNico/dywapitchtrack_rs
repositoryhttps://github.com/ZerNico/dywapitchtrack_rs
max_upload_size
id873073
size1,087,916
Nico Franke (ZerNico)

documentation

README

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);
}
Commit count: 2

cargo fmt