How rhythmicdias/dictateanywhere works
Purpose and Runtime
DictateAnywhere is a Windows desktop voice-dictation application. It captures microphone audio, transcribes it locally or through cloud providers, transforms the resulting text, and injects it into the currently focused native application. The primary runtime is Python; UI is Tkinter/pystray with Windows integration. A separate Tauri/React surface exists, likely for a floating-widget frontend.
Entry points are src/dictateanywhere/__main__.py and the application orchestrator src/dictateanywhere/main.py. The Tauri frontend entry is src/main.tsx, backed by src-tauri/src/lib.rs.
Application Orchestration and Interaction
main.py coordinates lifecycle, recording state, engine selection, UI state updates, history, text processing, and injection. Users start/stop dictation through a global hotkey, tray commands, or the floating microphone widget.
• src/dictateanywhere/main.py
• src/dictateanywhere/core/hotkey_manager.py
• src/dictateanywhere/ui/tray.py
• src/dictateanywhere/ui/floating_widget.py
Audio Capture and Speech Boundary
Microphone capture produces audio frames and RMS-level callbacks for the preview meter. Voice activity detection filters silence and supports auto-stop behavior; timed capture enforces recording limits. Audio then crosses a provider boundary into the selected transcription engine.
• src/dictateanywhere/audio/capture.py
• src/dictateanywhere/audio/vad.py
• src/dictateanywhere/transcription/engine.py
Transcription Providers
A shared engine abstraction isolates STT backends. Local transcription uses faster-whisper and can run CPU or CUDA/CTranslate2. Cloud/provider implementations include Azure Speech, Google Gemini, and Sarvam, with Sarvam supporting WebSocket streaming. Engine mode/config determines local, cloud, hybrid, Gemini, or Sarvam routing/fallback behavior.
• src/dictateanywhere/transcription/engine.py
• src/dictateanywhere/transcription/local_engine.py
• src/dictateanywhere/transcription/cloud_engine.py
• src/dictateanywhere/transcription/gemini_engine.py
• src/dictateanywhere/transcription/sarvam_engine.py
External services: Azure Speech, Google Gemini, Sarvam AI, and optionally local Ollama for post-transcription LLM processing.
Text Processing and Delivery Pipeline
Final transcript processing applies spoken-punctuation conversion, capitalization, ordered user correction rules, and optional LLM polishing/custom prompts. The processed result is shown in the preview/history and delivered to the active Windows text field through clipboard paste or SendInput. This is the key boundary between application-managed text and arbitrary target applications.
• src/dictateanywhere/core/punctuation.py
• src/dictateanywhere/core/corrections.py
• src/dictateanywhere/core/polish.py
• src/dictateanywhere/core/text_injector.py
Desktop UI and State Feedback
The tray is the persistent control surface; Tkinter windows provide settings, session history, and live transcription preview. The preview receives listening/transcript/level updates, while the floating widget represents recording state and countdown. Session history is in-memory for the process lifetime.
• src/dictateanywhere/ui/tray.py
• src/dictateanywhere/ui/preview_window.py
• src/dictateanywhere/ui/settings_window.py
• src/dictateanywhere/ui/history_window.py
Persistence, Secrets, and Updates
Non-secret preferences, UI positions, engine selection, and update state are persisted under %APPDATA%\DictateAnywhere; correction rules are separately persisted. API keys are delegated to Windows Credential Manager/DPAPI rather than plaintext configuration. The updater checks GitHub Releases with daily/version suppression logic.
• src/dictateanywhere/utils/config.py
• src/dictateanywhere/utils/secure_storage.py
• src/dictateanywhere/core/updater.py
Packaging and Native Sidecar
Windows scripts create environments, install dependencies, run development/release modes, and build a standalone PyInstaller executable. GitHub Actions handles release automation. The Tauri crate exposes sidecar command support, suggesting an optional native shell/frontend integration around the Python application.
• scripts/build.bat
• .github/workflows/release.yml
• src-tauri/src/commands/sidecar.rs
• src/windows/FloatingWidget/FloatingWidget.tsx
Main entry points: main.py Application orchestrator · engine.py Transcription engine · capture.py Microphone capture · polish.py Text processing
Components 20
Python Desktop Runtime
Windows dictation application and control surfaces.
- Python entry point
src/dictateanywhere/__main__.py - Application orchestrator · Coordinates recording, engine selection, state, history, and delivery.
src/dictateanywhere/main.py - Global hotkeys
src/dictateanywhere/core/hotkey_manager.py - System tray
src/dictateanywhere/ui/tray.py - Preview window · Shows listening state, audio level, and transcript updates.
src/dictateanywhere/ui/preview_window.py - Settings & history windows · Settings and process-lifetime session history.
src/dictateanywhere/ui/history_window.py
Audio & Transcription
Capture pipeline and selectable speech providers.
- Microphone capture · Emits audio frames and RMS-level callbacks.
src/dictateanywhere/audio/capture.py - Voice activity detection · Filters silence and supports auto-stop.
src/dictateanywhere/audio/vad.py - Transcription engine · Selects local, cloud, hybrid, Gemini, or Sarvam routing.
src/dictateanywhere/transcription/engine.py - Local faster-whisper · Runs with CPU or CUDA/CTranslate2.
src/dictateanywhere/transcription/local_engine.py - Azure cloud STT
src/dictateanywhere/transcription/cloud_engine.py - Google Gemini
src/dictateanywhere/transcription/gemini_engine.py - Sarvam AI · Supports WebSocket streaming.
src/dictateanywhere/transcription/sarvam_engine.py
Text Delivery
Transcript transformation and native-app delivery.
- Text processing · Applies punctuation, capitalization, corrections, and optional LLM polish.
src/dictateanywhere/core/polish.py - Native text injector · Pastes through clipboard or injects with SendInput into the focused application.
src/dictateanywhere/core/text_injector.py
Persistence & Updates
Local preferences, secrets, and release checks.
- AppData preferences · Stores preferences, positions, engine selection, corrections, and update state.
src/dictateanywhere/utils/config.py - Windows credential storage · Uses Credential Manager and DPAPI for API keys.
src/dictateanywhere/utils/secure_storage.py - Release updater · Checks GitHub Releases with daily and version suppression.
src/dictateanywhere/core/updater.py
Optional Tauri Surface
Native shell and React floating-widget integration.
- Tauri sidecar shell · Exposes commands for Python sidecar integration.
src-tauri/src/commands/sidecar.rs - Floating microphone widget · Represents recording state and countdown.
src/windows/FloatingWidget/FloatingWidget.tsx
Connections 20
- Python entry point → Application orchestrator: starts
- Global hotkeys → Application orchestrator: start/stop commands
- System tray → Application orchestrator: commands
- Application orchestrator → Microphone capture: controls recording
- Microphone capture → Voice activity detection: audio frames
- Microphone capture → Preview window: RMS levels
- Voice activity detection → Transcription engine: speech audio
- Transcription engine → Local faster-whisper: local mode
- Transcription engine → Azure cloud STT: cloud mode
- Transcription engine → Google Gemini: Gemini mode
- Transcription engine → Sarvam AI: Sarvam mode
- Transcription engine → Text processing: transcript
- Text processing → Native text injector: processed text
- Text processing → Preview window: transcript updates
- Application orchestrator → Settings & history windows: state and history
- Application orchestrator → AppData preferences: loads and saves preferences
- Application orchestrator → Windows credential storage: retrieves provider keys
- Application orchestrator → Release updater: checks updates
- Floating microphone widget → Application orchestrator: recording controls
- Tauri sidecar shell → Floating microphone widget: hosts frontend