GoogleTTS responding with 503 error (even after the URL fix)

This is due to the fact that google is blocking automated request on their servers for TTS.

I get the same issue as you and I’m a little bit stuck and don’t know what TTS to use. I tried Mary but there is no french support into the binding.

A good news, I found a service that can substitue the google one : http://www.voicerss.org/api/ as this service is returning a voice file by calling an url with some parameters it has the same behaviour as the google tts. Here is the parameters that worked for me:

1- create your API key by registering to the site
2-enter the following parameters into your openhab.cfg
googletts:language=fr-fr
googletts:translateUrl=https://api.voicerss.org/?key=YOUR API KEY HERE&hl=%s&src=%s
3- enjoy :smile:

Don’t forget to have the google TTS binding installed

3 Likes

This is a great find @1technophile - I am going to update the Squeezebox action binding to allow the option to use this service since the Google TTS service is next to useless these days.

Thanks for sharing!!

With pleasure !

Thats great news Ben! I have been waiting for the Squeezebox action to get fixed again. Can it be set to have a line in the openhab.cfg file, something like squeeze:speak.url=https://api.voicerss.org/?key=XXXXXXXXXX&hl=%s&src=%s
so that the actions binding doesn’t need to be fixed whenever a TTS service quits working.

Yep - that is exactly how I intend to implement it. I have got a test version running now which I will test for a few days before submitting a PR for this change.

Hello Ben,

do you have any news for us?

I haven’t got much time at the moment unfortunately. I have knocked up a temp version of the Squeezebox action binding using the new VoiceRSS service and it is working pretty good.

It is not as quick as Google was with generating the translations, so there is a delay of a second or two, but the voice is reasonably natural sounding and it seems to be handling the simple cases I am throwing at it.

I am away this weekend again but hopefully should have something ready for committing in a week or so. Apologies for the delay, life has gotten very busy all of a sudden!

Hallo Ben,

no problem, thanks for your work!

Hi all,

also looking forward to be able to configure the TTS URL in the binding … I’ve also looked into alternatives to be less dependent on 3rd party services like google TTS (or any other). Also did some of the users mention they do not like to transmit data to the web for text to speech.

After some experiments with scripts I ended up writing a small M$-Windows REST service that can generate an mp3 from an Url (Prototape available here: https://dl.dropboxusercontent.com/u/1781347/RESTTTS.zip).

It’s in an early stage and only works on windows …

Once we can configure the URL in the binding I’ll give it a test with the squeezebox action - currently I only experimented with the browser (http://127.0.0.1:8089/Service/TTS?text=).

with kind regards,
Patrik

Thanks for this work Ben.
I agree it would be nice to move away from cloud services that may change or stop.
FYI the asterisk and and anki crowd implemented some new changes to their googletts calls that seem to work (for the moment).
(https://github.com/zaf/asterisk-googletts/blob/master/googletts.agi)
(https://github.com/AwesomeTTS/AwesomeTTS/blob/develop/addon/awesometts/service/google.py)

voicerss seems to be gone…

as an alternative, i managed to install picotts locally using this instructions.

http://blog.robotnet.de/2014/03/25/speak-friend-and-enter-speech-synthesis-with-espeak-and-svox-pico-for-the-raspberry-pi/

seems ok.

@Nicola_Reina This looks pretty interesting. to my mind having a local TTS engine seems like a good idea.

Do you have any details of how you handled the integration with Openhab. i.e. did you somehow configure it to read urls and return a wav like the google TTS service, or did you do it some other way.

BTW I Stumbled across some info about installing on Jessie and that these packages are now available:

https://packages.debian.org/jessie/all/libttspico-data/download
https://packages.debian.org/jessie/armhf/libttspico0/download
https://packages.debian.org/jessie/armhf/libttspico-utils/download

if you add the following to your sources.list:
deb http://ftp.de.debian.org/debian jessie main non-free

you can apt-get them, seems to work ok.

I completely agree - a local TTS service makes a lot more sense. VoiceRSS is working ok in my test setup (sorry it is a very busy time of year I haven’t had a chance to code it up properly yet) but the delay is noticeable, especially when announcing long sentences that have to handled in two requests (VoiceRSS only allows up to 100 chars per request).

I am going to look into a ttspico and see if I can get that working. Would love to be free of these online services!

Hi I installed it locally using the instructions at the link .
I have not yet integrated it but in the end it could just be a matter of using exec binding…
I mean you do not have to have any wav file you just pass the sentence to speak to the command and… it speaks

Hey guys,

I spent some time today playing around with pico2wave and building a simple PHP script to replicate what the Google TTS service does. Had some reasonable success, instructions below.

You should be able to run this on a local server (using apache or the like) and then point your Google TTS binding to this URL. It expects two parameters in the URL - language (e.g. en-GB) and message to translate.

Installation

  • install the necessary dependencies (pico2wave, lame)
    • sudo apt-get install libttspico0 libttspico-utils libttspico-dev libttspico-data lame
  • install PHP composer (needed to install/use phplame)
  • copy the two files attached here to a folder under /var/www
    • e.g. /var/www/tts
    • ensure your web server has sufficient permissions to create files in this directory (e.g. owned by www-data)
  • run composer to resolve the necessary dependencies
    • sudo composer install
  • setup your web server to allow requests to /var/www/tts
    • beyond the scope of these instructions
  • test by typing in the following to your browser;

I am using this in my hacked Squeezebox speak action (which I have hardcoded to call this URL) and it is nice and quick and the GB voice is quite fluid and sounds really good IMO.

Let me know if this helps!
Ben

tts.pdf (810 Bytes)

This file is actually a ZIP, so rename the extension to .zip and extract the two files to your /var/www/tts folder.

I’ve been playing with this as well over the last few days. I’m quite happy with the pico2wave results. I did this with a rule instead which I’ll share for those interested. Again pico2wave and lame need to be installed. First a lambda expression to replace squeezeboxSpeak

val org.eclipse.xtext.xbase.lib.Functions$Function3 squeezeSay = [
    String playerID,
    String message,
    int volume |
            executeCommandLine("pico2wave@@--wave=/tmp/openhab.wav@@"+message)
            Thread::sleep(500)
            executeCommandLine("lame@@-V2@@/tmp/openhab.wav@@/tmp/openhab.mp3")
            Thread::sleep(500)
            squeezeboxPlayUrl(playerID,"/tmp/openhab.mp3",volume) ]

then just replace squeezeboxSpeak with squeezeSay.apply ie:

squeezeSay.apply("mainPlayer","My Message",20)

Make sure the directory you use (in my case /tmp) can be reached by both openhab and the logitech media server. If openhab is running on a faster computer, you may be able to decrease the sleep times. The only downside is that squeezeboxPlayUrl does not have a resume function.

I have just create a pull request with some changes to the Squeezebox io and action bundles to allow TTS URL configuraton. Note that I have removed the language config option as this is just a parameter in the TTS URL. The URL just needs a single %s parameter which is substituted with the text to be translated. I have also updated the openhab_default.cfg with details about the new configuration options.

1 Like