How yassdev212/realtime_audio_transcription works
Purpose and Entry Points
This is a Windows-local real-time meeting transcription system: it captures system speaker audio, transcribes it on CUDA, displays live text in a transparent HUD, and persists finalized utterances for logs, search, and optional summaries.
Primary entry points:
• Live application: main.py
• Audio capture/preprocessing: audio.py
• Transcription/VAD worker: engine.py
• Semantic-search CLI: search.py
• Summary CLI and exit-time summary generation: summarizer.py
Runtime and Platform Boundary
The core runtime is Python on Windows. Audio capture depends on WASAPI loopback via PyAudioWPatch; the UI is a PyQt6 overlay with Win32 click-through behavior. GPU inference uses faster-whisper/CTranslate2 with NVIDIA CUDA. Core transcription, SQLite logging, and vector search are local; Groq is only an optional external LLM dependency.
Relevant paths: main.py, audio.py, engine.py, overlay.py.
Live Audio-to-Text Pipeline
main.py orchestrates a session and connects the capture, worker, UI, and persistence layers. audio.py captures Windows speaker output into an audio queue. The worker pipeline in engine.py downmixes stereo, resamples 48 kHz audio to Whisper’s 16 kHz input, converts PCM to float32, and processes accumulated speech segments.
The first VAD layer is an RMS-energy/pause gate that determines when to flush a phrase; faster-whisper’s built-in Silero VAD provides a second noise/speech filter before inference. This separates low-latency stream control from model-level speech cleanup.
Paths: main.py, audio.py, engine.py.
Transcription and HUD State Flow
engine.py runs the local base.en faster-whisper model through CTranslate2/CUDA. It emits interim/draft words while speech is active and a finalized transcript after a pause. Qt signals bridge the worker thread to the GUI thread, preventing transcription and audio work from blocking rendering.
overlay.py renders draft text differently from confirmed text, uses a borderless semi-transparent HUD, passes mouse input through to underlying Windows applications, and clears inactive content after silence.
Paths: engine.py, overlay.py, main.py.
Persistent Transcript and Vector Index
Finalized transcript segments are dual-written by the persistence layer: SQLite is the chronological, session-oriented source for exports and summaries; ChromaDB stores embeddings for semantic retrieval. database.py is the storage boundary shared by the live pipeline, summary workflow, and search workflow.
This split is intentional: relational session history supports deterministic transcript assembly, while ChromaDB supports meaning-based queries across past meeting content.
Paths: database.py, engine.py, search.py.
Search and Optional RAG
search.py is an independent CLI over the local ChromaDB index. It uses sentence-transformers to embed queries and retrieve semantically similar transcript chunks without network access. In --ask mode, retrieved context is passed to an LLM for synthesized answers; this introduces the optional Groq API boundary and requires GROQ_API_KEY.
Paths: search.py, database.py, summarizer.py.
Session Finalization and Summaries
On Ctrl+C/application shutdown, main.py cleanly terminates the live pipeline and retrieves the session transcript from SQLite. summarizer.py can then produce a raw export or, when configured, call Groq to generate an executive meeting report under summaries/. It also serves as a standalone CLI for recent or named sessions.
Paths: main.py, summarizer.py, database.py.
Supporting Evaluation
benchmark.py appears to support transcription-performance or quality evaluation, separate from the production audio/HUD path. Design rationale and benchmark history are documented in documentation.md; demonstration media resides in assets/demo2.png.
Paths: benchmark.py, documentation.md, assets/demo2.png.
Main entry points: engine.py Transcription worker · summarizer.py Summary CLI · database.py Persistence boundary · main.py Live app
Components 17
Live transcription
Windows-local capture, inference, and HUD.
- Live app · Orchestrates a transcription session and shutdown.
main.py - WASAPI capture · Captures Windows speaker loopback audio.
audio.py - Audio queue
audio.py - Transcription worker · Processes buffered audio and emits draft and final text.
engine.py - RMS pause gate · Flushes accumulated phrases after pauses.
engine.py - Whisper audio prep · Downmixes, resamples 48 kHz to 16 kHz, and converts PCM.
engine.py - faster-whisper CUDA · Runs base.en with Silero VAD through CTranslate2/CUDA.
engine.py - Qt signal bridge · Moves worker updates safely to the GUI thread.
engine.py - Transparent HUD · Shows draft and confirmed text with Win32 click-through.
overlay.py
Local persistence
Session history and semantic retrieval stores.
- Persistence boundary · Dual-writes finalized transcript segments.
database.py - SQLite session history · Chronological source for exports and summaries.
database.py - ChromaDB index · Semantic retrieval across transcript chunks.
database.py
CLI workflows
Search and session-finalization tools.
- Search CLI · Queries locally indexed meeting content.
search.py - Sentence-transformers · Embeds semantic-search queries locally.
search.py - Summary CLI · Exports or summarizes named and recent sessions.
summarizer.py - Groq API · Synthesizes RAG answers and executive reports when configured.
summarizer.py - Summary files · Generated executive reports are written here.
summarizer.py
Connections 19
- Live app → WASAPI capture: starts capture
- WASAPI capture → Audio queue: speaker PCM
- Audio queue → Transcription worker: audio chunks
- Transcription worker → RMS pause gate: accumulated stream
- RMS pause gate → Whisper audio prep: speech phrase
- Whisper audio prep → faster-whisper CUDA: 16 kHz float32
- faster-whisper CUDA → Transcription worker: draft and final text
- Transcription worker → Qt signal bridge: worker updates
- Qt signal bridge → Transparent HUD: GUI-thread text state
- Transcription worker → Persistence boundary: finalized segments
- Persistence boundary → SQLite session history: session rows
- Persistence boundary → ChromaDB index: embedded chunks
- Live app → Summary CLI: shutdown finalization
- Summary CLI → SQLite session history: loads session transcript
- Summary CLI → Groq API: optional report prompt
- Summary CLI → Summary files: writes report
- Search CLI → Sentence-transformers: embeds query
- Sentence-transformers → ChromaDB index: semantic query
- Search CLI → Groq API: --ask context synthesis