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