Text to speech for Ubuntu

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.

3 Likes

I can't seem to edit this. festvox-en1s should be festvox=en1. Also, in 19.04, I cant get a keyboard shortcut to work from my home directory. I had to put my shell script in /usr/local/bin.

When I was trying to install itunes on windows 7 using the text to speech it was literally failing I dont know why. Please help me to fix the problem so that I can work with it again.