Crate pitch[][src]

Quickly and accurately determine the pitch and volume of a sound sample.

This crate uses a Bitstream Autocorrelation Function (BCF) to determine the pitch of the sound sample.

Example

Example code can be found in test.rs. The audio files I used were me playing my trombone on notes A1, A2, A3, and A4, and generating sine, saw, and square waves with Audacity on the note A4 (making sure to set 48000hz sample rate). Here is my example output (Note: I didn't tune my trombone beforehand since this program is a tuner, and may give different results than other tuners):

A1: 55.422962 Hz, 0.7379681 Vl
A2: 107.865166 Hz, 0.43305764 Vl
A3: 215.78847 Hz, 0.69536424 Vl
A4: 436.30658 Hz, 0.117435224 Vl
SINE_A4: 439.99805 Hz, 0.8001343 Vl
SAW_A4: 439.99167 Hz, 0.8001343 Vl
SQUARE_A4: 434.3891 Hz, 0.80022585 Vl

Functions

detect

Do the BCF calculation on raw samples. Returns (hz, amplitude[0-1]).