Speech Recognition using Cordova

Speech Recognition using Cordova

Speech Recognition using Cordova 3901 2194 Peter Meadley

There will come a time when you’ll need to use Speech Recognition in your app whether you are building a text transcriber or your very own Jarvis. Luckily the SpeechRecognitionPlugin makes it very easy to do so.

This example makes use of Simon MacDonald’s SpeechRecognitionPlugin which can be found here

Before you start using the plugin, you will need to add it to your solution by adding it through the console

cordova plugin add https://github.com/macdonst/SpeechRecognitionPlugin

Using the plugin is very simple. Here is a simple example which starts the recogniser intent as soon as the device is loaded in your application.

function onDeviceReady() {
    recognition = new SpeechRecognition();
    recognition.onresult = function(event) {
        if (event.results.length > 0) {
            q.value = event.results[0][0].transcript;

The result of the speech recogniser can be found in event.results[0][0].transcript. You can then use this value however you might need in your application.

Please note that when using this plugin for iOS you will require an API Key for iSpeech. Please refer to SpeechRecognitionPlugin’s readme to see how this can be done.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.