reduce whisper-rs space
This commit is contained in:
@@ -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")),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user