Amazon Polly TTS code


(ilker Aktuna) #1

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 ?


(Bill S.) #2

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


(ilker Aktuna) #3

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 ?


(Ron Talley) #4

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.


(ilker Aktuna) #5

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.


(Ron Talley) #6

I was focused on the above statement.


(ilker Aktuna) #7

sorry for misleading…


(Brian S. Lowrance) #8

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


(Mike Maxwell) #9

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


(Mike Maxwell) #10

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…


(ilker Aktuna) #11

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 ?


(ilker Aktuna) #12

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


(Brian S. Lowrance) #13

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.


(ilker Aktuna) #14

where did you send it ?


(Brian S. Lowrance) #15

Post #8 above


(Ryan Applegate) #16

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.

http://docs.aws.amazon.com/polly/latest/dg/voicelist.html

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)


[DEPRECATED] webCoRE Beta Milestone 2
(ilker Aktuna) #17

is this a groovy command?


(ilker Aktuna) #18

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 ?


(Pizzinini) #19

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


(ilker Aktuna) #20

yes it does.

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