The Ashes

Technology, Science and other news
September 15, 2009

WAMI lets you add speech recognition to any web page

Posted by : admin
Filed under : General

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:

PLAIN TEXT
JAVASCRIPT:

  1.  
  2. ar myWamiApp;
  3. function onLoad() {
  4.         //div in which to put the audio button, see below
  5.         var audioDiv = document.getElementById(‘AudioContainer’);
  6.  
  7.         // JSGF grammar for your application
  8.         var jsgf =
  9.                 “#JSGF V1.0;\n +
  10.                 “grammar parrot;\n +
  11.                 “public <top> = hello wami | i want a cracker | feed me;\n;
  12.  
  13.         var grammar = {“language” : “en-us”, “grammar” : jsgf };
  14.  
  15.         //Audio options.
  16.         //pollForAudio: must be true for speech synthesis to work.
  17.         //If your application doesn’t use speech synthesis, set this to false.
  18.         var audioOptions = {“pollForAudio” : true};
  19.  
  20.         //Configuration options.
  21.         //sendIncrementalResults: if true, you’ll receive "incremental" recognition results as the user speaks
  22.         //sendAggregates: if true, you’ll receive a "semantic" interpretation.  Your grammar
  23.         //must follow a specific format.
  24.         var configOptions = {“sendIncrementalResults” : false, “sendAggregates” : false};
  25.  
  26.         //Handlers are functions which are called for various events:
  27.         var handlers = {“onReady” : onWamiReady, //WAMI is loaded and ready
  28.                                   “onRecognitionResult” : onWamiRecognitionResult,  //Speech recognition result available
  29.                                   “onError” : onWamiError,  //An error occurred
  30.                                   “onTimeout” : onWamiTimeout}; //WAMI timed out due to inactivity
  31.  
  32.     //Create your WAMI application with the settings and grammar we just created
  33.         myWamiApp = new WamiApp(audioDiv, handlers, “json”, audioOptions, configOptions, grammar);
  34. }
  35.  
  36. function onWamiReady() {
  37.         //Called when your WAMI application is ready.  You might wait until now
  38.         //to tell the user it’s time to start interacting
  39. }
  40.  
  41. //called when a speech recognition result is received
  42. //since we set sendIncrementalResults to false, this will only
  43. //be called after the user finishes speaking.  Otherwise,
  44. //it will be called many times as the user speaks.
  45. function onWamiRecognitionResult(result) {
  46.         var hyp = result.hyps[0].text//what we think the user said
  47.         alert(“You said: ‘” + hyp + “‘”);
  48.         myWamiApp.speak(hyp); //Speech synthesis of what we heard
  49.         setTimeout(“myWamiApp.replayLastRecording()”, 500); //play back audio we recorded
  50. }
  51.  
  52. //called when an error occurs
  53. function onWamiError(type, message) {
  54.         alert(“WAMI error: type  = “ + type + “, message = “ + message);       
  55. }
  56.  
  57. //called when your WAMI session times out due to
  58. //in activity.
  59. function onWamiTimeout() {
  60.         alert(“WAMI timed out.  Hit reload to start over”);
  61. }
  62.  

Tags :

No Comments

(required)
(will not be published) (required)
(opitional)

cciash.com EN ES IT DE PT CZ FR RU
September 2017
M T W T F S S
« Sep    
 123
45678910
11121314151617
18192021222324
252627282930  

Pages

Categories

Resources

There are many online poker site where you can play but at poker.hk you can play the poker games with all the knowledge you need related to the game with the poker school available in both the English and Chinese language.

Super Casino

Now you can bet on any sports and any sporting events from all the comfort from your home. Bet770 allows you to bet on any events and match with in just 3 clicks. They also offers great odds on football betting for every premier and champions league match. Get £50 free in bets when you register.

Bingo770, offering best online bingo games with £7.70 free no deposit Bonus!