How alexalkhatib/realtime-voice-translator works
Real-Time AI Voice Translator captures browser speech or replays a demo conversation, sends recognized segments to FastAPI for validation and translation, then displays and optionally speaks the result. The server supports Google, MyMemory, and offline demo translation, optional Gemini refinement, Google TTS, latency metrics, and cached results; the browser also offers REST fallback, transcript exports, and browser speech synthesis. Edges follow the excerpts, SOURCE INDEX references, and README; some detailed route and fallback internals were not sampled.
Main entry points: pipeline.py Translation pipeline · registry.py Provider assembly · app.js Session controller · main.py FastAPI routes
Components 25
Browser experience
- Session interface
web/index.html - Session controller
web/js/app.js - Speech recognition
web/js/speech.js - Demo conversation
web/js/demo.js - Transport client
web/js/api.js - Audio playback
web/js/audio.js
API and orchestration
- FastAPI routes
app/main.py - Translation pipeline
app/pipeline.py - Provider assembly
app/providers/registry.py
Translation and speech engines
- Provider contracts
app/providers/base.py - Google translation
app/providers/google.py - Google speech synthesis
app/providers/google.py - MyMemory translation
app/providers/mymemory.py - Offline translations
app/providers/demo.py - Gemini refinement
app/providers/gemini.py
Shared domain services
- Runtime settings
app/config.py - Language catalog
app/languages.py - Request and response schemas
app/schemas.py - Text utilities
app/text.py - Latency metrics
app/metrics.py
Other components
- Translator
- Browser speech APIs
- Google Cloud
- MyMemory service
- Gemini service
Connections 32
- Translator → Session interface: uses
README.md - Session interface → Session controller: hosts
README.md - Session controller → Speech recognition: starts recognition
web/js/app.js - Session controller → Demo conversation: replays
web/js/app.js - Speech recognition → Browser speech APIs: recognizes speech
README.md - Session controller → Transport client: requests translation
web/js/app.js - Transport client → FastAPI routes: sends WebSocket or REST
README.md - FastAPI routes → Translation pipeline: dispatches requests
README.md - FastAPI routes → Request and response schemas: validates requests
app/main.py - FastAPI routes → Language catalog: serves language config
app/main.py - FastAPI routes → Provider assembly: builds pipeline
app/main.py - Provider assembly → Runtime settings: configures engines
app/providers/registry.py - Provider assembly → Google translation: registers
app/providers/registry.py - Provider assembly → Google speech synthesis: registers
app/providers/registry.py - Provider assembly → MyMemory translation: registers
app/providers/registry.py - Provider assembly → Offline translations: registers
app/providers/registry.py - Provider assembly → Gemini refinement: configures optional refiner
app/providers/registry.py - Translation pipeline → Provider contracts: uses contracts
app/pipeline.py - Translation pipeline → Language catalog: resolves languages
app/pipeline.py - Translation pipeline → Text utilities: cleans text
app/pipeline.py - Translation pipeline → Latency metrics: records latency
app/pipeline.py - Translation pipeline → Google translation: tries translation
- Translation pipeline → MyMemory translation: falls back to
README.md - Translation pipeline → Offline translations: falls back to
README.md - Translation pipeline → Gemini refinement: optionally refines
README.md - Translation pipeline → Google speech synthesis: optionally synthesizes
README.md - Google translation → Google Cloud: calls
- Google speech synthesis → Google Cloud: calls
- MyMemory translation → MyMemory service: calls
README.md - Gemini refinement → Gemini service: calls
- Session controller → Audio playback: plays result
web/js/app.js - Audio playback → Browser speech APIs: speaks fallback
README.md