Search code examples
javascripttext-to-speech

Speech (TTS) in JavaScript


I am using JavaScript for changing text to speech. For this purpose I use following script:

var Obj = new ActiveXObject("Sapi.SpVoice");
Obj.Speak(string, 1 );

But this is running in IE because of ActiveX, how may I run this in all other browsers?


Solution

  • Browsers based on Webkit (Google Chrome, Safari) have HTML5 speach input.

    <input type="text" x-webkit-speech />
    

    Example

    Unfortunately Firefox doesn't have such method.

    There is no good cross-browser solution yet.

    There is one project called WAMI it work with their server side using Java applet. It may be helpful for you as java can be installed to any browser.