Text to Speech Using JavaScript


<html xmlns=”http://www.w3.org/1999/xhtml”>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″ />
<title>Untitled Document</title>
<script type=”text/javascript” language=”javascript” src=”Speech.js”>
</script>
</head>
<body>
<input type=”text” id=”t1″/>
<input type=”button” id=”bt1″ name=”Speek Loud” value=”Speak Loud” onclick=”speakLoud()”/>
</body>
</html>

Check this sample code to convert Text to Speech Using JavaScript………..It works only in IE Becoz ActiveX is supported only in Internet Explorer.

<html>

<head>

<title>Text to speech Using JavaScrip</title>

<script type=”text/javascript” language=”javascript” src=”Speech.js”>

</script>

</head>

<body>

<input type=”text” id=”t1″/>

<input type=”button” id=”bt1″ name=”Speek Loud” value=”Speak Loud” onclick=”speakLoud()”/>

</body>

</html>

// JavaScript Document

Speech.js

function speakLoud()

{

var Obj = new ActiveXObject(“Sapi.SpVoice”);

var string=document.getElementById(“t1″).value;

alert(“You have entered”+string);

Obj.Speak(string, 1 );

}

speech

Download Code

Comments
One Response to “Text to Speech Using JavaScript”
  1. Thank you a bunch for sharing this with all of us you actually know what you are speaking about! Bookmarked. Please additionally discuss with my web site =). We may have a link exchange agreement between us

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.