Make Your Raspberry Pi Speak

74,012

53

16

Introduction: Make Your Raspberry Pi Speak

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

  • STEM Contest

    STEM Contest
  • Role Playing Game Challenge

    Role Playing Game Challenge
  • CNC Contest

    CNC Contest

16 Comments

0
shiyazt
shiyazt

5 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

0
chippy johnson
chippy johnson

Reply 4 years ago

same here.........

0
sysustuyexl
sysustuyexl

Reply 3 years ago

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

0
sysustuyexl
sysustuyexl

Reply 3 years ago

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

0
Vaporisto
Vaporisto

Question 2 years 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
sysustuyexl
sysustuyexl

3 years ago

Same problem as shiyazt and chippy johnson

Any clues as to how to fix this? Please

0
vor0nwe
vor0nwe

4 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.

0
Anishanne
Anishanne

Reply 3 years ago

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

0
Kravex
Kravex

4 years ago

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

0
OliverL42
OliverL42

Reply 3 years ago

try espeak "Hello world"

0
glenntref
glenntref

4 years ago

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

0
RottenSod
RottenSod

4 years ago

Same problem as shiyazt and chippy johnson

Any clues as to how to fix this?

0
IvorS
IvorS

5 years ago

Thanks homie