Make Your Raspberry Pi Speak

54,904

53

14

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!")

2 People Made This Project!

Recommendations

  • Trash to Treasure

    Trash to Treasure
  • Tape Contest

    Tape Contest
  • Arduino Contest 2019

    Arduino Contest 2019

14 Discussions

0
None
Vaporisto

Question 13 days ago on Step 2

HELP!

when I run the
sudo apt-get install espeak
commands I get:
"""
Package espeak is not available, but is referred to by another package.
This may mean that the package is missing, or has been obsoleted, or
is only available from another source

E: Package 'espeak' has no installation candidate
"""

I'm assuming It like a 404 error, but I'm not yet enough of a raspian guru to know how to work around it.

0
None
sysustuyexl

1 year ago

Same problem as shiyazt and chippy johnson

Any clues as to how to fix this? Please

1 reply
0
None
shiyazt

3 years ago

One issue:

when i use this command espeak Hello Instructables!

I AM GETTING THIS ERRORS ! PLZ HELP

ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.bcm2835.pcm.front.0:CARD=0'

ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory

ALSA lib conf.c:4738:(snd_config_expand) Evaluate error: No such file or directory

ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM front

ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear

ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe

ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side

ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.bcm2835.pcm.surround51.0:CARD=0'

ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory

ALSA lib conf.c:4738:(snd_config_expand) Evaluate error: No such file or directory

ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM surround21

ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.bcm2835.pcm.surround51.0:CARD=0'

ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory

ALSA lib conf.c:4738:(snd_config_expand) Evaluate error: No such file or directory

ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM surround21

ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.bcm2835.pcm.surround40.0:CARD=0'

ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory

ALSA lib conf.c:4738:(snd_config_expand) Evaluate error: No such file or directory

ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM surround40

ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.bcm2835.pcm.surround51.0:CARD=0'

ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory

ALSA lib conf.c:4738:(snd_config_expand) Evaluate error: No such file or directory

ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM surround41

ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.bcm2835.pcm.surround51.0:CARD=0'

ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory

ALSA lib conf.c:4738:(snd_config_expand) Evaluate error: No such file or directory

ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM surround50

ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.bcm2835.pcm.surround51.0:CARD=0'

ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory

ALSA lib conf.c:4738:(snd_config_expand) Evaluate error: No such file or directory

ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM surround51

ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.bcm2835.pcm.surround71.0:CARD=0'

ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory

ALSA lib conf.c:4738:(snd_config_expand) Evaluate error: No such file or directory

ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM surround71

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'

ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory

ALSA lib conf.c:4738:(snd_config_expand) Evaluate error: No such file or directory

ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM iec958

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'

ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory

ALSA lib conf.c:4738:(snd_config_expand) Evaluate error: No such file or directory

ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM spdif

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'

ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory

ALSA lib conf.c:4738:(snd_config_expand) Evaluate error: No such file or directory

ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM spdif

ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi

ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi

ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem

ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem

ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline

ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline

Cannot connect to server socket err = No such file or directory

Cannot connect to server request channel

jack server is not running or cannot be started

3 replies
0
None
sysustuyexlchippy johnson

Reply 1 year ago

Hi man, I wonder if you dealt with the problem?I just get the same issue as you.Need help!please~

0
None
sysustuyexlshiyazt

Reply 1 year ago

Hi man, I wonder if you dealt with the problem?I just get the same issue as you.Need help!please~

0
None
vor0nwe

2 years ago

I also get the errors when using the command-line, but the text is spoken correctly. So I just add " 2> /dev/null" to the command to send the error messages to the bitbucket.

Also, in my experience flite (festival lite) produces nicer spoken text, but it supports less languages.

1 reply
0
None
Anishannevor0nwe

Reply 1 year ago

I'm getting errors in the command line but adding "2> /dev/null" isn't working

0
None
Kravex

2 years ago

Any ideas why it only says one word no matter how many there are?

1 reply
0
None
glenntref

2 years ago

I got rid of the errors by entering "start-pulseaudio-x11" prior to using espeach

0
None
RottenSod

2 years ago

Same problem as shiyazt and chippy johnson

Any clues as to how to fix this?

0
None
IvorS

3 years ago

Thanks homie