diff --git a/examples/audio_transcription.rs b/examples/audio_transcription.rs index d795c39..b2f3445 100644 --- a/examples/audio_transcription.rs +++ b/examples/audio_transcription.rs @@ -1,10 +1,10 @@ // This example is not going to build in this folder. // You need to copy this code into your project and add the dependencies whisper_rs and hound in your cargo.toml +use hound; use std::fs::File; use std::io::Write; use whisper_rs::{FullParams, SamplingStrategy, WhisperContext}; -use hound; /// Loads a context and model, processes an audio file, and prints the resulting transcript to stdout. fn main() { diff --git a/src/utilities.rs b/src/utilities.rs index f521f7e..79bb9c2 100644 --- a/src/utilities.rs +++ b/src/utilities.rs @@ -63,7 +63,10 @@ pub fn convert_integer_to_float_audio_simd(samples: &[i16]) -> Vec { /// # Returns /// A vector of 32 bit floating point mono PCM audio samples. pub fn convert_stereo_to_mono_audio(samples: &[f32]) -> Vec { - samples.chunks_exact(2).map(|x| (x[0] + x[1]) / 2.0).collect() + samples + .chunks_exact(2) + .map(|x| (x[0] + x[1]) / 2.0) + .collect() } /// Convert 32 bit floating point stereo PCM audio to 32 bit floating point mono PCM audio.