How sitelift/chirp works
1. Overall shape
- Chirp is a desktop voice-to-text app built as a Tauri 2 shell: React/TypeScript frontend for UI and Rust backend for all OS- and audio-sensitive work.
- There is no remote backend in the runtime path. The core user journey is fully local and offline after model download.
2. Primary runtime boundary
- The frontend owns screens, overlays, onboarding, settings, and user interaction.
- The Rust backend owns system hotkeys, audio capture, transcription, text cleanup, text injection, persistence, and model/runtime integration.
- Communication crosses the Tauri command/event boundary; the UI reacts to backend state rather than controlling OS devices directly.
3. User interaction flow
- A global hotkey starts or stops recording.
- The app shows a small overlay with states such as listening, processing, polishing, done, or error.
- The result is inserted at the current cursor position in whatever app is focused.
4. Audio + transcription pipeline
- Audio capture is handled natively in Rust using cpal.
- The speech model is NVIDIA Parakeet TDT running through sherpa-onnx.
- This is the first major processing stage: microphone audio becomes raw transcript text.
5. Cleanup / “polishing” stage
- After transcription, Chirp can pass text through a local LLM for cleanup: filler-word removal, punctuation, grammar, and formatting.
- The README says this uses llama-server locally.
- This stage is optional/feature-driven and sits after ASR, before insertion.
6. Text output to other apps
- Final text is inserted via enigo using clipboard and keystroke simulation.
- This is an important architectural boundary: Chirp does not “integrate” with target apps; it emulates user input into the active window.
7. Persistence and user data
- The backend modules for settings, history, snippets, dictionary, and feedback indicate local app state is persisted and reused across sessions.
- The frontend settings pages are essentially a view/editor over backend-managed state, including hotkey configuration, vocabulary entries, saved snippets, and transcription history.
8. Onboarding and model acquisition
- First launch includes onboarding steps such as permissions, model download, and optional help-improve flows.
- The app expects a large speech model download on first run; after that, it runs offline.
- The frontend has dedicated onboarding components, while the backend likely manages the actual download/state transitions.
9. Platform-specific native layer
- The Rust side is split into modules such as hotkey, native_hotkey, audio, inject, and transcribe, suggesting clear OS integration boundaries.
- The repo includes separate Tauri configs and entitlements for Windows and macOS, plus platform assets/icons and an installer wrapper.
10. Frontend structure
- src/App.tsx and src/main.tsx bootstrap the React app.
- UI is organized into:
- onboarding
- overlay
- settings
- shared UI components
- A central store (src/stores/appStore.ts) and hooks (useSettingsSync, useRecording, useTauri, etc.) connect UI state to backend events.
11. Assets and offline bundles
- Sounds, brand assets, and model-related files are checked in or packaged alongside the app.
- The src-tauri/sherpa-onnx-lib directory contains the native library interface needed for speech runtime integration.
- The installer assets under src-tauri/installer show that packaging is part of the repo’s deliverable, not an external concern.
12. Non-runtime subsystems
- training/ is a separate offline ML pipeline for generating and tuning cleanup models and exporting ONNX/GGUF artifacts.
- scripts/ contains benchmark and release tooling.
- These directories support model development and release engineering, but they are not in the normal end-user execution path.
13. What to draw in an architecture diagram
- A good diagram should center on:
- Keyboard hotkey → Rust backend
- Microphone audio capture → ASR model
- Transcript → optional LLM cleanup
- Final text → injection into active app
- Backend state → React UI overlay/settings
- Surround that with local persisted data, model assets, and platform-specific native integrations.
Main entry points: state.rs Backend State · App.tsx App Shell · transcribe.rs ASR Pipeline · cleanup.rs Cleanup
Components 26
React UI
Screens, overlays, and settings in the Tauri frontend.
- App Shell · Entry points that mount the UI and wire global app state.
src/App.tsx - Onboarding · First-run setup for permissions, downloads, and help-improve choices.
src/components/onboarding/Onboarding.tsx - Overlay · Recording/status overlay with listening, processing, polishing, done, and error states.
src/components/overlay/Overlay.tsx - Settings · Settings pages for hotkeys, dictionary, snippets, history, and preferences.
src/components/settings/Settings.tsx - App Store · Central frontend state shared by overlay, onboarding, and settings.
src/stores/appStore.ts - UI Hooks · React hooks that synchronize recording, settings, Tauri events, and cleanup toggles.
src/hooks/useTauri.ts
Rust Core
Local runtime logic, OS integration, transcription, persistence, and injection.
- Tauri Commands · Command and event boundary between the frontend and Rust backend.
src-tauri/src/commands.rs - Backend State · Shared local state for app lifecycle, device status, and feature flags.
src-tauri/src/state.rs - Hotkey · Registers and handles the global record toggle shortcut.
src-tauri/src/hotkey.rs - Audio Capture · Native microphone capture and buffering using the host audio stack.
src-tauri/src/audio.rs - ASR Pipeline · Runs Parakeet TDT via sherpa-onnx to convert audio into transcript text.
src-tauri/src/transcribe.rs - Cleanup · Optional text polishing: punctuation, formatting, and filler-word removal.
src-tauri/src/cleanup.rs - Llama Server · Local server/runtime used for cleanup and polishing generation.
src-tauri/src/llm.rs - Text Inject · Inserts final text into the active app using clipboard and keystroke simulation.
src-tauri/src/inject.rs - Settings Data · Stored preferences, hotkeys, and user-facing configuration.
src-tauri/src/settings.rs - History · Saved transcription history reused across sessions.
src-tauri/src/history.rs - Snippets · Reusable text snippets maintained locally.
src-tauri/src/snippets.rs - Dictionary · Custom vocabulary and word normalization data.
src-tauri/src/dictionary.rs - Feedback · Stored user feedback and improve-the-model signals.
src-tauri/src/feedback.rs
Platform Layer
Native packaging and OS-specific configuration.
- Native Hotkey · Platform-specific hotkey plumbing behind the shared shortcut layer.
src-tauri/src/native_hotkey.rs - Tauri Config · Desktop shell configuration, capabilities, and platform entitlements.
src-tauri/tauri.conf.json - Installer Assets · Installer wrapper and platform branding assets used for distribution.
src-tauri/installer/chirp-header.bmp
Offline Assets
Bundled models, sounds, and training/release tooling.
- Sherpa Lib · Bundled sherpa-onnx native interface for speech runtime integration.
src-tauri/sherpa-onnx-lib/include/sherpa-onnx/c-api/c-api.h - Models & Sounds · Offline speech and audio assets, including packaged sounds and model files.
public/sounds/chirp.mp3 - Training Pipeline · Model data prep, training, export, and benchmarking for cleanup models.
training/train.py - Release Tools · Benchmarking, model download, pruning, and release automation.
scripts/release.sh
Connections 27
- App Shell → App Store: reads/writes · Root UI state flows through the shared store.
- App Shell → Onboarding: renders · First-run and setup screens are mounted from the app shell.
- App Shell → Overlay: renders · Recording status overlay is part of the main UI shell.
- App Shell → Settings: renders · Settings pages are mounted from the main shell.
- UI Hooks → Tauri Commands: calls · Hooks bridge UI actions into backend commands and events.
- Overlay → App Store: subscribes · Overlay reflects backend-driven app state.
- Settings → App Store: edits · Settings UI reads and updates shared state.
- Tauri Commands → Backend State: routes through · Commands operate on shared backend state.
- Hotkey → Native Hotkey: delegates · Shared hotkey handling is backed by native OS integration.
- Hotkey → Audio Capture: starts/stops · Global shortcut controls microphone capture.
- Audio Capture → ASR Pipeline: feeds · Captured microphone audio is passed into ASR.
- ASR Pipeline → Cleanup: optional handoff · Transcript text can be sent to polishing.
- Cleanup → Llama Server: uses · Cleanup stage runs through the local LLM runtime.
- Cleanup → Text Inject: outputs · Polished text is prepared for insertion.
- ASR Pipeline → Text Inject: outputs · Raw transcript can be inserted directly when cleanup is skipped.
- Text Inject → Backend State: updates · Injection and recording outcomes are reflected in backend state.
- Settings Data → Backend State: persists · Persistent settings are loaded into runtime state.
- History → Backend State: persists · Saved transcript history is managed by backend state.
- Snippets → Backend State: persists · Snippet storage is exposed through backend state.
- Dictionary → Backend State: persists · Vocabulary data is managed locally by the backend.
- Feedback → Backend State: persists · Feedback and improve-improve signals are stored locally.
- Onboarding → Models & Sounds: downloads/prepares · Onboarding includes model acquisition and readiness steps.
- Tauri Config → Tauri Commands: enables · Desktop capability and platform configuration gate the runtime bridge.
- Installer Assets → Tauri Config: packages · Installer assets participate in desktop distribution.
- ASR Pipeline → Sherpa Lib: binds to · ASR runtime depends on the bundled sherpa-onnx interface.
- Release Tools → Training Pipeline: supports · Release and benchmark tools support the offline model pipeline.
- Training Pipeline → Models & Sounds: produces · Training/export pipeline produces model artifacts used by the app.