From 01088f4f1915e36a7d0d8d8756f62f8207a48911 Mon Sep 17 00:00:00 2001 From: soryu Date: Sat, 20 Dec 2025 15:36:04 +0000 Subject: Implement makima listen websockets server --- makima/src/audio.rs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'makima/src/audio.rs') 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 { mono } +/// Resample and mixdown audio to 16kHz mono for STT processing. +pub fn resample_and_mixdown(samples: &[f32], sample_rate: u32, channels: u16) -> Vec { + 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 { if input_rate == output_rate { return input.to_vec(); -- cgit v1.2.3