Good old Google - looks like the TTS API has been shutdown/hidden/changed...

1,386 views
Skip to first unread message

Ben Jones

unread,
Jul 28, 2015, 5:01:07 PM7/28/15
to openhab
A bit like they did with Latitude a few years back, it looks like Google have shutdown (or hidden/changed) their public TTS API. Meaning the squeezeboxSay() action is now dead :(.

I have found an alternative - Ivona - which is an Amazon cloud based service - but it will require setting up a beta account and generating access keys etc.

I am going to have a look at moving all my TTS stuff to mqttwarn so it is completely decoupled from openHAB (like all my other notifications). So that in future when something like this happens, I just have up write a new mqttwarn service.

Anyone else got any bright ideas for TTS?

lolodomo

unread,
Jul 28, 2015, 5:27:48 PM7/28/15
to openhab, ben.j...@gmail.com
Google has not closed the service but seems to have protected it against robot and software.
When you use the URL, you are now redirected on a page to enter a Captcha code !

Ben Jones

unread,
Jul 28, 2015, 5:28:47 PM7/28/15
to lolodomo, openhab
That is as good as closed as far as openHAB is concerned :(.

lolodomo

unread,
Jul 28, 2015, 5:28:58 PM7/28/15
to openhab, ben.j...@gmail.com, smartp...@gmail.com
And that is really a bad news !

Tommy Sharp

unread,
Jul 29, 2015, 2:22:47 AM7/29/15
to openhab, ben.j...@gmail.com
Was wondering why my house had become so quiet....

I'll have to start looking into how I can get some TTS Service up and running on my local windows 7 machine.....
When it upgrades to Windows10 maybe cortana can be used as the TTS engine?

Kai Kreuzer

unread,
Jul 29, 2015, 4:56:25 AM7/29/15
to openhab, 1tomm...@gmail.com, 1tomm...@gmail.com
Usually the captcha page only occurs if there are too many requests coming from the network/IP and they claim that it is only a temporary measure. So there is some hope that it will get back to normal.
What is strange though is that all of us seem to have too many requests at the same time - this is unlikely. But let's give it a few more days to see if Google TTS becomes available again or if we really need to find other options.

MattSkinah

unread,
Jul 29, 2015, 5:31:12 AM7/29/15
to openhab, 1tomm...@gmail.com, k...@openhab.org
It looks like they simply wish to get paid.
So I'm guessing you can pay the money, get a key string and update the openHab binding to use the new URL which contains the key code. If you do this let us know if it works.

If you have chrome installed it looks like you can use it for free to do TTS since the TTS would be generated on your server and not on google servers which cost them money to run. Can someone add this ability to OpenHAB?

I checked out MaryTTS and it was a lot more robotic sounding than the google translate solution so you can use that as well as another TTS binding that openHAB has.

lolodomo

unread,
Jul 29, 2015, 10:12:38 AM7/29/15
to openhab
TTS through Microsoft Translator could be a free alternative ?

lolodomo

unread,
Jul 29, 2015, 1:57:59 PM7/29/15
to openhab
In my case, that is less than 10 requests per day.
Is it considered too much by Google ?!!

MattSkinah

unread,
Jul 30, 2015, 4:49:03 AM7/30/15
to openhab, smartp...@gmail.com


On Thursday, July 30, 2015 at 12:12:38 AM UTC+10, lolodomo wrote:
TTS through Microsoft Translator could be a free alternative ?

Using Microsoft translator I'm guessing (never looked at it) would not work unless you have OPenHAB running under windows. Google Chrome can be installed on windows, mac and linux so it would be worth looking at this first as it may suit more OpenHAB users. Paying for google translate will probably cost you $1-2 a year if you don't do much with it, only you can work out if you feel that's reasonable for what they provide. The quality of the voice is far better than the following two that I'll discuss that work in OpenHAB right now...

Personally I do not like the idea of sending all my events out to a 3rd party. IE someone with access to the Google server could easily work out what time you leave and arrive back home each day. If you generate the TTS on your own server it has some advantages and also some disadvantages.

Anyway you have two other choices that I have tried out, They are MaryTTS and FreeTTS. To change over it is easy, just go to your ADDONS folder, delete the google binding and place one and only one of these two files into the same folder...

org.openhab.io.multimedia.tts.marytts-1.7.0.jar
org.openhab.io.multimedia.tts.freetts-1.7.0.jar

If you choose to use the FreeTTS, that is all you need to do and everything just worked for me.

MaryTTS appears to have a bug and can not seem to be changed from a female german voice. In the openhab.cfg file you are meant to be able to set the voice by editing a line, however this seems to be broken. You can still get it to work in English but you need to edit every SAY command. This link has the info you need to do it...

Hope the above helps.

lolodomo

unread,
Jul 30, 2015, 6:59:18 AM7/30/15
to openhab
Microsoft translator is a cloud service. We don't care if openHAB is running on Windows or another OS.
That is the same principle as Google TTS service v1 except that an adfitional authentication mechanusm is required.

lolodomo

unread,
Aug 1, 2015, 3:05:37 PM8/1/15
to openhab
In fact, it looks like the API has just changed.

https://github.com/zaf/asterisk-googletts/commit/ee23da1863a47733bef6a2aa57d3947787ca9985

There are new parameters: ie, total, idx and client.

I make a try with these new parameters and it works again. We just have to understand their clear meaning now.


PS: Microsoft Translator is a good alternative for TTS. I just implemented it in my Sonos plugin (Vera). It just requires an additional authentication. You can have a free account with a limit at 2 000 0000 characters per month (that is more than sufficient for our HA usage). And the quality is good.

Patrik Gfeller

unread,
Aug 1, 2015, 5:21:46 PM8/1/15
to ope...@googlegroups.com
Hi all,

also see the same problem here - no TTS with squeezebox/google translate anymore :-(. I see the captcha if I use the URL in the java source code used by sqeezebox action; if I enter the answer manually the .mp3 is still generated using the same API. Thus I think it's not the API; but Google that wants to prevent the use from scripts/programs.

To be independant from future surprizes like this I experiment with the balabolka console options to use system TTS to generate an mp3 in webapps/static that I can play via URL on the squeeze.

In principle this would work fine - but unfortunatley the .mp3 file is locked by openHAB if it was accessed once via http:/... (see test code below).

Any idea how I can replace the file once it has been accessed.

with kind regards,
Patrik

Patrik Gfeller

unread,
Aug 1, 2015, 6:09:49 PM8/1/15
to ope...@googlegroups.com
Hi all,

found how to solve the locked file problem; the following link explains how to disable "useFileMappedBuffer" for windows: Troubleshooting Locked Files on Windows

... with this value set to false I can update files in webapps/static even after they have been accessed :-).

    <init-param>
     
<param-name>useFileMappedBuffer</param-name>
     
<param-value>false</param-value>
   
</init-param>  


Note - I removed the test code in my earlier post; as it did not work - I have to use two separate "executeCommandLine" actions:

var String testString = "Das ist ein Test der Sprachausgabe über die Eingabeaufforderung - : \"Guten Morgen\""
    testString
= testString.replace("\"", "")
    testString
= testString.replace("-", "")
   
// testString = testString.replace(":", "")
   
    logInfo
("test.rules", testString)
   
    executeCommandLine
("C:\\Users\\Patrik\\OneDrive\\openHAB\\tools\\balabolka_console\\balabolka_console.exe -n \"Microsoft Hedda Desktop\" -t \"" + testString + "\" -w C:\\Users\\Patrik\\OneDrive\\openHAB\\webapps\\static\\GutenMorgen.wav")
   
    executeCommandLine
("C:\\Users\\Patrik\\OneDrive\\openHAB\\tools\\lame\\lame.exe --alt-preset voice --tt \"Guten Morgen\" \"C:\\Users\\Patrik\\OneDrive\\openHAB\\webapps\\static\\GutenMorgen.wav\" \"C:\\Users\\Patrik\\OneDrive\\openHAB\\webapps\\static\\GutenMorgen.mp3\"")
   
    logInfo
("test.rules", "Squeezebox TTS")
    squeezeboxPlayUrl
("Kueche", "http://192.168.10.100:8080/static/GutenMorgen.mp3", 50)

Of course I still hope for an elegant solution - but if there's interest and the Google API situation remains the same I could create a wiki entry for this windows work arround (the "Microsoft Hedda Desktop" voice has actually a quite decent quality).

with kind regards,
Patrik


Am Samstag, 1. August 2015 23:21:46 UTC+2 schrieb Patrik Gfeller:
Hi all,

also see the same problem here - no TTS with squeezebox/google translate anymore :-(. As I see the captcha if I use the URL in the java source code used by sqeezebox action. If I enter the string manually the .mp3 is still generated using the same API. Thus I think it's not the API; but Google that wants to prevent the use from scripts/programs.

To be independant from future surprizes like this I experiment with the balabolka console options to use system TTS to generate an mp3 in webapps/static that I can play via URL on the squeeze.

In principle this would work fine - but unfortunatley the .mp3 file is locked by openHAB if it was accessed once via http:/... (see test code below).

Any idea how I can replace the file once it has been accessed.

Testcode used:

var String testString = "Das ist ein Test der Sprachausgabe über die Eingabeaufforderung - : \"Guten Morgen\""
    testString = testString.replace("\"", "")
    testString = testString.replace("-", "")
    // testString = testString.replace(":", "")
    
    logInfo("test.rules", testString)
    
    executeCommandLine("C:\\Users\\Patrik\\OneDrive\\openHAB\\tools\\balabolka_console\\balabolka_console.exe -n \"Microsoft Hedda Desktop\" -t \"" + testString + "\" -w C:\\Users\\Patrik\\OneDrive\\openHAB\\webapps\\static\\GutenMorgen.wav && C:\\Users\\Patrik\\OneDrive\\openHAB\\tools\\lame\\lame.exe --alt-preset voice --tt \"Guten Morgen\" \"C:\\Users\\Patrik\\OneDrive\\openHAB\\webapps\\static\\GutenMorgen.wav\" \"C:\\Users\\Patrik\\OneDrive\\openHAB\\webapps\\static\\GutenMorgen.mp3\"")
    
    logInfo("test.rules", "Squeezebox TTS")
    squeezeboxPlayUrl("Kueche", "http://192.168.10.100:8080/static/GutenMorgen.mp3", 50)

Tommy Sharp

unread,
Aug 1, 2015, 6:37:24 PM8/1/15
to ope...@googlegroups.com

Hi Patrik, I'd be interested in some nice detailed instructions in the wiki to get something working on Windows with a decent sounding voice. I like the idea of not having to rely on an internet connection for TTS especially if openhab is talked about as an intranet of things.

Who knows maybe Cortana in windows 10 could be made to speak out...

On 2 Aug 2015 10:10 am, "Patrik Gfeller" <patrik....@gmail.com> wrote:
Hi all,

found how to solve the locked file problem; the following link explains how to disable "useFileMappedBuffer" for windows ... with this value set to false I can update files in webapps/static even after they have been accessed :-).

    <init-param>
     
<param-name>useFileMappedBuffer</param-name>
     
<param-value>false</param-value>
   
</init-param>  


Note - the test code in my earlier code did not work - I had to use to executeCommandLine:

--
You received this message because you are subscribed to a topic in the Google Groups "openhab" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/openhab/Sb8CuHDDCBk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to openhab+u...@googlegroups.com.
To post to this group, send email to ope...@googlegroups.com.
Visit this group at http://groups.google.com/group/openhab.
To view this discussion on the web visit https://groups.google.com/d/msgid/openhab/882baea2-2702-4d02-9c35-dbf14f630d33%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Martin Klimke

unread,
Aug 1, 2015, 11:56:46 PM8/1/15
to openhab
@Patrik.

Thanks for that great code example

regards Martin

lolodomo

unread,
Aug 2, 2015, 5:54:22 AM8/2/15
to openhab
After few tests, I discovered that the Google API is working again if you just a "client" parameter. So if you add "client=openHAB" in the request, it should work. So probably an easy fix to do in openHAB.

MattSkinah

unread,
Aug 2, 2015, 7:12:19 AM8/2/15
to ope...@googlegroups.com


On Sunday, August 2, 2015 at 7:54:22 PM UTC+10, lolodomo wrote:
After few tests, I discovered that the Google API is working again if you just a "client" parameter. So if you add "client=openHAB" in the request, it should work. So probably an easy fix to do in openHAB.

Thanks that has fixed it for me. For others do the following...

Add this to the openhab.cfg file:

Patrik Gfeller

unread,
Aug 2, 2015, 8:55:58 AM8/2/15
to openhab
Hi all,

I assume that the fix via configuration will not work for squeezebox users; as the squeezebox action has its own constant for the URL:

public class Squeezebox {
 
// ...
 
private final static String GOOGLE_TRANSLATE_URL = "http://translate.google.com/translate_tts?tl=%s&ie=UTF-8&q=";

I'm not familiar with the framework; but @ least it looks like this is not configurable via .cfg. If I'm right it might be worth a feature request to expose this to config as well. A question to a SW architect might also be if it would make sense to use TTS service(s) provided by openHAB in the action; to provide more options and avoid code duplication ...

with kind regards,
Patrik

Patrik Gfeller

unread,
Aug 2, 2015, 9:02:43 AM8/2/15
to openhab
Hi Martin,

thank you for the feedback. I'll continue to follow up on this line. Currently I'm thinking if I could place the code in a script; but I do struggle @ the moment how to pass the parameters without using items to hold them ... but maybe that's the way to go. Anyhow - once I've patched something useable together I'll update a wiki as even with a working google tts some might prefere not to send their TTS strings to the outside world. 

Most likely it will not be very elegant and only work on windows; but's @ least something :-).

with kind regards,
Patrik

Greg

unread,
Aug 9, 2015, 12:35:03 PM8/9/15
to openhab
I can confirm that by adding &client=openhab to the GOOGLE_TRANSLATE_URL for the squeezebox action fixes it (for now).
I've uploaded a compiled jar for anyone wanting to test it out.
Greg
org.openhab.action.squeezebox-1.8.0-SNAPSHOT.jar

Ben Jones

unread,
Aug 16, 2015, 5:11:56 AM8/16/15
to openhab
Finally got a chance to test this Greg and it works great - thanks a million for fixing this!

I trust you have submitted a PR for this fix?

Greg

unread,
Aug 16, 2015, 10:02:32 AM8/16/15
to openhab
Yes I have, although it hasn't been merged yet.  Thanks for testing this.

Wim Vermoens

unread,
Sep 6, 2015, 2:37:11 PM9/6/15
to openhab
Works like a charm! 

Thx!!

Op zondag 9 augustus 2015 18:35:03 UTC+2 schreef Greg:
Reply all
Reply to author
Forward
0 new messages