feat: add barge-in interrupt detection#268
Closed
MatiasComercio wants to merge 1 commit intombailey:masterfrom
Closed
feat: add barge-in interrupt detection#268MatiasComercio wants to merge 1 commit intombailey:masterfrom
MatiasComercio wants to merge 1 commit intombailey:masterfrom
Conversation
- Implement DuplexBargeInPlayer for real-time interrupt detection - Add barge-in configuration constants and skip_playback parameter - Add 23 unit tests covering energy detection, echo suppression, thread-safety - Fix VAD silence detection with wall-clock timeout and reduced post-barge-in min_duration - Update dependency to webrtcvad-wheels for easier installation Applies to voicemode v8.1.0
Author
|
Just checking the opened PRs, the #238 is exactly the same. Closing and in case anything from here is useful ping me or use 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.
Summary
This PR adds Barge-in (Interrupt Detection): Users can interrupt TTS playback by speaking, with echo suppression and ring buffer to capture pre-trigger audio
These changes enable natural conversation flow where users can interrupt the AI's response without waiting, and recordings stop automatically after silence.
Motivation
Changes
Core Functionality Added
1. Barge-in System
DuplexBargeInPlayerclass for full-duplex audio monitoring2. Streaming Layer Updates
skip_playbackparameter throughout streaming stackFiles Modified
voice_mode/config.py (8 lines)
BARGE_IN_ENERGY_THRESHOLD = 300BARGE_IN_MIN_SPEECH_MS = 20voice_mode/streaming.py (79 lines)
skip_playbackparameter tostream_pcm_audio()skip_playbackparameter tostream_tts_audio()skip_playbackparameter tostream_with_buffering()skip_playbackchecksvoice_mode/core.py (11 lines)
skip_playbackparameter totext_to_speech()voice_mode/tools/converse.py (316 lines)
DuplexBargeInPlayerclass (170+ lines of barge-in logic)barge_inparameter toconverse()functiontext_to_speech_with_failover()withforce_save_audioandskip_playbackAPI Changes
New backward-compatible parameter in converse():
Default:
barge_in=False(preserves existing behavior)Environment Variables
Optional configuration via environment:
Testing
Manual Testing Performed
Basic VAD (Silence Detection)
Barge-in (TTS Interruption)
Backward Compatibility
Test Metrics
Test Commands
Automated Testing
All existing tests pass:
Note: new tests for DuplexBargeInPlayer barge-in detection logic cover:
Voicemode Version
Patches were developed and tested against voicemode 8.1.0.
Checklist
pytest)pytest --cov=voice_mode)Dependencies
No new direct dependencies added to project requirements.
Platform Compatibility
Tested on macOS with standard audio hardware. Linux/Windows compatibility should be maintained as all audio operations use existing VoiceMode abstractions.