A. Command Line Tools
1. The first command we are going to see allows to convert text to speech using the Google Translate service. The output file is saved in the MP3 format. From the command line (Ctrl+Alt+T), run this command:
wget -q -U Mozilla -O output.mp3 "http://translate.google.com/translate_tts?tl=en&q=Welcome Back"
Replace "Welcome Back" with any text of your choice. The MP3 file will be saved in your home directory (output.mp3). You can select different audio formats for the output.mp3 file (.ogg, .wav, .mp4, etc.).
2. The "festival" command line tool also allows to read out text for you, you can install it with this command:
sudo apt-get install festival
Then run this command to convert text to speech:
echo "Welcome Back" | festival --tts
Replace Welcome Back with your own text.
3. This command also allows to read out text stored inside a txt file:
espeak -f file.txt
B. Programs To Convert Text To Speech
1. Cainteoir Text-to-Speech
Cainteoir Text-to-Speech is a free program that allows to open text files and read them out for you. It can also record your text to an audio file (ogg format). To install it on Ubuntu, use these commands from the Terminal:
sudo add-apt-repository ppa:msclrhd-gmail/cainteoir
sudo apt-get update
sudo apt-get install cainteoir-gtk
2. eSpeak Speech Synthesizer
eSpeak is afree program that allows to convert text input into speech via a simple user interface. eSpeak supports many languages. You can install it with this command:
sudo apt-get install espeak-gui
If you have more commands or programs for converting text to speech, please mention them in the comment form given below.