Page 1 of 1

Can I use Google TTS in Livecode

Posted: Sat Dec 07, 2013 11:57 am
by terryho
Hi,

I try to use the following in Livecode, but can not success.

put "hello word" into tpostsound
replace space with "%20" in tpostsound
put "http://translate.google.com/translate_tts?tl=en&q=" into tpostURL
post tpostsound to URL tpostURL
put it into field "abc"

in the field "abc", is nothing.

Can I use this in Livecode? or I use the wrong method to work with google TTS?

Please help.

Regards

Terry Ho

Re: Can I use Google TTS in Livecode

Posted: Sun Dec 08, 2013 12:17 am
by Simon
Hi terryho,
"it" will contain an error if an error occurred otherwise it will be empty.

But I think you might want speech?
Then I'd use a browser.

Simon
Edit; I did get this to work with a player object.

Re: Can I use Google TTS in Livecode

Posted: Sun Dec 08, 2013 10:33 am
by SparkOut
Is that really a post url? It looks like a "get" to me.

Code: Select all

put "hello word" into tpostsound
   replace space with "%20" in tpostsound
   put "http://translate.google.com/translate_tts?tl=en&q=" & tpostsound into tpostURL
   get URL (tpostURL)
   put it into field "abc"
should get you some binary data in the field. But that surely isn't going to help? (Especially not in a field - if you needed to store binary, make it a custom property).

Re: Can I use Google TTS in Livecode

Posted: Mon Dec 09, 2013 8:22 am
by terryho
Hi SparkOut,

You hint the point.

Now it is work, with the following code, which will save a wav file

put "hello word" into tpostsound
replace space with "%20" in tpostsound
put "http://translate.google.com/translate_tts?tl=en&q=" & tpostsound into tpostURL
get URL(tpostURL)
put it into URL ("binfile:/users/terry/abc.wav")

you can play back the abc.wav file

Regards

Terry Ho