|
|
WebSpeech(updated on Mar 11, 2011) WebSpeech is a Javascript library for developers who want to write pages with voice. It can be downloaded from http://sourceforge.net/projects/e-guidedog/files/WebSpeech/ Here is a simple example:
<html>
<head>
<script type='text/javascript' src='WebSpeech.js'></script>
</head>
<body>
Have you heard the voice?
If not, please make sure Flash plug-in has been installed.
And this example should be put on web server (not open it as a local file)!!
<script type='text/javascript'>
WebSpeech.setVoice('en');
WebSpeech.speak('hello world');
WebSpeech.setVoice('de+f2');
WebSpeech.setSpeedDelta(50);
WebSpeech.speak('Guten Tag');
WebSpeech.setVoice('zhy');
WebSpeech.speak('123');
</script>
</body>
</html>
Here is a more complicated example: Why can we make web page speakable with WebSpeech? That's because there is a Web TTS server behind it. The default Web TTS server is http://wa.eguidedog.net. This server provides free service for the public. You can also setup your own Web TTS server with the help of WebAnywhere's document. If you think this service is useful, I really appreciate your donation, which is significant to the persistence of WebSpeech and eGuideDog project. Here is the API of WebSpeech:
// default is 'http://wa.eguidedog.net'
WebSpeech.server = 'your new TTS server';
WebSpeech.speak('text to speak');
WebSpeech.pause();
WebSpeech.resume();
WebSpeech.stop();
// set callback function, which will be called when speeches finish
WebSpeech.onfinish = function () { ... };
// voiceName can be EkhoMandarin (default), EkhoCantonese
// or any voice name in eSpeak
WebSpeech.setVoice('voiceName')
WebSpeech.getSpeedDelta(); // return speed delta
WebSpeech.setSpeedDelta(value); // -50 <= value <= 100
WebSpeech.getPitchDelta();
WebSpeech.setPitchDelta(value); // -100 <= value <= 100
WebSpeech.getVolumeDelta();
WebSpeech.setVolumeDelta(value); // -100 <= value <= 100
// like SaveAs action in the browser
WebSpeech.saveMp3('text to save to MP3 format file');
WebSpeech.saveOgg('text to save to OGG format file');
// when data available, callback function will be called and
// the result will pass as the arguments.
WebSpeech.getPhonSymbols('text', function (success, symbols) { ... });
|
|
| Copyright 2006 - 2012, eGuideDog team | |