Feat/vox 035 self echo guard - #37
Merged
Merged
Conversation
On open speakers the mic captures the reply, speak_and_watch carries that capture into the next turn as `pending`, and a turn with a `pending` never opens the mic — it transcribes the machine's own reply and answers it, so the session talks to itself until the clock runs out. The self-interrupt everyone describes is the harmless half; the carry-forward is what feeds itself. src/echo.py detects the echo rather than cancelling it: the question is not what the person said underneath it but whether there is a person at all, and that is answerable from a log-RMS envelope correlated against what the speaker has actually played, at the best lag over a delay window. Envelopes reach a common time base rather than a common sample rate, so the 16 kHz mic and the 24 kHz reply need no resampler inside a live turn. Two measurements shaped it. scripts/measure_echo_guard.py: at the threshold that keeps 95% of echo, 400 ms of audio throws away 18.3% of real speech and 700 ms throws away none — so MIN_DECISION_MS is 700 and speak_and_watch holds the barge-in decision open that long when the guard is on, because cutting the reply at 200 ms stops the echo that would have made the decision possible. And the check the endpoint originally also made was misaligned, not merely redundant: by DONE the hangover has passed and the reply has played on, so the echo sits further back in the reference than the delay search reaches. It was removed; echoes_reply covers the same ground after STT with no alignment to get wrong. Off by default. On headphones there is nothing to reject, and every latency number on the board was measured without it; a guarded run is marked echo_guard on its turn record so the two are never averaged together. Ambiguity resolves to "not echo" throughout, because discarding a real utterance is worse than the bug. Headphones remain the real fix, and README and ARCHITECTURE still say so.
Two holes, both at the end of a reply, neither a threshold problem. The output buffer: `finished` is when the device stopped pulling, not when the room went quiet — 0.182 s of buffer is still on its way out on the demo machine and all of it is audible echo. The guard returned False the moment `finished` was set, which is exactly when the last words are still in the air. It now keeps looking for the buffer plus one delay window, and widens the delay search by however long ago the device stopped: the reference cannot advance past the end of the reply, so as the mic runs on the echo sits further back inside it. The rearm residue: the envelope guard rearms every time it rejects, so the last rearm before a reply ends leaves a capture of a second or less — below MIN_DECISION_MS for the envelope test and below min_words for the overlap test, so both decline and it becomes a turn. Lowering MIN_DECISION_MS is not available; 400 ms throws away 18.3% of real speech. Fixed a layer up, where whisper's words make a narrower question askable: not "do these words appear in the reply" but "are these words how the reply ended". tail_slack is 1, and that is the whole trade — at 2, a reply ending "before two years of allotment" makes "two years" a tail and a user asking about those two years loses their turn. The carried-in path asks confirm.classify_response first, because a real "yes, go ahead" over a read-back arrives as carried-in audio and no echo rule should be able to eat one. Bounded to short transcripts: that function matches its words as substrings, so "booking one hour" answers "yes", and unbounded the exemption would cover any echo with "book" or "looking" in it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.