ax206geek
Posts: 52
Joined: Sat Jun 16, 2012 2:55 pm

Script for text to speech

Thu Jun 28, 2012 1:28 pm

8-) A little debian script to get your R-Pi to speak to you:

Sorting out the dependency

Code: Select all

sudo apt-get install mplayer 
The script itself:

Code: Select all

#!/bin/bash
say() { local IFS=+;/usr/bin/mplayer -ao alsa -really-quiet -noconsolecontrols "http://translate.google.com/translate_tts?tl=en&q=$*"; }
say $*
You probably need to modprobe snd_bcm2835 as well. The R-Pi's speech is output from hdmi so my /boot/config.txt contains this line:

Code: Select all

hdmi_drive=2
A little test

Code: Select all

./speak my raspberry pi speaks to me

User avatar
mikerr
Posts: 2465
Joined: Thu Jan 12, 2012 12:46 pm
Location: Up north , UK
Contact: Website

Re: Script for text to speech

Mon Jul 02, 2012 5:37 pm

Good idea using google's text-to-wave engine, but that will obviously only work if the pi always has internet access.

Festival TextToSpeech worked straightaway for me on debian wheezy:

Code: Select all

apt-get install festival
uses around 20MB on the SD card.

Code: Select all

echo "I'm sorry dave, I'm afraid I can't do that" | festival --tts
Android app - Raspi Card Imager - download and image SD cards - No PC required !

Return to “Graphics, sound and multimedia”

Who is online

Users browsing this forum: No registered users and 9 guests