Amazon Polly TTS voice service

Pollytts voice service binding 2.2-snapshot is available in the marketplace.

PollyTTS is a TTS voice service for Openhab 2.x utilizing a Internet based TTS service provided by amazon called Polly. Polly includes multiple life like voices for a given languages. Can now select different voices within rules depending on the message context.

You can find information on Amazon Polly here.

Instructions

7 Likes

Sounds like it would be very useful if you ask me. But do you have to pay for the service? The link you gave indicates a cost per character.

Always good to have other options!

1 Like

The free tier includes 5 million characters per month for the first 12 months. It looks like it’s $4 for a million characters after the one year. I plan to reevaluate using it after a year when and if the free tier ends for me.

1 Like

This sounds very interesting to me, the voice quality seams quite good!
Is your TTS service caching? In this case, 5 milion characters seams endlessly much, at least in my set-up.

Yes it does cache, I used the code base from voicerss to get started so it functions in the same manner. I’m working on a first cut at use and configuration. Hope to be able to share it in a few days.

Hey!
I’ve actually submitted an issue on openhab2-addons repo a while ago :slight_smile:

If anyone’s interested in developing the add-on, feel free to grab my code from there -> https://github.com/kubawolanin/openhab2-addons/tree/ivona/addons/voice/org.openhab.voice.ivona

There’s not much actual code, to be honest. It was my first time playing around with the openHAB code, but it’s a start. :slight_smile:
As I said in the comments, Ivona SpeechCloud has become Amazon Polly, so it would make sense to create an add-on for Polly directly (org.openhab.voice.polly). Both require AWS SDK to work.

Cheers!

1 Like

Here is the info on how to use and download the snapshot of my implementation of the Amazon Polly voice service for openhab. It’s fully functional, supports all the voices and languages, a total of 47. I built it on the current 2.1 master but it runs on openhab 2.0 which I’m using.


The polly branch contains the source.

1 Like

That’s what I’ve developed. Check out: wiki below

@hillmanr hey Robert, this is amazing and I’m excited to test it! :slight_smile:
Although, your Dropbox link from Installation wiki seems to be not accessible:

Error (403)
It seems you don't belong here! You should probably sign in. Check out our Help Center and forums for help, or head back to home.

Can’t wait to test it out.

Did you consider creating a Pull Request to the openhab2-addons already?
This way it’ll automatically build the JAR that’d be accessible from this page. Plus, you gain Travis CI and static code analysis against Code Guidelines.

Cheers!
Kuba

@hillmanr I’ve built your addon and so far I’m experiencing fantastic results. Great job!

Here’s a compiled JAR (10.06.2017)

A few remarks:

  1. In PaperUI (#/configuration/services) your add-on’s name is VoiceTTS instead of PollyTTS
  2. First thing I did afer building the JAR was placing it to the /addons/ folder. NPE appeared in my log file due to the fact I didn’t put pollytts.cfg config file in /services/ folder
2017-06-10 09:32:01.428 [ERROR] [ce.pollytts.internal.PollyTTSService] - Failed to activate PollyTTS: Missing access key, configure it first before using
org.eclipse.smarthome.core.voice.TTSException: Missing access key, configure it first before using
	at org.openhab.voice.pollytts.internal.cloudapi.PollyClientConfig.PollyInit(PollyClientConfig.java:68)
	at org.openhab.voice.pollytts.internal.cloudapi.PollyClientConfig.<init>(PollyClientConfig.java:62)
	at org.openhab.voice.pollytts.internal.PollyTTSService.activate(PollyTTSService.java:64)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[:1.8.0_131]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)[:1.8.0_131]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[:1.8.0_131]
	at java.lang.reflect.Method.invoke(Method.java:498)[:1.8.0_131]
	at org.apache.felix.scr.impl.inject.BaseMethod.invokeMethod(BaseMethod.java:224)
	at org.apache.felix.scr.impl.inject.BaseMethod.access$500(BaseMethod.java:39)
	at org.apache.felix.scr.impl.inject.BaseMethod$Resolved.invoke(BaseMethod.java:617)
	at org.apache.felix.scr.impl.inject.BaseMethod.invoke(BaseMethod.java:501)
	at org.apache.felix.scr.impl.inject.ActivateMethod.invoke(ActivateMethod.java:302)
	at org.apache.felix.scr.impl.inject.ActivateMethod.invoke(ActivateMethod.java:294)
	at org.apache.felix.scr.impl.manager.SingleComponentManager.createImplementationObject(SingleComponentManager.java:297)[40:org.apache.felix.scr:2.0.6]
	at org.apache.felix.scr.impl.manager.SingleComponentManager.createComponent(SingleComponentManager.java:108)[40:org.apache.felix.scr:2.0.6]
	at org.apache.felix.scr.impl.manager.SingleComponentManager.getService(SingleComponentManager.java:906)[40:org.apache.felix.scr:2.0.6]
	at org.apache.felix.scr.impl.manager.SingleComponentManager.getServiceInternal(SingleComponentManager.java:879)[40:org.apache.felix.scr:2.0.6]
	at org.apache.felix.scr.impl.manager.SingleComponentManager.getService(SingleComponentManager.java:823)[40:org.apache.felix.scr:2.0.6]
	at org.eclipse.osgi.internal.serviceregistry.ServiceFactoryUse$1.run(ServiceFactoryUse.java:212)[org.eclipse.osgi-3.10.101.v20150820-1432.jar:]
2017-06-10 09:34:02.126 [ERROR] [org.openhab.voice.pollytts          ] - [org.openhab.pollytts(239)] modified method [modified] not found; Component will fail
2017-06-10 09:34:02.127 [ERROR] [org.openhab.voice.pollytts          ] - [org.openhab.pollytts(239)] Declared modify method 'modified' cannot be found, configuring by reactivation
2017-06-10 09:34:05.350 [INFO ] [ce.pollytts.internal.PollyTTSService] - Using PollyTTS cache folder /var/lib/openhab2/pollytts/cache
2017-06-10 09:35:53.620 [ERROR] [org.openhab.voice.pollytts          ] - [org.openhab.pollytts(239)] Declared modify method 'modified' cannot be found, configuring by reactivation
2017-06-10 09:35:54.219 [INFO ] [ce.pollytts.internal.PollyTTSService] - Using PollyTTS cache folder /var/lib/openhab2/pollytts/cache

Then I placed a proper config file with my credentials and it went all OK :slight_smile:

I like the addon very much! Thank you for your work.

Best regards,
Kuba

I fixed the link so the snapshot jar is accessible. I’ll look into the pull process.

1 Like

Thanks for the feedback, I fixed those Issues.

1 Like

Interesting development. I see Amazon Polly also supports Dutch. I will probably start using this one when integrated with OpenHAB.

1 Like

works great! :slight_smile:

Any idea how I can add a button/widget which read out loud the weather information via text-to-speech?

Couldn’t be easier :wink:

items:

Weather_Condition
Weather_Temp // temperature
Some_Button
rule "Speak the weather"
when
    Item Some_Button received command ON
then
        var String weather = transform("MAP","weather_en.map", Weather_Condition.state.toString)
        say("Today is " + weather + " and there's " + Weather_Temp.state + " degrees")
end

Great thanks!
I’m currently working with the PaperUI, so as I think its not possible to add rules/scripts like this. I need to add this as a file, right? Sorry for this “newbie” question - but it’s the 2nd day with OH2 :smiley: But I’m loving it :slight_smile:

Cool, glad you like it! :slight_smile: Check out the documentation first.

@hillmanr may I suggest you to submit your work as a Pull Request with a [WIP] flag in the title already?
This way your addon will gain more visibility and more people would have access to it.

Cheers,
Kuba

Hi,
Can you show your config file (obviously with your credentials scrambled)? I placed the JAR file in my addons-folder, and I am also getting the “Missing access key” error.

Dries

######################## Polly Text-to-Speech Engine ########################

accessKey=AKIAJIRxxxxxxxxxxxxxxxxxx
secretKey=1zv6YP96xxxxxxxxxxxxxxxxxxx
serviceRegion=us-east-1