A text-to-speech (TTS) and speech-to-text (STT) desktop application built with Python and tkinter. On Windows it uses SAPI5; on Linux (including Arch) it uses espeak-ng via pyttsx3.
TTSPython turns text into spoken audio and transcribes speech to text entirely offline. It is built around pyttsx3 for TTS: Windows uses SAPI5 (with COM/pywin32 for stable threaded speech), and Linux uses espeak-ng. STT uses faster-whisper on both platforms.
- Speak All / Speak Selected / Stop controls for reading text or a selection.
- Adjustable Rate and Volume sliders.
- Voice selector populated from system voices (SAPI5 on Windows; espeak-ng on Linux).
- Refresh button to detect newly installed voices without restarting.
- Voices button opens OS speech settings on Windows, or shows espeak-ng install guidance on Linux.
- Offline transcription via
faster-whisper(CPU,int8quantization). - Start / Stop recording controls; the transcript is inserted into the editor.
- Optional model unload and auto-unload (with a configurable delay in minutes) to free RAM when STT is idle.
- A mode toggle switches the app between TTS and STT.
- Add the current editor text, add file(s), play the queue, remove the selected item, or clear the queue.
- Displayed as a tree with a color icon per item (π¬ text / π file / π clipboard) and a "Speech Queue" heading.
- Move Up / Move Down reorder items; Loop queue repeats playback; the Delete key removes the selected item.
- The item currently playing is highlighted using the active theme's accent color.
- Watches the clipboard and either Speaks or Queues copied text.
- Auto-Queue option so copied items are queued while speech is already playing.
- Export text to WAV or MP3 using the current voice, rate, and volume settings.
- Export runs in a background thread, so the UI stays responsive; the Export button is disabled until it finishes.
- Dialog with case-sensitive and regex options, plus Find Next / Replace / Replace All.
- 11 themes: Dark, Twilight, Light, High Contrast, Forest, New Vegas, Spiral, Poly, Sunset, Paper, Graphite.
- Choose a theme in Settings β Theme tab.
- All toolbar, file, queue, and STT buttons show color emoji icons (rendered via Pillow/Segoe UI Emoji; falls back to text-only if unavailable).
- Dialog with three tabs:
- Hotkeys: 10 customizable shortcuts with visual key capture.
- Theme: theme preset and Performance Mode.
- Audio: STT input microphone, TTS output device note, STT model unload options and auto-unload delay (minutes).
- Performance Mode lowers UI update frequency and clipboard polling for lower-end machines.
- Reset to Defaults (Hotkeys tab) resets hotkeys and theme preset, Performance Mode, and STT/audio device + unload settings to their defaults.
- Settings persist to
tts_settings.jsonin the script directory (the window size/position is also saved).
- Runs on Windows and Linux (tested with Arch Linux packaging:
espeak-ng,alsa-utils,tk,portaudio). - Linux TTS via espeak-ng; install helpers:
dependencies.sh+requirements.txt.
- New gradient header bar with the title (
TTSPython), version, and mode toggle. - Cohesive modern palettes for all 11 themes.
- Refined
ttkstyling: padded buttons, themed sliders/comboboxes/check/radio/notebook/scrollbars, and hover/active/focus states. - Color emoji icons on all buttons (rendered to bitmaps via Pillow so they are not gray outline glyphs on Windows).
- Themed Search (Find & Replace) and Settings dialogs.
- Windows 10/11 (SAPI5) or Linux with espeak-ng (Arch and other distros).
- Python 3.8β3.13.
Pillowβ renders the color emoji icons (text-only fallback if missing).- For TTS:
pyttsx3(+pywin32on Windows only). - For STT:
faster-whisperandsounddevice(offline transcription, microphone input). - On Linux: system packages
espeak-ng,alsa-utils(aplay),tk, andportaudio(STT mic).
- Prerequisites β Windows 10/11 with SAPI5; Python 3.8β3.13 from python.org (tick Add Python to PATH).
- Clone or extract the repo, then open a terminal in the
TTSPythonfolder:git clone https://github.com/JoshLongmire/TTSPython.git cd TTSPython ./dependencies.bat python TTSPython.py
First run tip: If you see a Windows Defender / SmartScreen warning, choose "More info" β "Run anyway" β the script is a plain Python file, not a signed installer.
- System packages (Arch example):
sudo pacman -S espeak-ng alsa-utils tk portaudio python
- Clone the repo and install Python deps:
git clone https://github.com/JoshLongmire/TTSPython.git cd TTSPython chmod +x dependencies.sh ./dependencies.sh source .venv/bin/activate python TTSPython.py
dependencies.shcreates a.venvand installs fromrequirements.txt(viauvif available, otherwisepip).
python TTSPython.py- Type or paste text into the editor.
- Click Speak All or press
Ctrl+Enterto speak everything. - Select text, then click Speak Selected or press
Ctrl+Shift+Enter. - Click Stop or press
Escto interrupt. - Adjust the voice, rate, and volume as needed.
- Add Current Text: queue the editor content.
- Add File(s): queue one or more text files.
- Play Queue: play queued items sequentially; the active item is highlighted in the theme accent color.
- Remove Selected / Clear Queue: manage the queue.
- Move Up / Move Down: reorder items. Loop queue repeats playback. Press Delete to remove the selected item.
- Enable Monitor Clipboard and choose Speak or Queue.
- With Auto-Queue on, copied items are added to the queue while speech is already playing.
- Click Export Audio or press
Ctrl+E, choose WAV or MP3, and save.
- Switch the mode toggle to STT.
- Click Start Recording and speak into the configured microphone.
- Click Stop Recording to transcribe; the text is inserted into the editor.
- Use Settings β Audio to pick the STT input device and configure model unload behavior.
- Windows: Click Voices to open Speech settings (
ms-settings:speech), install voices, then Refresh. - Linux: Install espeak-ng language data via your package manager (Arch:
sudo pacman -S espeak-ng), then Refresh. - See
ADD_VOICES_GUIDE.mdfor Windows SAPI5 details. - Run
python check_voices.pyto list installed voices.
All hotkeys are customizable in Settings β Hotkeys.
| Action | Default Shortcut |
|---|---|
| Speak All | Ctrl+Enter |
| Speak Selected | Ctrl+Shift+Enter |
| Stop Speaking | Esc |
| Open File | Ctrl+O |
| Save File | Ctrl+S |
| Save As | Ctrl+Shift+S |
| Paste | Ctrl+V |
| Clear | Ctrl+L |
| Find/Replace | Ctrl+F |
| Export Audio | Ctrl+E |
Select a theme in Settings β Theme:
Dark Β· Twilight Β· Light Β· High Contrast Β· Forest Β· New Vegas Β· Spiral Β· Poly Β· Sunset Β· Paper Β· Graphite
Settings are stored in tts_settings.json in the script directory and loaded automatically on startup. The Settings dialog has three tabs:
- Hotkeys: capture and rebind any of the 10 shortcuts.
- Theme: choose a theme preset and toggle Performance Mode.
- Audio: STT input microphone, TTS output device note, and STT model unload / auto-unload delay (minutes).
- Windows: TTS uses SAPI5 (ships with Windows). Click Voices /
ms-settings:speech, then Refresh. - Linux: Install
espeak-ng(and ensureaplayfromalsa-utilsworks). Arch:sudo pacman -S espeak-ng alsa-utils. - Run
python check_voices.pyto list what is installed.
- Some threaded speech operations require
pywin32. Install it with:pip install pywin32 python -m pywin32_postinstall -install
- Confirm
espeak-ng "hello"andaplaywork in a terminal. - Check default ALSA/PipeWire output (or open Sound Output Settings from the Audio tab).
tts_settings.jsonis written to the script directory. Check write permissions there, or run the app from a writable location.
- The engine typically finishes the current sentence before stopping; allow a moment after pressing Stop /
Esc.
- Ensure Monitor Clipboard is enabled and the desired mode (Speak / Queue) is selected.
- Check write permissions and disk space in the target directory; try WAV if MP3 fails.
Released under the MIT License β see the LICENSE file at the repository root.
See CHANGELOG.md for the full version history.
FEATURE_GUIDE.mdβ in-depth feature walkthrough.QUICK_REFERENCE.mdβ quick command and shortcut reference.ADD_VOICES_GUIDE.mdβ installing and managing SAPI5 voices.
