Whisper Dictation is a hotkey-driven desktop dictation tool that records short bursts of audio, transcribes them with OpenAI Whisper, and types the recognized text into whichever application currently has focus.
- Quick toggle (Ctrl+Alt+Space) to record speech and insert the transcription in place
- Automatic Whisper model loading/unloading to conserve GPU memory when idle
- Device selection prompt so you pick the correct microphone at startup
- Audible start/stop beeps to confirm recording state
- Logging of every recording session to
recording_log.txt
- Python 3.9 or newer
- PortAudio runtime (needed by PyAudio). On Windows install the PyAudio wheels, on macOS use
brew install portaudio, on Linux use your package manager.
Simply run the appropriate script for your operating system:
Windows:
start.batmacOS/Linux:
./start.shThese scripts will automatically:
- Check for Python 3.9+ installation
- Create a virtual environment
- Install all required dependencies
- Start the dictation application
If you prefer to install manually:
-
Create and activate a virtual environment (recommended):
python -m venv venv # Windows: venv\Scripts\activate # macOS/Linux: source venv/bin/activate
-
Install Python dependencies:
pip install -r requirements.txt
Or install individually:
pip install openai-whisper torch pyaudio pyautogui keyboard numpy simpleaudio pyperclip
-
Optional: place any Whisper GGML models inside the
models/directory for future experiments. The current Python workflow downloads models automatically through thewhisperpackage.
The installation scripts automatically install CUDA-enabled PyTorch for GPU acceleration. If CUDA installation fails, the scripts will fall back to CPU-only PyTorch.
Requirements for GPU acceleration:
- NVIDIA GPU with CUDA support
- CUDA 11.8+ drivers installed
- Compatible PyTorch version (automatically installed)
If you need a different CUDA version, visit pytorch.org for your specific setup.
Option 1 - Using the installation scripts (recommended):
# Windows
start.bat
# macOS/Linux
./start.shOption 2 - Manual start:
python dictation.py- Choose the input device index when prompted. The script lists every available capture device that exposes input channels.
- Press
Ctrl+Alt+Spaceto begin a recording. A high-pitched beep confirms recording has started. - Press the hotkey again to stop. A lower beep plays, the audio is transcribed with the Whisper
tiny.enmodel, and the resulting text is typed into the active window. - Repeat as needed. Press
Shift+Escto quit the script entirely.
While the script is idle for more than 15 seconds, the Whisper model is automatically unloaded and GPU memory reclaimed. The next recording triggers a reload.
- Model size: change the argument to
whisper.load_model()indictation.pyto use larger or multilingual models (requires more VRAM/CPU). - Hotkey: adjust the binding in the
keyboard.add_hotkey()call. - Beep tones: update the frequency values in
play_beep()if you prefer different confirmation sounds. - Filtering: tweak the string cleanup logic in
process_audio()if you want to block specific words or punctuation.
Session events (start/stop timestamps) are appended to recording_log.txt. Keep the file around for auditing, or rotate it manually if it grows too large.
dictation.py– main dictation workflow that captures audio, transcribes with Whisper, and simulates keyboard entry.start.bat– Windows installation and startup script.start.sh– Unix/Linux/macOS installation and startup script.requirements.txt– Python dependencies list for easy installation.models/– local store for quantised Whisper models (not used directly by the Python script yet).recorded_audio.wav– sample recording for testing.recording_log.txt– rolling log file written by the dictation script.
- PyAudio installation fails:
- Windows: Install Microsoft Visual C++ Build Tools or try
pip install --only-binary=all pyaudio - macOS:
brew install portaudiothen retry - Linux:
sudo apt-get install portaudio19-dev python3-pyaudio(Ubuntu/Debian) or equivalent for your distro
- Windows: Install Microsoft Visual C++ Build Tools or try
- Permission denied on start.sh: Run
chmod +x start.shto make the script executable - Python not found: Ensure Python 3.9+ is installed and in your system PATH
- No text appears: confirm the target window accepts keyboard input and that accessibility permissions are granted (macOS requires enabling accessibility for the terminal/Python process).
- Hotkey not firing: some virtual desktops intercept complex hotkeys; change the key combo in
dictation.pyif needed. - Audio glitches: lower the buffer size or sample rate in
record_audio()or verify the microphone is not used by other apps. - CUDA out of memory: edit
whisper.load_model()to use a smaller model or rely on CPU inference.
- Persistent settings file for input device selection and hotkeys
- Live streaming transcription instead of post-stop processing
- UI overlay showing recording status and last transcript
- Integration with the local GGML models stored in
models/
If the tool is helpful, consider supporting it on Ko-fi.