Fix voice barge-in cutting off the opening greeting - #44
Merged
Conversation
🦋 Changeset detectedLatest commit: dea8f51 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Add CLAUDE.md project guide, .claude/settings.json hooks config, and enforce-worktree.sh to prevent feature work on main branch. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Barge-in fired on a single ~2.67ms mic frame over the RMS threshold, so residual acoustic echo from the greeting (browser AEC is imperfect on speakers), a cough, or a noise blip interrupted the agent mid-sentence — most visibly, the opening greeting never finished. Now require ~200ms of sustained above-threshold audio before barge-in (bargeInMinMs, default 200); real speech crosses it easily, transient blips don't. Run resets on any quiet frame and on each new agent utterance. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ULQ7QeEUq72vpU57ubzanJ
brentrager
force-pushed
the
fix-voice-bargein-debounce
branch
from
July 29, 2026 20:59
dd98e51 to
dea8f51
Compare
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.
Problem
The voice agent's opening greeting cuts itself off mid-sentence, every time.
Root cause
Barge-in fired on a single mic frame over the RMS threshold (
voice-session.ts:422). The capture worklet posts 128-sample frames = ~2.67ms at 48kHz. Browser echo cancellation is imperfect on speakers, so residual echo of the greeting (the loudest, longest agent audio) — or a cough, or a noise blip — crosses RMS 0.02 for one frame and instantly sendsinterrupt, aborting the greeting playback.Fix
Require ~200ms of sustained above-threshold audio before barge-in fires (new
bargeInMinMsoption, default 200). Real speech crosses it easily; transient echo/noise blips don't. The accumulator resets on any quiet frame (echo is bursty) and on each new agent utterance.Time-based (
samples.length / sampleRate), so it's correct for both the AudioWorklet (128-sample) and ScriptProcessor (4096-sample) capture paths.Tests
🤖 Generated with Claude Code
https://claude.ai/code/session_01ULQ7QeEUq72vpU57ubzanJ