Crates.io | dtmf |
lib.rs | dtmf |
version | 0.1.5 |
source | src |
created_at | 2022-01-30 21:26:06.926664 |
updated_at | 2022-11-04 19:26:39.074307 |
description | A no-std DTMF decoder |
homepage | |
repository | https://gitlab.scd31.com/stephen/dtmf |
max_upload_size | |
id | 524199 |
size | 48,310 |
A no-std DTMF decoder for Rust. Can be used on a microcontroller or on a normal PC.
// 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);