Google Chrome supports Speech to Text API

By

January 17, 2013HTML5No comments

Google chrome browser now supports the latest html5 feature WebSpeech API . The latest beta version of the browser now offers the API for developers to access the speech data and converts it to text so that the apps can be interacted with only voice commands.

google speech to text

Webspeech API makes the futuristic possibilities like dictating the email to your browser.

Speech to Text Conversion

Chrome browser by default sends the voice data to cloud servers and receives the text content so the actual conversion takes place on the server side and this happens almost on the fly.

Before stating speech recognition we should check whether the browser supports web speech API by using webkitSpeechRecognition object.Before that User has to allow the browser to record speech using system microphone.

google speech recognition

if (!('webkitSpeechRecognition' in window)) {
  upgrade();
} else {
 //begin speech recognition
  };

To begin with create a new object for webkitSpeechRecognition and set continuous=true which means even if the user stops talking recognition will continue.

  var recognition = new webkitSpeechRecognition();
  recognition.continuous = true;
  recognition.interimResults = true; // print the interim result before final text

  recognition.onstart = function() {
    recognizing = true;
    };

onStart function will start recognizing the text and sends the results back using the onResult function.

 recognition.onresult = function(event) {
    var result;
    result=event.results[i][0].transcript;
    };

Check out the demo by google and its source code.

Also read: HTML 5 Drag and Drop example

 

 

Related posts:

Leave a Reply