4 releases
0.1.31 | Jun 5, 2023 |
---|---|
0.1.21-dev2 | Jun 5, 2023 |
#425 in Audio
37KB
773 lines
april_asr
This crate is a (safe) wrapper around April ASR through its C API. From its GitHub page:
- April-ASR is a minimal library that provides an API for offline streaming speech-to-text applications
Usage
Reading a WAV file and feeding it to the APRIL-ASR model:
use april_asr::{Model, Session, Result, AprilResult};
use std::io::Read;
april_asr::april_asr_init();
let model = Model::new("/path/to/model.april").unwrap();
let session = Session::new(model, april_asr::SessionFlags::SYNC, |result: AprilResult| {
println!("Result: {:?}", result);
});
let mut buffer = Vec::new();
let mut file = std::fs::File::open("/path/to/file.wav").unwrap();
let _ = file.read(&mut buffer);
session.feed_pcm16(buffer);
session.flush();
Dependencies
~0–3MB
~54K SLoC