If you want to convert a wav file to 16 kHz for whisper in Rust, you can use the following script. It uses the hound
crate to read and write wav files and rubato to resample the audio.
Reads a file as input.wav
and returns a converted wav as output.wav
.
use rubato::{
Resampler, SincFixedIn, SincInterpolationParameters, SincInterpolationType, WindowFunction,
};