loading

A simple method to get some feedback from the Raspberry Pi is to use Text To Speech (TTS).

I this Instructable I will show you how to do this using Python and Espeak.

Parts required:

-Raspberry Pi with internet connection (internet just for setup)

-Speaker

Step 1: Install Python

If you haven't installed Python already, install it via apt-get:

sudo apt-get install python-dev

Step 2: Install Espeak

To install the TTS engine (Espeak) and the Python module, use the following command:

sudo apt-get install espeak
sudo apt-get install espeak python-espeak

Step 3: Speak!

To speak a sentence, use the command

espeak Hello Instructables!

or in Python:

from espeak import espeak

espeak.synth("Hello Instructables!")

<p>I got rid of the errors by entering &quot;start-pulseaudio-x11&quot; prior to using espeach</p>
<p>Any ideas why it only says one word no matter how many there are?</p>
<p>I also get the errors when using the command-line, but the text is spoken correctly. So I just add &quot; 2&gt; /dev/null&quot; to the command to send the error messages to the bitbucket.</p><p>Also, in my experience flite (festival lite) produces nicer spoken text, but it supports less languages.</p>
<p>Same problem as shiyazt and chippy johnson</p><p>Any clues as to how to fix this?</p>
<p>One issue:</p><p>when i use this command espeak Hello Instructables!</p><p>I AM GETTING THIS ERRORS ! PLZ HELP</p><p>ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.bcm2835.pcm.front.0:CARD=0'</p><p>ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory</p><p>ALSA lib conf.c:4738:(snd_config_expand) Evaluate error: No such file or directory</p><p>ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM front</p><p>ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear</p><p>ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe</p><p>ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side</p><p>ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.bcm2835.pcm.surround51.0:CARD=0'</p><p>ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory</p><p>ALSA lib conf.c:4738:(snd_config_expand) Evaluate error: No such file or directory</p><p>ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM surround21</p><p>ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.bcm2835.pcm.surround51.0:CARD=0'</p><p>ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory</p><p>ALSA lib conf.c:4738:(snd_config_expand) Evaluate error: No such file or directory</p><p>ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM surround21</p><p>ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.bcm2835.pcm.surround40.0:CARD=0'</p><p>ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory</p><p>ALSA lib conf.c:4738:(snd_config_expand) Evaluate error: No such file or directory</p><p>ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM surround40</p><p>ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.bcm2835.pcm.surround51.0:CARD=0'</p><p>ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory</p><p>ALSA lib conf.c:4738:(snd_config_expand) Evaluate error: No such file or directory</p><p>ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM surround41</p><p>ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.bcm2835.pcm.surround51.0:CARD=0'</p><p>ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory</p><p>ALSA lib conf.c:4738:(snd_config_expand) Evaluate error: No such file or directory</p><p>ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM surround50</p><p>ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.bcm2835.pcm.surround51.0:CARD=0'</p><p>ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory</p><p>ALSA lib conf.c:4738:(snd_config_expand) Evaluate error: No such file or directory</p><p>ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM surround51</p><p>ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.bcm2835.pcm.surround71.0:CARD=0'</p><p>ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory</p><p>ALSA lib conf.c:4738:(snd_config_expand) Evaluate error: No such file or directory</p><p>ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM surround71</p><p>ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.bcm2835.pcm.iec958.0:CARD=0,AES0=4,AES1=130,AES2=0,AES3=2'</p><p>ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory</p><p>ALSA lib conf.c:4738:(snd_config_expand) Evaluate error: No such file or directory</p><p>ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM iec958</p><p>ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.bcm2835.pcm.iec958.0:CARD=0,AES0=4,AES1=130,AES2=0,AES3=2'</p><p>ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory</p><p>ALSA lib conf.c:4738:(snd_config_expand) Evaluate error: No such file or directory</p><p>ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM spdif</p><p>ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.bcm2835.pcm.iec958.0:CARD=0,AES0=4,AES1=130,AES2=0,AES3=2'</p><p>ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory</p><p>ALSA lib conf.c:4738:(snd_config_expand) Evaluate error: No such file or directory</p><p>ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM spdif</p><p>ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi</p><p>ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi</p><p>ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem</p><p>ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem</p><p>ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline</p><p>ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline</p><p>Cannot connect to server socket err = No such file or directory</p><p>Cannot connect to server request channel</p><p>jack server is not running or cannot be started</p>
<p>same here......... </p>
<p>Nice idea, I especially like the python implementation, you can make your Pi for example measure something and then say it out loud. I received lots of errors, but apparently those don't mean it's not working... </p>
Thanks homie

About This Instructable

41,740views

52favorites

License:

More by ottojo:Toolbox Bodensee e.V. Make your Raspberry Pi speak Create an alarm system and visitor counter for your room 
Add instructable to: