How can I run a simple text to speech command? [duplicate]

In Windows I can do these steps:

1. Open Notepad
2. Copy and Paste 

CreateObject("SAPI.SpVoice").Speak"Hello."

3. Save it as xyz.vbs
4. Run it/Open it

It will then speak "Hello". Is there something like this in Ubuntu?


Solution 1:

There is a link which will give detailed text to speech command line tools.

http://elinux.org/RPi_Text_to_Speech_%28Speech_Synthesis%29

The first speech package I tried was Festival. It worked fine and produces a voice like a rough sounding robot.

Festival Text to Speech

Install Festival with:

sudo apt-get install festival

Try out Festival with:

echo “Just what do you think you're doing, Dave?” | festival --tts

Espeak Text to Speech Espeak is a more modern speech synthesis package than Festival. It sounds clearer but does wail a little. If you are making an alien or a RPi witch then it’s the one for you! Seriously it is a good allrounder with great customisation options.

Install Espeak with:

sudo apt-get install espeak 

Test Espeak with: English female voice, emphasis on capitals (-k), speaking slowly (-s) using direct text:-

espeak -ven+f3 -k5 -s150 "I've just picked up a fault in the AE35 unit"

Solution 2:

Install the espeak Install espeak package. Then run in a terminal

espeak -v en "Hello"

To change the voice, please refer to the manpage. An excerpt from man espeak:

   --voices[=<language code>]
          Lists  the available voices. If =<language code> is present then only
          those voices which are suitable for that language are listed.

   -v <voice name>
          Use voice file of this name from espeak-data/voices