Tuesday, September 15th, 2009
WAMI lets you add speech recognition to any web page
Andrew Sutherland is giving a presentation at The Ajax Experience tomorrow at 9:30am where he will announce the availability of WAMI (Web-Accessible Multimodal Applications).
WAMI is a project out of MIT that lets you plug voice recognition directly into a javascript powered page, and optionally record+save audio files of people talking.
There are a couple of great demo videos that show it in action:
The “hello world” of WAMI is an application that listens to what you say and repeats it back to you, all via:
- ar myWamiApp;
- function onLoad() {
- //div in which to put the audio button, see below
- var audioDiv = document.getElementById('AudioContainer');
- // JSGF grammar for your application
- var jsgf =
- "#JSGF V1.0;\n" +
- "grammar parrot;\n" +
- "public <top> = hello wami | i want a cracker | feed me;\n";
- var grammar = {"language" : "en-us", "grammar" : jsgf };
- //Audio options.
- //pollForAudio: must be true for speech synthesis to work.
- //If your application doesn't use speech synthesis, set this to false.
- var audioOptions = {"pollForAudio" : true};
- //Configuration options.
- //sendIncrementalResults: if true, you'll receive "incremental" recognition results as the user speaks
- //sendAggregates: if true, you'll receive a "semantic" interpretation. Your grammar
- //must follow a specific format.
- var configOptions = {"sendIncrementalResults" : false, "sendAggregates" : false};
- //Handlers are functions which are called for various events:
- var handlers = {"onReady" : onWamiReady, //WAMI is loaded and ready
- "onRecognitionResult" : onWamiRecognitionResult, //Speech recognition result available
- "onError" : onWamiError, //An error occurred
- "onTimeout" : onWamiTimeout}; //WAMI timed out due to inactivity
- //Create your WAMI application with the settings and grammar we just created
- myWamiApp = new WamiApp(audioDiv, handlers, "json", audioOptions, configOptions, grammar);
- }
- function onWamiReady() {
- //Called when your WAMI application is ready. You might wait until now
- //to tell the user it's time to start interacting
- }
- //called when a speech recognition result is received
- //since we set sendIncrementalResults to false, this will only
- //be called after the user finishes speaking. Otherwise,
- //it will be called many times as the user speaks.
- function onWamiRecognitionResult(result) {
- var hyp = result.hyps[0].text; //what we think the user said
- alert("You said: '" + hyp + "'");
- myWamiApp.speak(hyp); //Speech synthesis of what we heard
- setTimeout("myWamiApp.replayLastRecording()", 500); //play back audio we recorded
- }
- //called when an error occurs
- function onWamiError(type, message) {
- alert("WAMI error: type = " + type + ", message = " + message);
- }
- //called when your WAMI session times out due to
- //in activity.
- function onWamiTimeout() {
- alert("WAMI timed out. Hit reload to start over");
- }





For those trying and thinking that it froze, just wait… it’s Java so just wait…
Didn’t work at all for me. Does it expect an American accent?
Firefox complains because the applet has an expired cert.
Using Java or Flash just to access a standard input device feels so old. When will we get <input type=”audio”>?
I’ve stopped using Java (as both programmer & user) a loooong time ago.
I never surf with Java enabled. 99.9% of sites don’t need it. And now that Oracle is behind it, bleh…
-randomrandom2
As much as we try to kill Java applets they keep coming back because they can do things that strait up javascript can’t. As for the voice recognition it sounds like a neat concept. Wish I had a mic at work to try it ;-)