首页 > 数据库 > 数据库开发技术 > 【Rust日报】2022-01-31 新年快乐


原文链接: https://medium.com/@alisomay/strings-in-rust-28c08a2d3130
// 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);
原文作者:Rust语言中文社区;如有侵权,请联系管理员删除。