User avatar
StevenP
Posts: 57
Joined: Tue Aug 14, 2012 7:55 pm
Location: Germany / UK

RPi Text to Speech (Speech Synthesis)

Sun Oct 14, 2012 6:28 am

I put a short guide to using Text to Speech on the Pi at the Wiki, intended for the beginner.The link is:
http://elinux.org/RPi_Text_to_Speech_(Speech_Synthesis)

I wanted speech on my internet radio, and found the existing info on the web confusing and there was no comparison of the different method of getting the Pi to speak - hopefully I've brought it all together there. It is not exhaustive but is enough to get you quickly started and experimenting ;)

All comments/suggestions are welcome! I would be interested to know for what you have used speech on your Pi - StevenP.
"The time has come," the Walrus said,
"To talk of many things..."

User avatar
LetHopeItsSnowing
Posts: 357
Joined: Sat May 26, 2012 6:40 am
Location: UK
Contact: Website

Re: RPi Text to Speech (Speech Synthesis)

Mon Oct 15, 2012 8:01 pm

Thanks, very useful
"am I getting slower, or is stuff more complicated; either way I now have to write it down - stuffaboutcode.com"

djfountain
Posts: 3
Joined: Sun Mar 17, 2013 7:00 pm

Re: RPi Text to Speech (Speech Synthesis)

Sun Mar 17, 2013 8:19 pm

Hey.
I appreciate your article.
I added to it here, and enabled chopping the string into 100 char sections to avoid the google limit.

http://www.raspberrypi.org/phpBB3/viewt ... 25#p311925

Feel free to add the script to that page.
Dan

Bronto
Posts: 17
Joined: Fri Apr 19, 2013 3:30 pm

Re: RPi Text to Speech (Speech Synthesis)

Tue Apr 30, 2013 4:18 pm

Hi StevenP,

I'm working on a script that a) reads in data from a web source text file and then b) calls the ./speech.sh to run it.

Here's the call I am using:

Code: Select all

for line in content.split('\r\n'):
    subprocess.call('echo ' + line, shell=True)
The sentences that it is "echo" are:
./speech.sh this is a test
./speech.sh this is another test

My thinking is that it would "call" these and actually speak them, however it isnt doing that.

Here's a screenshot: Image

So as you can see the text being called begins with ./speech.sh however it doesnt do the text to speech to my speaker.

If I were to simply run
./speech.sh test 123
in the command prompt, it would play the voice.

Any idea what I'm doing wrong here?

User avatar
StevenP
Posts: 57
Joined: Tue Aug 14, 2012 7:55 pm
Location: Germany / UK

Re: RPi Text to Speech (Speech Synthesis)

Tue Apr 30, 2013 6:42 pm

Hi,
I haven't used Python myself, but is the problem 'echo'? I don't think you need it. It is basically a print command, and you don't want to print, you want to pass the ./speech.sh etc. to the shell directly to get the shell to execute it.
So just remove the echo and see if it does what you want.
Hopefully it's that simple!
"The time has come," the Walrus said,
"To talk of many things..."

Bronto
Posts: 17
Joined: Fri Apr 19, 2013 3:30 pm

Re: RPi Text to Speech (Speech Synthesis)

Tue Apr 30, 2013 7:36 pm

StevenP wrote:Hi,
I haven't used Python myself, but is the problem 'echo'? I don't think you need it. It is basically a print command, and you don't want to print, you want to pass the ./speech.sh etc. to the shell directly to get the shell to execute it.
So just remove the echo and see if it does what you want.
Hopefully it's that simple!
Ha! Brilliant, it's working! Thank you StevenP :)

User avatar
StevenP
Posts: 57
Joined: Tue Aug 14, 2012 7:55 pm
Location: Germany / UK

Re: RPi Text to Speech (Speech Synthesis)

Wed May 01, 2013 6:14 pm

Hi Dan,
thanks for that - nice guide - I just put a link to your site from my guide in the Wiki. Maybe later I will put your speech webpage as a sub page from my guide in the WIki if that's OK? (in case your site ever moves/disappears)
Cheers,
Steven
djfountain wrote:Hey.
I appreciate your article.
I added to it here, and enabled chopping the string into 100 char sections to avoid the google limit.

http://www.raspberrypi.org/phpBB3/viewt ... 25#p311925

Feel free to add the script to that page.
Dan
"The time has come," the Walrus said,
"To talk of many things..."

Bronto
Posts: 17
Joined: Fri Apr 19, 2013 3:30 pm

Re: RPi Text to Speech (Speech Synthesis)

Wed May 01, 2013 6:22 pm

Guys how would I set up a cron to run every minute "python talky.py"

I have been struggling to get the cron to work given I have tried crontab crontab.txt but it doesnt run that file.

Thanks!

Return to “Other projects”