Page 1 of 1
Talking domoticz with voicerss api
Posted: Friday 30 October 2015 21:37
by BobbyNL
The goal is to let domoticz talk with a good audible voice.
Google TTS is not working because it blocks with more then one request. So i found
http://http://www.voicerss.org created an account for free and you get an API key.
But until now it is not working. Somebody an idee to let this work?
Here are my scripts.
script: script_device_Keuken.lua in /domoticz/scripts/lua/
local Keuken = 'Talk - Test'
commandArray = {}
if (devicechanged["Keuken"] == 'On') then
os.execute("/home/pi/domoticz/scripts/voice_rss.sh Dit is een test")
commandArray["Keuken"]='Off'
end
return commandArray
script: voice_rss.sh in /domoticz/scripts/
#!/bin/bash
say() { local IFS=+;/usr/bin/mplayer -ao alsa -really-quiet -noconsolecontrols "
http://api.voicerss.org/?key=youreapikey&hl=nl-nl&src=$*"; }
say $*
Re: Talking domoticz with voicerss api
Posted: Friday 30 October 2015 23:52
by G3rard
I am using voicerss as well and it is working here. I use the following url.
Code: Select all
https://api.voicerss.org/?key<key>&c=mp3&f=16khz_8bit_mono&hl=nl-nl&r=0&src=<message>
I am using it in a script which had issues when there are spaces between the words in the message, so I replaced those with %20.
Re: Talking domoticz with voicerss api
Posted: Saturday 31 October 2015 0:26
by BobbyNL
thx Grard
I finaly got it working with this voice_rss.sh
#!/bin/bash
mplayer -ao alsa -noconsolecontrols "
http://api.voicerss.org/?key=<key>&hl=nl-nl&src=$*"
And my mistake was to create an script with windows notepad

Re: Talking domoticz with voicerss api
Posted: Sunday 01 November 2015 16:36
by Pjedr
Our systems have detected unusual traffic from your computer network. Please try your request again later. Why did this happen?
http://translate.google.com/translate_t ... 0&client=#
Hello, I am over to VoicerRSS too, for the .mp3ees id did not cached already.
See code. Notice also the espeak alternative. I log every tts link, maybe it can be downloaded to cache manually later.
Quality is not as good as with Google, it sounds like someone speaking in a closet, and low bps, but good enuogh.
P.S. Also i use locking mechanism to avoid mutliple voices at the same time.
Code: Select all
#!/bin/bash
if [ -e "/var/ramdrive/domoticz" ]; then RUNDIR="/var/ramdrive"; else RUNDIR="/opt/domoticz-extra/"; fi
TEMPDIR="${RUNDIR}/temp"; LOGDIR="${RUNDIR}/log"; echo "`date` $*" >> ${LOGDIR}/${0##*/}.log;
exec 200>${TEMPDIR}/${0##*/}.lock || exit 1; flock -x 200 || { echo "ERROR: flock() failed." >&2; exit 1; }
if [[ "$*" =~ "Ferbroek" ]] || [[ "$*" =~ "procent" ]] || [[ "$*" =~ "Energie" ]]; then exit; fi
SpeakDir=${RUNDIR}/Speaking; echo SpeakDir=$SpeakDir; if [ ! -e $SpeakDir ]; then mkdir $SpeakDir; chmod -R 777 $SpeakDir;fi
if [ -e "$SpeakDir/$*.mp3" ]; then echo mplayer from cache "$SpeakDir/$*.mp3"; mplayer "$SpeakDir/$*.mp3" &> /dev/null; else # Statische teksten opslaan voor hergebruik
sWWW="http://translate.google.com/translate_tts?tl=nl&q=$*&ie=UTF-8&total=1&idx=0&client=" #Google heeft limiet
echo sWWW=$sWWW; echo "`date` $sWWW" >> ${LOGDIR}/${0##*/}.log
sWWW="http://api.voicerss.org/?key=<not_my_id_but_your_own_id>&hl=nl-nl&src=$*" #VoiceRSS gratis registreren 350 per dag http://www.voicerss.org/personel/
echo sWWW=$sWWW; echo "`date` $sWWW" >> ${LOGDIR}/${0##*/}.log
#say() { local IFS=+;/usr/bin/mplayer -ao alsa -really-quiet -noconsolecontrols "$sWWW"; }
echo /usr/bin/wget -q -U Mozilla -O "$SpeakDir/$*.mp3" "$sWWW";
save() { local IFS=+;/usr/bin/wget -q -U Mozilla -O "$SpeakDir/$*.mp3" "$sWWW"; };
save "$*"; echo mplayer new to cache "$SpeakDir/$*.mp3"; mplayer "$SpeakDir/$*.mp3" &> /dev/null; chmod -R 777 $SpeakDir
exec 200>${TEMPDIR}/${0##*/}.lock || exit 1; flock -x 200 || { echo "ERROR: flock() failed." >&2; exit 1; }
# Hieronder de espeak methode als google translate of voicerss niet meer werkt
#/usr/bin/espeak -v mb/mb-nl3 -a 80 -p 200 -s 120 "$*" --stdout | aplay
flock -u 200; fi
Re: Talking domoticz with voicerss api
Posted: Saturday 05 March 2016 17:05
by jmleglise
Google voice is not usable any more.
For VoiceRSS howto, look here :
https://www.domoticz.com/wiki/Talking_Domoticz