Thursday, December 24, 2009

How to Use TextToSpeech Feature of Google

Here is how you can make your own TextToSpeech App, using Google's un-documented API.

Google Has an undocumented REST API to get TextToSpeech

http://translate.google.com/translate_tts?q=your+text+goes+here
Here is the HTML Code. Do not miss to see the screen-cast.

<html>
<head>
<title>
Text To Speech Demo
</title>
<script>
function GetSpeech()
{
var framehtml="<iframe src=\"http://translate.google.com/translate_tts?q=";
framehtml+=escape(document.getElementById("mytext").value);
framehtml+="\" </iframe>";

document.getElementById("myframe").innerHTML=framehtml;
/*we are done!!!!!*/
/* we will test now*/
/*wow!!!!! its working :) */

}
</script>
</head>
<body>
Enter your text Here
<textarea id="mytext">
</textarea>
<button id="mybutton" onclick="GetSpeech();">
Click me to get the text
</button>
<div id="myframe">
</div>
</body>
</html>

Here is a screen-cast


Thanks Guys
Happy Christmas

No comments:

Post a Comment