Skip to content

Fix Echo demo one-shot audio - #432

Open
mchernyavskaya wants to merge 4 commits into
soniqo:mainfrom
mchernyavskaya:fix-echo-example-one-shot
Open

Fix Echo demo one-shot audio#432
mchernyavskaya wants to merge 4 commits into
soniqo:mainfrom
mchernyavskaya:fix-echo-example-one-shot

Conversation

@mchernyavskaya

@mchernyavskaya mchernyavskaya commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

What

  • Fixing Echo in the SpeechDemo: only the 1st phrase was recorded and repeated, instead of a continuous dialog

Summary

  • Prevent Echo TTS playback leakage from becoming a new VAD speech turn.
  • Preserve continuous audio timing by pushing silence while playback is active.
  • Reset StreamingAudioPlayer completion state on stop and update the demo tests to use the current player.

Validation

  • swift test --filter EchoMicrophoneGateTests --disable-sandbox
  • swift test --filter AudioPlayerTests --disable-sandbox

Live microphone/model testing was not run.

@ivan-digital

Copy link
Copy Markdown
Member

Gate looks fine. Heads up that it's a restore rather than a new fix — same isSpeaking gate landed in #163 and got deleted as collateral by #106 a few days later.

That said, muting isn't really cancelling the echo, it's just not listening while we talk. Works, but it locks the demo to half-duplex — no barge-in, and the demo README still promises interruption support we can't deliver.

We already have LocalVQEEchoCanceller in Sources/SpeechEnhancement/. Echo tab is a good fit for it since we generate the playback audio ourselves, so we know exactly what to subtract from the mic. Would let us keep listening through playback.

Main gotcha is the reference has to line up with what's actually coming out of the speaker at that instant, not what we just generated. Easy to get subtly wrong, so worth testing with a known delay rather than eyeballing it on a live mic.

One more: EchoReferenceGate.swift can go either way. It was never wired into EchoViewModel, so it's been dead since it landed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants