How saqlainnnnn/tinyvox works
Purpose and entry points
A Rust workspace for a desktop voice-dictation system: capture audio, transcribe it, optionally clean/validate text, and inject resulting text into the active application. The primary executable is apps/desktop/src/main.rs; apps/desktop/src/bin/tinyvox-dict.rs is a separate dictionary-oriented CLI/binary.
Application orchestration
crates/engine/src/controller.rs is the likely central coordinator for dictation lifecycle and processing decisions. Engine state and observable events are separated into crates/engine/src/state.rs and crates/engine/src/event.rs, with public composition exposed by crates/engine/src/lib.rs.
Port-and-adapter boundary
The engine defines technology-neutral interfaces for its dependencies under crates/engine/src/ports/: audio capture (audio.rs), speech-to-text (stt.rs), cleanup (cleanup.rs), and text injection (injection.rs). This boundary lets the desktop application bind platform/service implementations without coupling controller logic to Windows APIs or particular transcription providers.
Audio and transcription pipeline
Audio acquisition is implemented as a dedicated crate at crates/audio/src/lib.rs. Speech-to-text is supplied by crates/stt-pulse/src/lib.rs, with a standalone transcription example at crates/stt-pulse/examples/transcribe.rs. The primary flow is audio samples/recording → STT transcript → engine-controlled downstream handling.
Transcript cleanup and validation
crates/cleanup/src/pipeline.rs composes transcript transformation stages, while crates/cleanup/src/validation.rs provides a validation boundary. Multiple cleanup backends are present: local/basic behavior in crates/cleanup/src/basic.rs, plus integrations named for Electron, Groq, and Llama in crates/cleanup/src/electron.rs, crates/cleanup/src/groq.rs, and crates/cleanup/src/llama.rs. These represent an important external-service/runtime boundary after transcription and before injection.
Commands, dictionaries, and text output
Voice-command interpretation is isolated in crates/voice-command/src/lib.rs, enabling recognized phrases to become actions rather than emitted prose. Dictionary domain and persistence are separated in crates/engine/src/dictionary.rs and crates/engine/src/dictionary_store.rs; the desktop dictionary binary likely manages this data. Final text delivery is performed through the engine injection port and Windows implementation at crates/win/src/injection.rs.
Platform runtime and infrastructure
The target desktop/platform layer is Windows-focused: crates/win/src/lib.rs groups active-window discovery, credential handling, text injection, and overlay support in foreground.rs, credentials.rs, and overlay.rs. Hotkey and injection examples under crates/win/examples/ indicate OS-level input integration. Rust/Cargo is the material runtime and workspace infrastructure (Cargo.toml); prototypes under prototypes/ are exploratory and outside the primary application path.
Main entry points: controller.rs Dictation controller · main.rs Desktop application · pipeline.rs Cleanup pipeline · lib.rs Pulse STT
Components 20
Desktop entry points
- Desktop application
apps/desktop/src/main.rs - Dictionary CLI · Manages dictionary-oriented workflows.
apps/desktop/src/bin/tinyvox-dict.rs
Engine
- Engine public API
crates/engine/src/lib.rs - Dictation controller · Coordinates dictation lifecycle and processing decisions.
crates/engine/src/controller.rs - Engine state
crates/engine/src/state.rs - Engine events
crates/engine/src/event.rs - Audio capture port
crates/engine/src/ports/audio.rs - Speech-to-text port
crates/engine/src/ports/stt.rs - Cleanup port
crates/engine/src/ports/cleanup.rs - Text injection port
crates/engine/src/ports/injection.rs - Dictionary domain
crates/engine/src/dictionary.rs - Dictionary store
crates/engine/src/dictionary_store.rs
Audio, STT & cleanup
- Audio capture
crates/audio/src/lib.rs - Pulse STT
crates/stt-pulse/src/lib.rs - Cleanup pipeline · Composes local and external cleanup stages with validation.
crates/cleanup/src/pipeline.rs - Cleanup backends · Basic, Electron, Groq, and Llama cleanup implementations.
crates/cleanup/src/groq.rs
Windows platform
- Windows runtime · Provides foreground, credentials, overlay, and OS integration.
crates/win/src/lib.rs - Windows text injection
crates/win/src/injection.rs
Other components
- Cargo workspace
Cargo.toml - Voice commands · Converts recognized phrases into actions.
crates/voice-command/src/lib.rs
Connections 21
- Cargo workspace → Desktop application: builds
- Cargo workspace → Dictionary CLI: builds
- Desktop application → Engine public API: uses
- Engine public API → Dictation controller: exposes
- Dictation controller → Engine state: updates
- Dictation controller → Engine events: emits
- Dictation controller → Audio capture port: captures through
- Dictation controller → Speech-to-text port: transcribes through
- Dictation controller → Cleanup port: cleans through
- Dictation controller → Text injection port: delivers through
- Audio capture → Audio capture port: implements
- Pulse STT → Speech-to-text port: implements
- Cleanup pipeline → Cleanup port: implements
- Cleanup backends → Cleanup pipeline: stages
- Windows text injection → Text injection port: implements
- Windows runtime → Windows text injection: contains
- Pulse STT → Cleanup pipeline: transcript
- Dictation controller → Voice commands: interprets commands
- Dictionary CLI → Dictionary domain: manages
- Dictionary domain → Dictionary store: persists via
- Desktop application → Windows runtime: binds platform services