Can I use Google TTS in Livecode

Visuals, audio, animation. Blended, not stirred. If LiveCode is part of your rich media production toolbox, this is the forum for you.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
terryho
Posts: 126
Joined: Mon Nov 05, 2012 2:53 pm

Can I use Google TTS in Livecode

Post by terryho » Sat Dec 07, 2013 11:57 am

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

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am
Location: Palo Alto

Re: Can I use Google TTS in Livecode

Post by Simon » Sun Dec 08, 2013 12:17 am

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.
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

SparkOut
Posts: 2852
Joined: Sun Sep 23, 2007 4:58 pm

Re: Can I use Google TTS in Livecode

Post by SparkOut » Sun Dec 08, 2013 10:33 am

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).

terryho
Posts: 126
Joined: Mon Nov 05, 2012 2:53 pm

Re: Can I use Google TTS in Livecode

Post by terryho » Mon Dec 09, 2013 8:22 am

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

Post Reply

Return to “Multimedia”