Open-Source High-Performance AI Voice Dictation for Linux
Voice dictation on Linux has historically been slow, clunky, or complex. Speech2AI is an open-source, ultra-optimized dictation utility designed specifically for X11 Linux desktop environments like Linux Mint (Cinnamon). It lets you dictate text directly into any active window or input field with zero lag.
Built with a modern client-daemon architecture and HTTP connection pooling, Speech2AI achieves warm-start response times under 20ms, bypassing the high startup overhead typical of python-based audio applications.
Under the Hood: Socket-Daemon Architecture
To achieve instant responsiveness, Speech2AI splits execution into two optimized components:
Persistent Daemon (tray.py)
Runs quietly in the system tray, pre-loading heavy UI packages (CustomTkinter) and audio libraries (SoundDevice) in memory. It hosts a local UNIX socket server at /tmp/speech2ai.sock.
Hotkey Client (trigger.py)
A lightweight, low-footprint client bound to system hotkeys. When pressed, it sends a socket trigger to the daemon in under 20ms and immediately exits, leaving the daemon to handle the overlay.
Architectural Optimizations for Speed
-
Preloaded Warm UI: The floating HUD visualizer is created at startup and hidden (
withdraw). When triggered, it positions itself and shows instantly (deiconify), avoiding window manager mapping lag. -
HTTP Connection Pooling: The daemon maintains a persistent HTTP connection pool (using
requests.Session) with Keep-Alive to Gemini and Groq endpoints. This removes the repeated TCP/TLS handshake overhead, saving 150ms to 300ms per request. -
Context-Aware Highlight & Dictate: Highlight code or text on screen before dictating. Speech2AI captures the selection via clipboard emulation, splitting your verbal request from the context to execute targeted rewrites, summaries, or code refactors.
Settings GUI & Local Gemma/Ollama Integration
Speech2AI comes with a premium settings GUI built with a custom dark "Obsidian" theme and Indigo accents (#6366F1):
- Ollama Local LLM Downloader: Install and manage local models like
gemma:2bdirectly from the GUI. Speech2AI reads Ollama's HTTP stream API to display real-time installation progress bars. - Linux Mint Shortcut Sync: Hotkeys customized in the GUI are automatically synced with Cinnamon's native
dconfkeybindings registry, keeping system shortcuts perfectly aligned. - Custom Ordbog (Vocabulary): Manage a custom
vocabulary.jsonmapping file to ensure technical abbreviations (e.g. æpi ➔ API) are transcribed correctly every time.
Quick Start & Default Keybindings
Install Speech2AI and resolve system dependencies (xclip, xdotool, portaudio) by executing the automated shell installer:
git clone https://github.com/riisager/speech2ai.git cd speech2ai chmod +x install.sh ./install.sh
The application registers the following global keyboard shortcuts by default:
- Direct Dictation: Super + Y (Exact word-for-word voice input)
- AI Dictation (Grammar): Super + Shift + Y (Cleans filler words, corrects grammar, processes highlighted text context)
- AI Prompt (Coding): Super + Ctrl + Y (Converts verbal requests and highlighted code into structured prompts)
Ready to take action?
Get Speech2AI on GitHub