1
0
Fork
You've already forked pitch-detection
0
No description
  • Rust 100%
Find a file
2026年04月14日 19:34:59 +12:00
benches Initial commit 2026年04月14日 19:27:11 +12:00
examples Initial commit 2026年04月14日 19:27:11 +12:00
src Initial commit 2026年04月14日 19:27:11 +12:00
tests Initial commit 2026年04月14日 19:27:11 +12:00
.gitignore Initial commit 2026年04月14日 19:27:11 +12:00
Cargo.toml Initial commit 2026年04月14日 19:27:11 +12:00
GPT_Prompt.txt Initial commit 2026年04月14日 19:27:11 +12:00
LICENSE Initial commit 2026年04月14日 19:27:11 +12:00
README.md Remove github specific stuff 2026年04月14日 19:34:59 +12:00

Forked from alesgenova / pitch-detection

pitch_detection

Usage

usepitch_detection::detector::mcleod::McLeodDetector;usepitch_detection::detector::PitchDetector;fn main(){constSAMPLE_RATE: usize =44100;constSIZE: usize =1024;constPADDING: usize =SIZE/2;constPOWER_THRESHOLD: f64 =5.0;constCLARITY_THRESHOLD: f64 =0.7;// Signal coming from some source (microphone, generated, etc...)
letdt=1.0/SAMPLE_RATEasf64;letfreq=300.0;letsignal: Vec<f64>=(0..SIZE).map(|x|(2.0*std::f64::consts::PI*xasf64*dt*freq).sin()).collect();letmutdetector=McLeodDetector::new(SIZE,PADDING);letpitch=detector.get_pitch(&signal,SAMPLE_RATE,POWER_THRESHOLD,CLARITY_THRESHOLD).unwrap();println!("Frequency: {}, Clarity: {}",pitch.frequency,pitch.clarity);}

Live Demo

Demo Page Source

Documentation

LaTeX formulas can be used in documentation. This is enabled by a method outlined in rust-latex-doc-minimal-example. To build the docs, use

cargo doc --no-deps

The --no-deps flag is needed because special headers are included to auto-process the math in the documentation. This header is specified using a relative path and so an error is produced if cargo tries generate documentation for dependencies.