Fix choppy/distorted audio to live caller
- Mute host mic forwarding while TTS is streaming to prevent interleaving both audio sources into the same playback buffer - Replace nearest-neighbor downsampling with box-filter averaging on both server (host mic) and browser (caller mic) for anti-aliased resampling Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -472,9 +472,10 @@ class AudioService:
|
||||
if not self._host_send_callback:
|
||||
return
|
||||
mono = indata[:, record_channel]
|
||||
# Simple decimation to ~16kHz
|
||||
# Downsample to ~16kHz with averaging (anti-aliased)
|
||||
if step > 1:
|
||||
mono = mono[::step]
|
||||
n = len(mono) // step * step
|
||||
mono = mono[:n].reshape(-1, step).mean(axis=1)
|
||||
|
||||
host_accum.append(mono.copy())
|
||||
host_accum_samples[0] += len(mono)
|
||||
|
||||
Reference in New Issue
Block a user