A simple application that records your microphone, transcribes the audio using Mistral AI's transcription API, and types the resulting text into your active window.
- Push-To-Talk (PTT): Record only when a specific key is held.
- System Tray Icon: Easy access to Mute/Unmute and Quit.
- Pluggable Output, Transcription & Notification Methods: Automatically detects available tools for typing, transcription, and system notifications.
- Python 3.x
- PortAudio (required for
sounddevice, e.g.,sudo apt install libportaudio2) xdotool(optional, for automatic typing on Linux/X11)notify-send(optional, for system notifications on Linux)- Mistral API Key (optional, if using Mistral transcription)
- Clone the repository.
- Create and activate a virtual environment:
python3 -m venv .venv source .venv/bin/activate - Install the required Python packages:
pip install -r requirements.txt
Create a .env file in the root directory and add your Mistral AI API key and optionally the model name. You can also provide a comma-separated list of context bias terms to help the transcriber prefer specific words (e.g., product names, acronyms):
MISTRAL_API_KEY=your_api_key_here
MISTRAL_MODEL=voxtral-mini-2602
MISTRAL_CONTEXT_BIAS=Kubernetes,K8s,PostgreSQLMISTRAL_CONTEXT_BIASis optional. When set, Tyrant passes these terms to Mistral as a context bias so the transcript is more likely to include them as spoken. Use a short, focused list; terms are case-sensitive and separated by commas.
Run the application:
python src/main.pyOptions:
-v,--verbose: Enable verbose logging.--ptt KEY: Use push-to-talk with the specified key (e.g.,ctrl,shift,caps_lock).
When running, a tray icon appears showing the current status (Idle, Recording, Transcribing, Muted).
- Right-click the icon to Mute/Unmute or Quit the application.
-
Manual (Default):
- Run
python src/main.py. - Recording starts immediately.
- Press
Ctrl+Cor use the tray menu to stop.
- Run
-
Push-To-Talk (PTT):
- Run
python src/main.py --ptt caps_lock. - The script waits for you to hold the specified key.
- Recording starts when you press the key and stops when you release it.
- Run
The application uses a flexible system for output, transcription, and notifications, defined in src/output.py, src/transcription.py, and src/notification.py. It automatically selects the first available method for each:
- OutputXdotool: Uses
xdotoolto type text. (Requiresxdotoolinstalled). - OutputNoop: A fallback that only logs the transcription if no typing tool is found.
- TranscriptionMistral: Uses Mistral AI's API. (Requires
MISTRAL_API_KEYin.env). - TranscriptionNoop: A fallback that returns a placeholder string if no transcription service is configured.
- NotificationNotifySend: Uses
notify-sendto show system notifications. (Requireslibnotify-binor equivalent). - NotificationNoop: A fallback that only logs notifications if no notification tool is found.
You can easily add new methods by inheriting from the Output, Transcription, or Notification base classes and implementing the required interface (is_available() and type(text), transcribe(file_path), or notify(title, message)).
- Ensure you have a window focused where you want the text to appear before the transcription finishes (if using
xdotool).
This project is licensed under the MIT License - see the LICENSE file for details.