Amazon Polly TTS code

Hi,

I want to use Amazon Polly TTS engine for text-to-speech resulting in mp3 file.
On the documentation, I can find example codes to use with Java, PHP, ruby or phyton. But of course there is no groovy example.
I couldn’t figure out how to write something to produce sound from the amazon Polly TTS API.
Any ideas ?

Take a look at Big Talker. I believe @rayzurbock is using something similar in his code.

thanks. but I’ve checked his code. He’s not using any 3rd party TTS engine. His app is directly using Smartthings’ TTS.
any other ideas ?

When I was setting up Ask Alexa, there was a page that you could goto that you could type into a box and then it would say what you typed in the Alexa voice. You could use that and audio recorder on a PC or Mac…

Don’t know where the page is located but it’s out there.

Amazon Polly is doing that in more than 20 languages.
but I need a web service that my smart app will call and get the sound file dynamically.
so a form with textbox will not help me.

I was focused on the above statement.

sorry for misleading…

Perhaps you can customize the workaround that @ule posted when SmartThings was having major issues with it’s own TTS engine?

St uses poly`s deprecated parent, though it’s name escapes me, Livonia or something…

You’re going to have to roll your own thing here on a separate host on your lan. You won’t be able to include the required libraries in an st app…

1 Like

Poly’s deprecated parent is Ivona.
Actually I need Turkish language TTS. And currently only Ivona, Polly and Ispeech suppports Turkish TTS. Google does not.

Since Ivona is deprecated, I am left with ispeech and Polly.
Ispeech is easily called with a web url. No libraries are needed. But it is very expensive. Smaller package is 200 usd.

I had thought same would be possible for Polly. That I would be able to call it with a simple URL including a key or user.
is that not possible ?

thanks. but as far as I know Google TTS does not support Turkish.
VoiceRSS is also limited to a few languages.

I sent the code as an example of how third party TTS is done withing SmartThings custom code. You’ll need to modify to fit the Polly (or other) API calls/urls.

where did you send it ?

Post #8 above

SmartThings is no longer using Ivona and is now using Polly which as you know has Turkish support as well as a bunch of other languages listed here.

So for Turkish could just do

textToSpeech("Some text to speech", "Filiz")

If no voiceId is passed in then it defaults to the Sally VoiceId (en-us)

3 Likes

is this a groovy command?

great !! that really works.
but I have a problem using it.

if I pass a text with special Turkish characters to this command, it fails with following error:

1:05:24 AM: error com.amazonaws.services.s3.model.AmazonS3Exception: The request signature we calculated does not match the signature you provided. Check your key and signing method. (Service: Amazon S3; Status Code: 403; Error Code: SignatureDoesNotMatch; Request ID: 83E07B6C8684F4E1), S3 Extended Request ID: Cnh3ckkGNuKXH8QD6dux2JzTEeBAJz7mNBQDNs0+ciYR9SoOOcyqQGSRavZEu6RfxtKrOa0JS/s= @ line 521

if I remove Turkish characters , it works.

for example;

this one works:
state.sound = textToSpeech(“Bugun, 17 Agustos Persembe . Hava durumu Sabah saatlerinde gok gurultulu saganak yagisli.”, “Filiz”)

this one does not:
state.sound = textToSpeech(“Bugün, 17 Ağustos Perşembe . Hava durumu Sabah saatlerinde gök gürültülü sağanak yağışlı.”, “Filiz”)

How can I solve this issue ?

Does it work with the special characters if you use the simulator on the Polly web site?

yes it does.

BTW, I would be surprised if it did not. if Amazon Polly supports Turkish it should work with Turkish text.