BargeKit is designed to be local-first.
- Core state transitions run locally.
- Synthetic fixtures are generated locally.
- The demo is a static client-side page.
- The browser microphone adapter only starts after an explicit user action.
- This repository does not ship hidden upload, analytics, or recording flows.
- Evaluates audio levels or external wake/push signals.
- Detects speech segments using deterministic thresholds and timing windows.
- Emits interruption, ducking, mute, noise-gate, and duplex-hold events.
- Helps host apps keep UI state honest about whether input is really open.
- Speech transcription
- Text to speech
- Wake-word model training
- Cloud microphone streaming
- Guaranteed full acoustic echo cancellation
- Requires a user gesture before
getUserMedia(). - Browser/device echo cancellation quality varies widely.
AudioContextlifecycle and autoplay policies differ across Chrome, Edge, Safari, and embedded WebViews.
- Expect more speaker bleed and false positives.
- Start from the
laptop_speakerspreset. - Prefer stronger noise floor thresholds and slightly longer silence windows.
- Usually allows a lower speech threshold.
- Start from the
wired_headsetpreset. - Half-duplex can often be disabled if the playback path is isolated enough.
- Run synthetic fixtures.
- Confirm keyboard noise never crosses
speechThreshold. - Confirm long utterance opens speech reliably.
- Confirm interruption timing requests barge-in quickly while agent output is active.
| Profile | speechThreshold | noiseFloorThreshold | debounceMs | minSpeechMs | silenceMs |
|---|---|---|---|---|---|
laptop_speakers |
0.64 | 0.22 | 90 | 140 | 520 |
wired_headset |
0.50 | 0.14 | 70 | 110 | 420 |
quiet_room |
0.44 | 0.10 | 60 | 100 | 380 |
Use BargeKit as the microphone/turn-taking layer and let VoicePath own output playback.
Suggested hooks:
bargekit.output.duck_requested-> lower output gain immediatelybargekit.output.cancel_requested-> stop or interrupt current speech turnbargekit.user_speech.started-> stop queued agent speech if policy prefers user-first turnsbargekit.user_speech.ended-> decide whether to resume or regenerate output
createOutputDuckingController() helps avoid resuming stale output tokens after an interruption.
createAgentPulseBridge() maps core events into a reducer-friendly stream:
user.speech.starteduser.speech.endedinput.mutedinput.noise_gatedbarge_in.requestedinput.half_duplex_hold
reduceAgentGlowState() turns those events into a minimal visual state model for listening / speaking / interrupted indicators.
- keep processing local
- require explicit microphone opt-in
- expose mute and half-duplex truthfully in the UI
- use interruption hooks, not magical echo-cancellation claims
- document known limitations instead of hiding them