Page 1 of 1
Google voice in Wiki
Posted: Monday 10 August 2015 18:29
by oopee
Google translate
https://www.domoticz.com/wiki/Google_voice has changed resulting error 503 when using script from Wiki. Browser shows a captcha dialogue now.
To get it working again, a string "
&ie=UTF-8&total=1&idx=0&client=t" must be added to the script.
My current script for speaking Domoticz is now:
Code: Select all
#!/bin/bash
say() { local IFS=+;/usr/bin/mplayer -ao alsa -really-quiet -noconsolecontrols "http://translate.google.com/translate_tts?tl=fi&q=$*&ie=UTF-8&total=1&idx=0&client=t"; }
say $*
There may be other (better?) ways to fix this issue but this was the first I found.
Re: Google voice in Wiki
Posted: Monday 10 August 2015 22:10
by pvm
Thnx! Was looking for this for my Bluetooth speaker
Re: Google voice in Wiki
Posted: Monday 10 August 2015 23:21
by ThinkPad
Feel free to change the wiki, login credentials are the same as for this forum
Thanks for reporting.
Re: Google voice in Wiki
Posted: Tuesday 11 August 2015 11:21
by pvm
pvm wrote:Thnx! Was looking for this for my Bluetooth speaker
Too bad...it does not work for me:
Code: Select all
pi@raspberrypi ~/btaudio $ wget "http://translate.google.com/translate_tts?tl=nl&q=test&ie=UTF-8&total=1&idx=0&client=t"
--2015-08-11 11:19:46-- http://translate.google.com/translate_tts?tl=nl&q=test&ie=UTF-8&total=1&idx=0&client=t
Resolving translate.google.com (translate.google.com)... 173.194.65.113, 173.194.65.100, 173.194.65.101, ...
Connecting to translate.google.com (translate.google.com)|173.194.65.113|:80... connected.
HTTP request sent, awaiting response... 403 Forbidden
2015-08-11 11:19:46 ERROR 403: Forbidden.
Re: Google voice in Wiki
Posted: Tuesday 11 August 2015 12:24
by oopee
If you try your string (from same network as your Domoticz)
http://translate.google.com/translate_t ... 0&client=t in browser, do you get it spoken and without captcha?
My error was 503, not 403. Without the added part, do you get 503?
Re: Google voice in Wiki
Posted: Wednesday 12 August 2015 12:01
by pvm
Yes I do, I seem to have another issue. I am able to download files from the internet on my Pi. Internet access seems ok
Re: Google voice in Wiki
Posted: Thursday 13 August 2015 12:16
by oopee
It might be that with WGET you need to fake some HTTP headers if possible. See:
http://stackoverflow.com/questions/9893 ... speech-api.
Re: Google voice in Wiki
Posted: Thursday 13 August 2015 14:06
by pvm
Thnx, the following produces a valid mp3 file
Code: Select all
curl 'http://translate.google.com/translate_tts?ie=UTF-8&q=Hello&tl=en&client=t' -H 'Referer: http://translate.google.com/' -H 'User-Agent: stagefright/1.2 (Linux;Android 5.0)' > google_tts.mp3
Re: Google voice in Wiki
Posted: Friday 14 August 2015 19:46
by pvm
I added this information to the google_voice wiki page
Re: Google voice in Wiki
Posted: Saturday 15 August 2015 19:20
by uNGam3R
Thanks, your solution works great

Re: Google voice in Wiki
Posted: Tuesday 27 October 2015 12:51
by BobbyNL
is there someone who can create a working google_voice.sh file and a sample script_device_switch.lua?
i have sound working on my rpi (can play a mp3 file with mplayer) but google.translate produces no sound even when the script is triggered.
So i think my google_voice.sh and script_device_switch isnt correct.
Re: Google voice in Wiki
Posted: Saturday 31 October 2015 17:32
by BobbyNL
Could not get it working with google text to speech because google blocks my ip after one request.
So I had to find another solution. Now it works with the voicerss api.
I created a wiki page how I did it:
http://www.domoticz.com/wiki/Rss_voice
Re: Google voice in Wiki
Posted: Sunday 01 November 2015 9:49
by pvm
Indeed Google blocks, thats why you can use:
pvm wrote:
Thnx, the following produces a valid mp3 file
Code: Select all
curl 'http://translate.google.com/translate_tts?ie=UTF-8&q=Hello&tl=en&client=t' -H 'Referer: http://translate.google.com/' -H 'User-Agent: stagefright/1.2 (Linux;Android 5.0)' > google_tts.mp3
Re: Google voice in Wiki
Posted: Sunday 01 November 2015 9:50
by pvm
Btw, Amazon its tts sounds better than googles. You need a free developers license though. I am using that one
Re: Google voice in Wiki
Posted: Sunday 01 November 2015 10:10
by BobbyNL
And what code do you use the bash file ?
Re: Google voice in Wiki
Posted: Sunday 01 November 2015 10:18
by pvm
BobbyNL wrote:is there someone who can create a working google_voice.sh file and a sample script_device_switch.lua?
i have sound working on my rpi (can play a mp3 file with mplayer) but google.translate produces no sound even when the script is triggered.
So i think my google_voice.sh and script_device_switch isnt correct.
What happend on command line (no script) if you produce the mp3 file and step 2 play it with mplayer?
Re: Google voice in Wiki
Posted: Sunday 01 November 2015 12:54
by BobbyNL
it works for a few requests. But after a while i get this error.
Code: Select all
pi@raspberrypi ~/domoticz/scripts $ sudo ./google_voice.sh
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1771 100 1771 0 0 3495 0 --:--:-- --:--:-- --:--:-- 4052
Creating config file: /root/.mplayer/config
MPlayer svn r34540 (Raspbian), built with gcc-4.6 (C) 2000-2012 MPlayer Team
mplayer: could not connect to socket
mplayer: No such file or directory
Failed to open LIRC support. You will not be able to use your remote control.
Playing google_tts.mp3.
libavformat version 53.21.1 (external)
Mismatching header version 53.19.0
libavformat file format detected.
[mp3 @ 0xb5da2850]Header missing
[mp3 @ 0xb64800e8]Could not find codec parameters (Audio: mp3, 0 channels, s16)
[mp3 @ 0xb64800e8]Estimating duration from bitrate, this may be inaccurate
LAVF_header: av_find_stream_info() failed
Exiting... (End of file)
And opening the mp3 file. Looks clear to my that the server blocks my IP even with this mp3 (solution)
Code: Select all
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head><meta http-equiv="content-type" content="text/html; charset=utf-8"><meta name="viewport" content="initial-scale=1"><title>http://www.google.com/</title></head>
<body style="font-family: arial, sans-serif; background-color: #fff; color: #000; padding:20px; font-size:18px;" onload="e=document.getElementById('captcha');if(e){e.focus();}">
<div style="max-width:400px;">
<hr noshade size="1" style="color:#ccc; background-color:#ccc;"><br>
<div style="font-size:13px;">
Our systems have detected unusual traffic from your computer network. Please try your request again later. <a href="#" onclick="document.getElementById('infoDiv0').style.display='block$
<div id="infoDiv0" style="display:none; background-color:#eee; padding:10px; margin:0 0 15px 0; line-height:1.4em;">
This page appears when Google automatically detects requests coming from your computer network which appear to be in violation of the <a href="//www.google.com/policies/terms/">Terms of$
</div><br>
IP address: xx.xxx.xx.xx<br>Time: 2015-11-01T16:26:59Z<br>URL: http://www.google.com/<br>
</div>
</div>
</body>
</html>
Re: Google voice in Wiki
Posted: Saturday 05 March 2016 17:20
by jmleglise
Google voice controls the number of call per IP. So if you have a dynamic IP, and are not lucky, you may be banned.
If so, use VoiceRSS. I have updated the wiki with a VoiceRSS howto, look here :
https://www.domoticz.com/wiki/Talking_Domoticz