How sanketwork300-hash/voicebridge works
VoiceBridge is a self-hostable real-time speech-to-speech translation engine. Its principal workflow captures audio, streams it to a managed session, recognizes and stabilizes speech, segments it with language-aware context, translates it, and optionally synthesizes ordered speech while returning subtitle and session events. The browser extension is a documented capture-and-playback client; the CLI and adapters support other input/output paths. Pipeline and gateway excerpts are partial, so uncertain internal wiring and unrepresented translation backends are omitted.
Main entry points: pipeline.py Per-session pipeline · gateway/main.py HTTP / WS gateway · cli/main.py CLI workflows · service-worker.js Capture coordinator
Components 23
Clients and capture
- Extension popup
apps/browser-extension/popup/popup.js - Capture coordinator
apps/browser-extension/background/service-worker.js - Tab capture and playback
apps/browser-extension/offscreen/offscreen.js - Subtitle overlay
apps/browser-extension/content/overlay.js - Microphone input
voicebridge/adapters/input/microphone.py - Audio file input
voicebridge/adapters/input/file.py - CLI workflows
voicebridge/apps/cli/main.py
Gateway and sessions
- HTTP / WS gateway
voicebridge/apps/gateway/main.py - WebSocket session handler
voicebridge/protocols/websocket/handler.py - Session manager
voicebridge/core/session/manager.py
Speech pipeline
- Per-session pipeline
voicebridge/core/pipeline/pipeline.py - Audio normalization
voicebridge/core/audio/normalizer.py - Transcript stabilizer
voicebridge/core/transcript/stabilizer.py - Language-aware segmenter
voicebridge/core/segmentation/segmenter.py - Translation context
voicebridge/core/context - TTS scheduler
voicebridge/core/scheduling/tts_scheduler.py
Provider interfaces
- Streaming ASR
voicebridge/providers/asr/whisperlivekit.py - Translation engine interface
voicebridge/providers/base.py - Piper speech synthesis
voicebridge/providers/tts/piper.py
Outputs and metrics
- Audio file output
voicebridge/adapters/output/file.py - Latency and session metrics
voicebridge/core/metrics/metrics.py
Other components
- Operator / speaker
- Browser / API client
Connections 28
- Operator / speaker → Extension popup: starts capture
- Extension popup → Capture coordinator: sends controls
- Capture coordinator → Tab capture and playback: starts capture
- Capture coordinator → Subtitle overlay: controls overlay
- Tab capture and playback → HTTP / WS gateway: streams audio / events
- Tab capture and playback → Subtitle overlay: forwards subtitles
- Operator / speaker → Microphone input: speaks into
- Operator / speaker → Audio file input: provides audio
- CLI workflows → Audio file input: reads audio
- CLI workflows → Session manager: runs translation session
- Browser / API client → HTTP / WS gateway: uses HTTP / WS API
- HTTP / WS gateway → Session manager: creates and manages
- HTTP / WS gateway → WebSocket session handler: handles stream
- WebSocket session handler → Per-session pipeline: pushes audio / controls
- Per-session pipeline → WebSocket session handler: streams events
- Session manager → Per-session pipeline: starts and stops
- Per-session pipeline → Audio normalization: normalizes audio
- Per-session pipeline → Streaming ASR: sends audio / reads events
- Per-session pipeline → Transcript stabilizer: stabilizes transcript
- Per-session pipeline → Language-aware segmenter: segments stable text
- Per-session pipeline → Translation context: uses session context
- Per-session pipeline → Translation engine interface: requests translation
- Per-session pipeline → Piper speech synthesis: requests synthesis
- Per-session pipeline → TTS scheduler: orders speech jobs
- Per-session pipeline → Latency and session metrics: records stage metrics
- CLI workflows → Audio file output: writes WAV
- CLI workflows → Browser / API client: prints subtitles
- HTTP / WS gateway → Browser / API client: serves API and events