From 7f8953430977c883121d08121de8b0350acd7277 Mon Sep 17 00:00:00 2001 From: gramps Date: Thu, 12 Nov 2026 11:15:50 -0800 Subject: [PATCH] feat(audio): microphone-only sync delay, on by default at 175 ms MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The webcam's frames reach the compositor later than the mic's samples reach the audio pipe, so the voice runs ahead of the lips. The existing lip-sync offset could not fix that: it delays the WHOLE mix, which drags desktop and alert audio — neither of which has a camera to follow — out of sync in the process. So the delay line learned channels (mono for a source, stereo for the mix, offset always in milliseconds so the frame count is what stays constant), and FillAndMix runs a second line over micChunk before the mix. Slider-side: presets off / 150 / 200 in the LIP-SYNC bay under the whole-mix control, persisted as Audio.MicSyncOffsetMs. Default 175 ms is the creator's own number for a C920 pipeline (they asked for +150..+200). It is a setting, not a constant, because the right figure belongs to the camera and the machine — a faster camera wants less, no camera wants none. Both delay lines are reconfigured every tick, so the 2026-09-12 trap still applies and is documented at both sites: a Configure that reallocates discards the buffered voice every 10 ms. 673 pass, 0 warnings. Ear check pending: this is an audio change. --- Controls/AudioDock.xaml | 22 ++++++++++++++++++++++ Controls/AudioDock.xaml.cs | 7 +++++++ Services/Audio/AudioMixer.cs | 25 ++++++++++++++++++++++++- Services/Audio/AudioSyncDelay.cs | 25 +++++++++++++++---------- Services/LayoutStore.Settings.cs | 17 +++++++++++++++++ ViewModels/MainViewModel.Audio.cs | 25 ++++++++++++++++++++++++- ViewModels/MainViewModel.cs | 5 ++++- docs/ai/output.md | 9 +++++++++ ytLive.Tests/AudioSyncDelayTests.cs | 13 +++++++++++++ 9 files changed, 135 insertions(+), 13 deletions(-) diff --git a/Controls/AudioDock.xaml b/Controls/AudioDock.xaml index 3c3c6b7..b679017 100644 --- a/Controls/AudioDock.xaml +++ b/Controls/AudioDock.xaml @@ -213,6 +213,28 @@