use at least 15k hz for input device config

master
Bel LaPointe 2023-12-20 23:14:13 -05:00
parent 43e495ac6c
commit 6bb29c106f
2 changed files with 2 additions and 1 deletions

View File

@ -95,6 +95,7 @@ impl Listener {
let cfg = device.supported_input_configs() let cfg = device.supported_input_configs()
.unwrap() .unwrap()
.filter(|x| x.sample_format() == cpal::SampleFormat::F32) .filter(|x| x.sample_format() == cpal::SampleFormat::F32)
.filter(|x| x.min_sample_rate() >= cpal::SampleRate(15_500))
.nth(0) .nth(0)
.unwrap() .unwrap()
.with_max_sample_rate(); .with_max_sample_rate();

View File

@ -5,7 +5,7 @@ pub fn wav<F>(
handler_fn: F handler_fn: F
) where F: FnMut(Result<rust_whisper_lib::Transcribed, String>) + Send + 'static { ) where F: FnMut(Result<rust_whisper_lib::Transcribed, String>) + Send + 'static {
flags.model_path = None; flags.model_path = None;
flags.model_buffer = Some(include_bytes!("../../models/ggml-base.en.bin").to_vec()); flags.model_buffer = Some(include_bytes!("../../models/ggml-small.en.bin").to_vec());
rust_whisper_lib::wav(flags.clone(), handler_fn, flags.wav.unwrap()); rust_whisper_lib::wav(flags.clone(), handler_fn, flags.wav.unwrap());
} }