reduce whisper-rs space

This commit is contained in:
Bel LaPointe
2023-12-21 22:15:00 -05:00
parent 29ff174f5d
commit 1cceb773f2
3 changed files with 35 additions and 4088 deletions

View File

@@ -61,7 +61,13 @@ fn f32_from_wav_file(path: &String) -> Result<Vec<f32>, String> {
return Err("!= 16_000 hz".to_string());
}
match data.as_sixteen() {
Some(data16) => Ok(whisper_rs::convert_integer_to_float_audio(&data16)),
Some(data16) => {
let mut floats = Vec::with_capacity(data16.len());
for sample in data16 {
floats.push(*sample as f32 / 32768.0);
}
Ok(floats)
},
None => Err(format!("couldnt translate wav to 16s")),
}
}