Talking Domoticz
Give a voice to Domoticz so It may inform you about a device that was triggered, read some news during breakfast, or even speak to a burglar...
There are generally two ways to do this: with a stand-alone piece of software you install in your server, or by using an online service that generates the voice file. The latter may give more attractive results, but does mean you lose some privacy.
eSpeak on RaspBerry Pi
A SW package named „eSpeak“ let Domoticz speak any text in different languages.
eSpeak is not a Domoticz feature but can be started e.g. by pressing a button or called from Domoticz_main.
- Pro : Standalone. No need of internet connexion.
- Con : The voice is synthetic. Just horrible unless you like robots from '1950s.
Reference
The author used following setup:
- Raspberry Pi Type B 2nd revision
- Domoticz version 1.1773
The last stable version is also working.
- Analog out connected to a stereo amplifier for testing.
For normal usage a mini PC speaker is recommended with a 3.5mm plug and a USB power connector.
Installation of eSpeak
Like always before doing an installation on a live system make a backup of the domoticz.db and better also a copy of the whole SD card (Image) before starting.
sudo apt-get update
sudo apt-get upgrade
sudo reboot
sudo su
cd
sudo apt-get install espeak
sudo apt-get install alsa-utils
Optionally (instead of "sudo apt-get install espeak"):
sudo apt-get install mplayer espeak
Configuration for analog audio (jack):
sudo amixer cset numid=3 1
Configuration for HDMI audio out:
sudo amixer cset numid=3 2
Usage
espeak "Hello world, I'm a raspberry pi."
Or in another language like German:
espeak –v de "Hallo Welt, ich gruesse euch”
Create a new bash script like this:
nano lamp-voice.sh
And then in the Nano editor write this:
#!/bin/bash
espeak "Lamp on"
Save the file by pressing ctrl-o, hit enter to save it, and then press ctrl-x to close the nano editor.
Name it "lamp-voice.sh" and make it executable:
chmod +x lamp-voice.sh
Try it out by typing
./lamp-voice.sh
If you get a bash error, then you may need to renove the #!/bin/bash
. Just open the file again like you did above.
Add "script:///home/pi/domoticz/scripts/lamp-voice.sh" to the "On action" field of the switch.
Info
Find info and parameters :
- [1]http://espeak.sourceforge.net/
- man espeak
[2]http://jeffskinnerbox.wordpress.com/2012/11/15/getting-audio-out-working-on-the-raspberry-pi/
You can discuss here: [3]http://www.domoticz.com/forum/viewtopic.php?f=21&t=2573
Thanks to “drogert” for support. :-)
Speak with VOICERSS WebService on RaspBerry Pi
Simple to run, text-to-speech (TTS) system for the Raspberry Pi. The only solution to have a good sound quality. There is a lot of good Text to speech API:
- http://www.acapela-group.com/
- https://www.voxygen.fr
- google speech (Captcha protected now, so useless !)
- http://www.naturalreaders.com
- https://www.ivona.com/us/
- http://www.voicerss.org/ . I choose this one. With basic free plan , you will be able to do 350 requests per day. Gratis.
Installation
sudo apt-get install git-core sudo apt-get install mpg123 git clone https://github.com/StevenHickson/PiAUISuite.git cd PiAUISuite/Install ./InstallAUISuite.sh
Say Yes to install the dependencies. (Around 250Mb)
Say No to install playvideo, downloader, gvapi, gtextcommand, youtube.
Say Yes to install voicecommand (the last one)
Say No to the Self set up voicecommand.
Then, register to Voice RSS [4] and get your API Key.
And adapt the script : insert your API key, your language, bit rate. look here : [5] :
sudo nano /usr/bin/tts
#!/bin/bash string=$@ #lang="en-gb" lang="fr-fr" MYAPIKEY="kkkkk from voice RSS yyyy" if [ "$1" == "-l" ] ; then lang="$2" string=`echo "$string" | sed -r 's/^.{6}//'` fi #empty the original file echo "" > "/dev/shm/speak.mp3" len=${#string} wget -q -U Mozilla -O "/dev/shm/tmp.mp3" "http://api.voicerss.org/?key=$MYAPIKEY&src=$string&f=44khz_16bit_mono&hl=$lang" cat "/dev/shm/tmp.mp3" >> "/dev/shm/speak.mp3" #now we finally say the whole thing cat "/dev/shm/speak.mp3" | mpg123 - 1>>/dev/shm/voice.log 2>>/dev/shm/voice.log
Usage
The command can now be used with :
tts "Hello, world"
which will convert your text to speech, which can be heard on your default sound card and audio out.
Info
Voice RSS allows for up to 10 000 characters per call.
API documentation : [6]
From : [7]
From Steven Hickson’s PiAUISuite. : [8]
izSynth
TTS/Text To Speech synthesizer, background music overlay assembler and audio file converter for PBX and Home Automation Systems
See for more info wiki page izSynth
Other resources for Raspberry
http://raspberrypi.stackexchange.com/questions/10384/speech-processing-on-the-raspberry-pi
https://github.com/DougGore/picopi
https://www.youtube.com/watch?v=frH9HaQTFL8
Windows
Use SAPI Windows voice synthesis with :
VBS script
speak.vbs
Set MyVoice = CreateObject("Sapi.SpVoice") MyVoice.Speak WScript.Arguments(0)
Execute with
cscript.exe speak.vbs "Hello world !"
Balabolka Console Application
This Freeware console software is excellent to easy text to speech.
- No installation required.
- Use the voice of windows. So excellent quality.
- Compact.
- Flexible and easy to use.
- Low system requirements.
It can be found here : [9]
balabolka_console.exe -t "Hello World"
Keywords : Text to speech. TTS. Speak. Voice. Voice synthesis.