I found some spare time and tried to implement a Google TTS addon for OH 2. Something similar had been available for openhab 1 already but never was ported until now.
I opened a pull request on Github, the ci-built jar can be downloaded here.
It’s working fine for me, if you find this interesting and give it a try I’d be curious to hear how it went.
I tested this service with Kodi as audio sink and it works very well for me. I’m surprised of the speed especially for cached text / phrases / sentences. Do you have any long-term experience with the size of the googletts/cache/ folder?
One thing I noticed: When you are using different TTS services with several voices you see a very confusing list in e.g. Paper UI or the console (see attached examples). But this is more a problem of the framework not of your implementation - I’ll take care of that.
@kubawolanin@KidSquid Yes, I’ve seen the new Google TTS API. When I submitted this addon there only was the unofficial, undocumented Google Translate API that could do TTS. With the release of the official API it is no longer justifiable to misuse the translate service for this purpose, so I will have to retract my submission until I or someone else finds the time to port it to the new API. Unfortunately I’m very busy these days so I won’t make it anytime soon…
Did you have found a solution for that. I’ve just upgraded from snapshot 2.2.0 to 2.3.0 and the Google TTS stopped working with the same issue. But it is so much better then VoiceRSS.
Hi,
I’ve created a service implementation that uses the new Google Cloud TTS API. I’ve been using it for a week now without any problems but it would be good to here your feedback as well to improve the solution.
The pull request can be found here, the binary can be downloaded from here and this is the documentation for setup.
Cheers,
Gabor
I get an error when adding json file in PaperUI-voice-google_tts settings.
2018-07-13 20:23:24.856 [ERROR] [b.voice.gtts.internal.GoogleCloudAPI] - Error initializing the service using /var/lib/openhab2/gtts/Google Assistant SDK-83f3efb18d22.json
java.lang.IllegalStateException: Could not find TLS ALPN provider; no working netty-tcnative, Conscrypt, or Jetty NPN/ALPN available
at io.grpc.netty.shaded.io.grpc.netty.GrpcSslContexts.defaultSslProvider(GrpcSslContexts.java:256) [271:org.openhab.voice.gtts:2.4.0.201807131451]
at io.grpc.netty.shaded.io.grpc.netty.GrpcSslContexts.configure(GrpcSslContexts.java:171) [271:org.openhab.voice.gtts:2.4.0.201807131451]
at io.grpc.netty.shaded.io.grpc.netty.GrpcSslContexts.forClient(GrpcSslContexts.java:120) [271:org.openhab.voice.gtts:2.4.0.201807131451]
at io.grpc.netty.shaded.io.grpc.netty.NettyChannelBuilder$NettyTransportFactory$DefaultNettyTransportCreationParamsFilterFactory.<init>(NettyChannelBuilder.java:558) [271:org.openhab.voice.gtts:2.4.0.201807131451]
at io.grpc.netty.shaded.io.grpc.netty.NettyChannelBuilder$NettyTransportFactory$DefaultNettyTransportCreationParamsFilterFactory.<init>(NettyChannelBuilder.java:551) [271:org.openhab.voice.gtts:2.4.0.201807131451]
at io.grpc.netty.shaded.io.grpc.netty.NettyChannelBuilder$NettyTransportFactory.<init>(NettyChannelBuilder.java:489) [271:org.openhab.voice.gtts:2.4.0.201807131451]
at io.grpc.netty.shaded.io.grpc.netty.NettyChannelBuilder.buildTransportFactory(NettyChannelBuilder.java:337) [271:org.openhab.voice.gtts:2.4.0.201807131451]
at io.grpc.internal.AbstractManagedChannelImplBuilder.build(AbstractManagedChannelImplBuilder.java:390) [271:org.openhab.voice.gtts:2.4.0.201807131451]
at com.google.api.gax.grpc.InstantiatingGrpcChannelProvider.createSingleChannel(InstantiatingGrpcChannelProvider.java:206) [271:org.openhab.voice.gtts:2.4.0.201807131451]
at com.google.api.gax.grpc.InstantiatingGrpcChannelProvider.createChannel(InstantiatingGrpcChannelProvider.java:157) [271:org.openhab.voice.gtts:2.4.0.201807131451]
at com.google.api.gax.grpc.InstantiatingGrpcChannelProvider.getTransportChannel(InstantiatingGrpcChannelProvider.java:149) [271:org.openhab.voice.gtts:2.4.0.201807131451]
at com.google.api.gax.rpc.ClientContext.create(ClientContext.java:151) [271:org.openhab.voice.gtts:2.4.0.201807131451]
at com.google.cloud.texttospeech.v1beta1.stub.GrpcTextToSpeechStub.create(GrpcTextToSpeechStub.java:74) [271:org.openhab.voice.gtts:2.4.0.201807131451]
at com.google.cloud.texttospeech.v1beta1.stub.TextToSpeechStubSettings.createStub(TextToSpeechStubSettings.java:99) [271:org.openhab.voice.gtts:2.4.0.201807131451]
at com.google.cloud.texttospeech.v1beta1.TextToSpeechClient.<init>(TextToSpeechClient.java:128) [271:org.openhab.voice.gtts:2.4.0.201807131451]
at com.google.cloud.texttospeech.v1beta1.TextToSpeechClient.create(TextToSpeechClient.java:109) [271:org.openhab.voice.gtts:2.4.0.201807131451]
at org.openhab.voice.gtts.internal.GoogleCloudAPI.setConfig(GoogleCloudAPI.java:99) [271:org.openhab.voice.gtts:2.4.0.201807131451]
at org.openhab.voice.gtts.internal.GoogleTTSService.updateConfig(GoogleTTSService.java:196) [271:org.openhab.voice.gtts:2.4.0.201807131451]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:?]
at org.apache.felix.scr.impl.inject.BaseMethod.invokeMethod(BaseMethod.java:229) [32:org.apache.felix.scr:2.0.12]
at org.apache.felix.scr.impl.inject.BaseMethod.access$500(BaseMethod.java:39) [32:org.apache.felix.scr:2.0.12]
at org.apache.felix.scr.impl.inject.BaseMethod$Resolved.invoke(BaseMethod.java:650) [32:org.apache.felix.scr:2.0.12]
at org.apache.felix.scr.impl.inject.BaseMethod.invoke(BaseMethod.java:506) [32:org.apache.felix.scr:2.0.12]
at org.apache.felix.scr.impl.inject.ActivateMethod.invoke(ActivateMethod.java:307) [32:org.apache.felix.scr:2.0.12]
at org.apache.felix.scr.impl.inject.ActivateMethod.invoke(ActivateMethod.java:299) [32:org.apache.felix.scr:2.0.12]
at org.apache.felix.scr.impl.manager.SingleComponentManager.invokeModifiedMethod(SingleComponentManager.java:772) [32:org.apache.felix.scr:2.0.12]
at org.apache.felix.scr.impl.manager.SingleComponentManager.modify(SingleComponentManager.java:727) [32:org.apache.felix.scr:2.0.12]
at org.apache.felix.scr.impl.manager.SingleComponentManager.reconfigure(SingleComponentManager.java:645) [32:org.apache.felix.scr:2.0.12]
at org.apache.felix.scr.impl.manager.SingleComponentManager.reconfigure(SingleComponentManager.java:609) [32:org.apache.felix.scr:2.0.12]
at org.apache.felix.scr.impl.manager.ConfigurableComponentHolder.configurationUpdated(ConfigurableComponentHolder.java:426) [32:org.apache.felix.scr:2.0.12]
at org.apache.felix.scr.impl.manager.RegionConfigurationSupport.configurationEvent(RegionConfigurationSupport.java:284) [32:org.apache.felix.scr:2.0.12]
at org.apache.felix.scr.impl.manager.RegionConfigurationSupport$1.configurationEvent(RegionConfigurationSupport.java:89) [32:org.apache.felix.scr:2.0.12]
at org.apache.felix.cm.impl.ConfigurationManager$FireConfigurationEvent.sendEvent(ConfigurationManager.java:2090) [8:org.apache.felix.configadmin:1.8.16]
at org.apache.felix.cm.impl.ConfigurationManager$FireConfigurationEvent.run(ConfigurationManager.java:2058) [8:org.apache.felix.configadmin:1.8.16]
at org.apache.felix.cm.impl.UpdateThread.run0(UpdateThread.java:141) [8:org.apache.felix.configadmin:1.8.16]
at org.apache.felix.cm.impl.UpdateThread.run(UpdateThread.java:109) [8:org.apache.felix.configadmin:1.8.16]
at java.lang.Thread.run(Thread.java:748) [?:?]
@sjef86 Thank you for testing! It is very strange, because I just tried the 2.4.0-SNAPSHOT version, and it works fine. The difference is that I’m using the official docker image which is build #1305 and java 1.8.0_144…