You are here

Text To Speech (TTS) / Speech Synthesis with the Raspberry PI Model B

First, set up your webcam or usb microphone to get commands

Plug in your USB microphone. Let’s open up an ALSA configuration file in vim:

sudo nano /etc/modprobe.d/alsa-base.conf

Change the following line:

options snd-usb-audio index=-2

To this:

options snd-usb-audio index=0

Install SoX which is used for playback and not Text to Speech (very useful tool to playback wave files)

sudo apt-get install sox

Also, if you have already set up a microphone as main device, you need to set playback device for Sox to output to the raspberry audio jack:

export AUDIODEV=hw:1,0

THIS IS WHERE TEXT TO SPEACH COMES IN: THAT IS, TEXT CONVERTED INTO AUDIO FOR PLAYBACK

#Install Festival

sudo apt-get install festival

echo “Hello World” | festival --tts

hostname -I | festival --tts

# or install espeak

sudo apt-get install espeak

espeak -ven+f3 -k5 -s150 "Hello World"

# or Google Android TTS - PICO

sudo apt-get install libttspico-utils

pico2wave -w helloworld.wav "Hello World" && aplay helloworld.wav