Text to speech for Ubuntu


#1

I wanted to add this to Tips and Tricks, but I don’t have permission; so I’ll add it here. :slight_smile: Here’s a way to add TTS.

First, install the required software:

sudo apt install xsel
sudo apt install festival
sudo apt install festvox-en1s
sudo apt-get install festlex-poslex

xsel will output your current selected text. Try it. Highlight something with your mouse. In a terminal, type xsel. What’s highlighted by your mouse should be displayed. festival is a text to speech engine. Try it. Cat any short file and pipe it to festival --tts --pipe. And festvox-en1 is a male english voice for festival.

Then write a quick bash script called talk.sh. Make it in your home directory:

 #!/bin/bash
 xsel|festival --tts --pipe

Make the script executable:

chmod +x talk.sh

Now open up keyboard shortcuts. At the bottom press Add. For Name enter TalkTalk. For the command enter the full path as /home/username/talk.sh. Hit apply. Then assign a key. I use Ctrl+Alt+K.

Now you are ready to relax, and have your computer read to you. Select some text and press Ctrl+Alt+K.