{"id":18920953,"url":"https://github.com/gnat/text-to-speech-ubuntu","last_synced_at":"2025-09-05T00:31:59.265Z","repository":{"id":44692008,"uuid":"465758118","full_name":"gnat/text-to-speech-ubuntu","owner":"gnat","description":"🙊 Text to speech GUI / TTS on Ubuntu Linux 25.04 24.10 24.04 22.04 22.10 23.04 23.10 . Ideal for speed reading, programming, editing and writing.","archived":false,"fork":false,"pushed_at":"2024-12-21T13:45:18.000Z","size":1514,"stargazers_count":22,"open_issues_count":0,"forks_count":3,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-12-21T14:29:54.848Z","etag":null,"topics":["espeak","espeak-ng","kde","keyboard-shortcuts","plasma6","qt","qt6","speech","tts","ubuntu","ubuntu-mate"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gnat.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-03-03T14:41:28.000Z","updated_at":"2024-12-21T13:45:22.000Z","dependencies_parsed_at":"2024-02-21T04:47:10.117Z","dependency_job_id":null,"html_url":"https://github.com/gnat/text-to-speech-ubuntu","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gnat%2Ftext-to-speech-ubuntu","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gnat%2Ftext-to-speech-ubuntu/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gnat%2Ftext-to-speech-ubuntu/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gnat%2Ftext-to-speech-ubuntu/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gnat","download_url":"https://codeload.github.com/gnat/text-to-speech-ubuntu/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":232010351,"owners_count":18459859,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["espeak","espeak-ng","kde","keyboard-shortcuts","plasma6","qt","qt6","speech","tts","ubuntu","ubuntu-mate"],"created_at":"2024-11-08T10:44:52.759Z","updated_at":"2024-12-31T16:50:10.434Z","avatar_url":"https://github.com/gnat.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Text to Speech (TTS) GUI for Linux / Ubuntu / Kubuntu\n\n![image](https://github.com/user-attachments/assets/42784801-a81f-4d81-9b5c-7a98eae66c5c)\n\n\n## 🎁 Installation\n1. Download [tts.py](https://raw.githubusercontent.com/gnat/text-to-speech-ubuntu/refs/heads/main/tts.py) to your Desktop.\n2. Install dependencies: `sudo apt install espeak python3-pyqt6`\n3. Make runnable: `cd ~/Desktop; chmod +x ./tts.py`\n4. Create `tts.desktop`\n```ini\n#!/usr/bin/env xdg-open\n[Desktop Entry]\nName=Text To Speech (espeak)\nExec=/usr/bin/python3 /home/$USER/Desktop/tts.py\nIcon=audio-on\nTerminal=false\nType=Application\nCategories=Utility;\n```\n\nShort and sweet single Python script. Built in Qt 6. Supports both Wayland and X11\n\n\u003cbr\u003e\u003cbr\u003e\n\n----\n\n# 🪦 Old Method (Deprecated)\n\n**Below is deprecated because Wayland has no support for retrieving selected text.**\n\n## Text to Speech (TTS) Shortcut Ubuntu\n\nFor speed reading, researching, programming, editing and writing.\n\nTested on Ubuntu 24.04, 22.04, 22.10, 23.04, 23.10, but should work on similar distributions such as Mint, Debian, Pop OS. `xsel` required so espeak can read from clipboard. Works with `espeak` or `espeak-ng`.\n\n1. `sudo apt install espeak xsel -y`\n2. Set your custom shortcuts. See [Gnome](#gnome) or [KDE](#kde) below.\n3. With your mouse, select text you want read aloud, press your Read keys.\n\n\n### Gnome\n\n* **System Settings** ➡ **Keyboard** ➡ **Keyboard Shortcuts** ➡ **Custom Shortcuts** ➡ **+**\n* **Read** `bash -c \"espeak -s260 -g0 -p40 -v english-us \\\"$(xsel | sed -e :a -e 'N;s/\\n/ /;ta')\\\"\"`\n* **Stop Reading** `bash -c \"killall espeak\"`\n* Recommended keys **SUPER + R** (Read) and **SHIFT + SUPER + R** (Stop Reading)\n* With your mouse, select text you want read aloud, press your Read keys.\n\n![image](https://github.com/user-attachments/assets/35b475ca-fca8-4ea0-b52e-470b216b7a10)\n\n### KDE\nKDE is a little different because custom shortcuts have an issue with multiple commands in the same action, but this works:\n\n* **System Settings** ➡ **Shortcuts** ➡ **Custom Shortcuts** ➡ **Edit .. New .. Global .. Command**\n* **Read** `xsel \u003e /tmp/speak.txt | espeak -s260 -g0 -p40 -v english-us -f /tmp/speak.txt`\n* **Stop Reading** `killall espeak`\n* Recommended keys **SUPER + R** (Read) and **SHIFT + SUPER + R** (Stop Reading)\n* With your mouse, select text you want read aloud, press your Read keys.\n\n![Screenshot_20231024_225433](https://github.com/gnat/text-to-speech-ubuntu/assets/24665/dcd36a3d-7ad1-4de3-bb8a-98202091d18e)\n\n\n### Options\n* `-s260` Speed of reading (260 is faster).\n* `-g0` Delay between words (0 is no delay).\n* `-p40` Pitch (50 is normal).\n* `-v english-us` Voice pack (en-us for `espeak-ng`).\n\n### Sed explainer.\nThe sed is required to replace newlines properly. Reference: https://linux.die.net/man/1/sed\n\n* `-e :a` Sets `a` label for looping.\n* `N` Read next line into substitute buffer ... or `$!N` (`$` go to EOL, `!N` exit if no more newlines to read)\n* `;s/\\n/ /` Substitute newlines with space.\n* `;ta` Loop to label `a`.\n\n### Using espeak-ng instead of espeak\nSome distributions come with `espeak-ng` which can be used with only minor changes.\n\n1. **Read** `bash -c \"espeak-ng -s260 -g0 -p40 -v en-us \\\"$(xsel | sed -e :a -e 'N;s/\\n/ /;ta')\\\"\"`\n2. **Stop Reading** `bash -c \"killall espeak-ng\"`\n\n### Killing espeak if needed.\n* `ps -ef | grep \"espeak\" | tr -s ' ' | cut -d ' ' -f2 | xargs kill -9`\n\n### Why?\nBecause my favorite TTS reader [gespeaker](https://github.com/muflone/gespeaker) (python frontend to espeak) is unmaintained, and most other options suck or are browser only.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgnat%2Ftext-to-speech-ubuntu","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgnat%2Ftext-to-speech-ubuntu","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgnat%2Ftext-to-speech-ubuntu/lists"}