diff options
| author | soryu <soryu@soryu.co> | 2025-12-20 15:36:04 +0000 |
|---|---|---|
| committer | soryu <soryu@soryu.co> | 2025-12-23 14:47:18 +0000 |
| commit | 01088f4f1915e36a7d0d8d8756f62f8207a48911 (patch) | |
| tree | 8fdbba900f3f4bba32bae76e2e0378848a90cf93 /makima/src/audio.rs | |
| parent | ab9166170043ba5e0ce974e5b7accf0939d686e3 (diff) | |
| download | soryu-01088f4f1915e36a7d0d8d8756f62f8207a48911.tar.gz soryu-01088f4f1915e36a7d0d8d8756f62f8207a48911.zip | |
Implement makima listen websockets server
Diffstat (limited to 'makima/src/audio.rs')
| -rw-r--r-- | makima/src/audio.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/makima/src/audio.rs b/makima/src/audio.rs index acfe7ce..8c969be 100644 --- a/makima/src/audio.rs +++ b/makima/src/audio.rs @@ -239,6 +239,12 @@ fn mixdown_to_mono(interleaved: &[f32], channels: u16) -> Vec<f32> { mono } +/// Resample and mixdown audio to 16kHz mono for STT processing. +pub fn resample_and_mixdown(samples: &[f32], sample_rate: u32, channels: u16) -> Vec<f32> { + let mono = mixdown_to_mono(samples, channels); + resample_sinc(&mono, sample_rate, TARGET_SAMPLE_RATE) +} + fn resample_sinc(input: &[f32], input_rate: u32, output_rate: u32) -> Vec<f32> { if input_rate == output_rate { return input.to_vec(); |
