Google TTS addon for OH2

I was so far using MaryTTS and wanted to switch to GoogleTTS. I did follow the installation instruction (including the billing part).
I installed the google voice addon and configured it accordingly. After selecting Google voice as default text to speach in configuration I was not able to select the google voices (just the Mary TTS voices were listed). I tried to uninstall google voice addon and MaryTTS and restart openhab and just installed the google voice addon. Now I can’t even select google TTS as default text to speach under configuration anymore even after a openhab restart. I installed MaryTTS again and I can select it as always. Any ideas what I could try?

I am on OpenHab 2.4.0 stable release.

NoTechi

Update: Found the problem. I enabled the google cloud api assuming this would include the tts api. Thats not the case so the tts api has to be enabled explicitly.

same problem here , i use voicerss in place , i’m on 2.5m5

Anyone else experiencing the following error after upgrading to 2.5 stable?

2019-12-16 19:48:10.354 [ERROR] [org.openhab.voice.googletts ] - bundle org.openhab.voice.googletts:2.5.0 (327)[org.openhab.voice.googletts.internal.GoogleTTSService(411)] : The activate method has thrown an exception
java.lang.VerifyError: Bad type on operand stack
Exception Details:
Location:
com/google/auth/oauth2/OAuth2Utils.()V @31: putstatic
Reason:
Type ‘com/google/api/client/http/javanet/NetHttpTransport’ (current frame, stack[0]) is not assignable to ‘com/google/api/client/http/HttpTransport’
Current Frame:
bci: @31
flags: { }
locals: { }
stack: { ‘com/google/api/client/http/javanet/NetHttpTransport’ }
Bytecode:
0x0000000: 1229 b800 2ab3 002b 122c b800 2ab3 002d
0x0000010: 122e b800 2ab3 002f bb00 3059 b700 31b3
0x0000020: 0032 bb00 3359 b700 34b3 0035 b800 36b3
0x0000030: 0006 1237 b800 38b3 0039 123a b300 1012
0x0000040: 3bb3 0015 b1

at com.google.auth.oauth2.GoogleCredentials.fromStream(GoogleCredentials.java:141) ~[?:?]

@wborn @gbicskei

Is this something you could look at to see if it is 2.5 related?

I gave it a test and with openHAB 2.5 the Google TTS add-on works fine for me on an Intel NUC and Raspberry Pi 3B.

Since the exception is spitting bytecode and talking about operands on stacks the issue seems low level. Maybe its due to file/memory corruption or some JVM issue? What Java version do you use?

I submitted a new version for the Google TTS add-on recently - If you like you can give it a try - *.jar file for testing is attached on GitHub:

  • Refactored to use openHAB Core OAuth2 -> Removed dependencies on Google libraries

For authentication I replaced the serviceAccountKey configuration parameter by clientId, clientSecret and the one-time required authcode .

I am using the docker image, maybe the java version inside the docker image is not compatible?

I will try this one, but first need to figure out again how that replacing with a snapshot version works;)

I’m using the Debian based Docker images and they work fine for me. Do you use the Alpine or Debian images?

Im using version 2.5 of https://hub.docker.com/r/openhab/openhab/. Im not specifying a distro so I think it will default to Debian:

debian for Debian 10 “buster” (default when not specified in tag)

The default image is indeed based on Debian.

What architecture are you using? You can check that on the command line using: uname -i

Are you sure you’re using the add-on part of OH 2.5 and not some JAR in the /addons directory?

It should show 2.5.0 on the Console when issuing

openhab> bundle:list -s | grep googletts
273 │ Active │  80 │ 2.5.0                   │ org.openhab.voice.googletts

Does anyone know if the addon caches the voice? Just like VoiceTSS does (with the bad quality)

So for example, i send “The alarm has been swiched on” to Google. Google sends a wavefile back and openhab saves the file and uses it again the next day when the alarm has been switched on. So this will cost only one time the characters.

This is because of the billing, i’m not jumpy about giving my credit card data to google with the risk, something went wrong with the speech engine and i will be billed… It’s just hobby :slight_smile:

This is for example already 79 chars (in stead of 18 you will expect):

<speak>  <say-as interpret-as="cardinal">12345</say-as> and one more</speak>

Yes, it does. The add-on stores MP3 files on your local disc. You can find them in $OPENHAB_USERDATA/cache/org.openhab.voice.googletts/.

I will add a note to the docs.

1 Like

I have been using Google TTS alot for long. I have never had a bill. And because it do cache the voice, I doubt any “ordinary” people/family would ever reach the limit.

But nobody can say for sure if Google some day change the limit…

1 Like

Thnx guys! I installed it and added the billing info. The project has a nice dashboard so I can monitor the usage.

The voice is really good, wavenet is even better!

Where did you find the dashboard?

I install this version and I have no more error like here : Google Calendar Scheduler - No instructions in log file (conflit with gcal binding).
I clean the cache and enter OAuth2 parameters. Everything seems to be ok.

2020-01-24 15:05:15.385 [INFO ] [oauth2client.internal.OAuthConnector] - grant type authorization_code to URL https://accounts.google.com/o/oauth2/token success
2020-01-24 15:05:15.544 [WARN ] [.googletts.internal.GoogleTTSService] - Audio format OGG_OPUS is not yet supported.
2020-01-24 15:05:15.591 [WARN ] [.googletts.internal.GoogleTTSService] - Audio format OGG_OPUS is not yet supported.

But I can’t choose voice :

 voice voices
An unexpected error occurred during execution.

and log :

15:09:26.903 [ERROR] [arthome.io.console.ConsoleInterpreter] - An error occurred while executing the console command.
java.util.NoSuchElementException: null
        at java.util.ArrayList$Itr.next(ArrayList.java:862) ~[?:1.8.0_242]
        at org.eclipse.smarthome.core.voice.internal.VoiceManagerImpl.getPreferredVoice(VoiceManagerImpl.java:438) ~[?:?]
        at org.eclipse.smarthome.core.voice.internal.VoiceConsoleCommandExtension.getDefaultVoice(VoiceConsoleCommandExtension.java:108) ~[?:?]
        at org.eclipse.smarthome.core.voice.internal.VoiceConsoleCommandExtension.execute(VoiceConsoleCommandExtension.java:85) ~[?:?]
        at org.eclipse.smarthome.io.console.ConsoleInterpreter.execute(ConsoleInterpreter.java:55) [bundleFile:?]
        at org.eclipse.smarthome.io.console.karaf.internal.CommandWrapper.execute(CommandWrapper.java:78) [bundleFile:?]
        at org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:68) [bundleFile:4.2.7]
        at org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:86) [bundleFile:4.2.7]
        at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:599) [bundleFile:4.2.7]
        at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:526) [bundleFile:4.2.7]
        at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:415) [bundleFile:4.2.7]
        at org.apache.felix.gogo.runtime.Pipe.doCall(Pipe.java:416) [bundleFile:4.2.7]
        at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:229) [bundleFile:4.2.7]
        at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:59) [bundleFile:4.2.7]
        at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_242]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_242]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_242]
        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_242]

I’m using OH 2.5 and zulu-8 (8.44.0.11)

https://console.cloud.google.com/apis/api/texttospeech.googleapis.com/quotas?project=annular-lodge-237320&duration=P30D < this is my link. should work on your account also i guess.

1 Like

Found it… Thanks…

re:
[org.openhab.voice.googletts ] - bundle org.openhab.voice.googletts:2.5.1 (288)[org.openhab.voice.googletts.internal.GoogleTTSService(315)] : The activate method has thrown an exception
java.lang.VerifyError: Bad type on operand stack

Did you find a solution to this problem? I am experiencing the same issue on Ubuntu 19.10 and haven’t had any luck working out what is going on.