6 releases

0.1.5 Nov 4, 2022
0.1.4 Feb 7, 2022
0.1.2 Jan 30, 2022

#536 in Audio

MIT license

16KB
456 lines

dtmf

A no-std DTMF decoder for Rust. Can be used on a microcontroller or on a normal PC.

Usage

// Load in our audio samples
// This can also be done in real time from the sound card
let mut sample_file = File::open("data/dtmf_test.wav").unwrap();
let (header, data) = wav::read(&mut sample_file).unwrap();
let data = data.try_into_sixteen().unwrap();

// set up our decoder
let mut decoder = Decoder::new(header.sampling_rate, |tone, state| {
	println!("{:?}: {:?}", tone, state);
});

// can process all samples at once, or in smaller batches
decoder.process(&data);

Dependencies

~395KB