Managing speech recognition directly with the recognizer

Last reviewed: 7/8/2022

HOW Article ID: H072202

The information in this article applies to:

  • SpeechKit 11

Summary

Optimize speech recognition apps by managing the recognizer directly in applications.

More Information

A speech recognizer converts speech to text for transcription, data entry, or command and control. In addition, events are generated to return recognized speech and indicate processing states.

The Microsoft Speech API (SAPI5) runtime is part of Windows that provides application control of the listening context and events for recognized speech and processing states of a recognizer. Microsoft includes a speech recognizer in many Windows SKUs.

Recognizers from other speech technology vendors do not support Microsoft APIs and event processing and provide their own proprietary speech API with SDK and runtimes.

SpeechKit provides common speech recognition management for multiple application scenarios across across the various speech technology APIs by managing speech recognition directly with the recognizer.

SpeechKit includes libraries for the following Speech APIs for speech recognition:

Speech APIPlatforms
Apple SpeechARM, x64, x86
Google android.speechARM
Microsoft SAPI 5x64, x86
Microsoft Speech Platformx64, x86
Microsoft .NET System.Speechx64, x86
Microsoft .NET Microsoft.Speechx64, x86
Microsoft WindowsMedia (UWP)ARM, x64, x86
Microsoft WindowsMedia (WinRT)x86, x64

Libraries for the most popular recognizer speech APIs are included in Chant Developer Workbench. For additional libraries that support different APIs, runtimes, versions, and vendors contact Chant Support.

SpeechKit supports speech recognition with with a single request.


// Create Recognizer
_Recognizer = _SpeechKit.createAndroidRecognizer();

// Start speech recognition from microphone audio source
_Recognizer.startRecognition();

// Stop speech recognition from microphone audio source
_Recognizer.stopRecognition();

To know the progress or state of speech recognition and process the recognized speech, the application processes event callbacks.


public class MainActivity extends AppCompatActivity implements com.speechkit.JChantSpeechKitEvents
{
        ...
        // Set the callback
        _Recognizer.setChantSpeechKitEvents(this);
        // Register Callbacks for engine init
        _Recognizer.registerCallback(ChantSpeechKitCallback.CCSRRecognitionDictation);
        ...
    @Override
    public void recognitionDictation(Object o, RecognitionDictationEventArgs recognitionDictationEventArgs)
    {
        // Display recognized speech
        final EditText textBox1 = (EditText) findViewById(R.id.textbox1);
        if ((textBox1 != null) && (recognitionDictationEventArgs.getText() != null)) {
            textBox1.append( recognitionDictationEventArgs.getText() + "\n" );
        }
        ...
   }
}