SpeechRecognitionEngine Class

Provides access to speech recognition services.

Namespace: Microsoft.Speech.Recognition
Assembly: Microsoft.Speech (in microsoft.speech.dll)

Syntax

'Declaration
Public Class SpeechRecognitionEngine
    Implements IDisposable
public class SpeechRecognitionEngine : IDisposable
public ref class SpeechRecognitionEngine : IDisposable
public class SpeechRecognitionEngine implements IDisposable
public class SpeechRecognitionEngine implements IDisposable

Remarks

Applications using SpeechRecognitionEngine select any of the recognition engines available on a given system, as well as choose a particular form of audio input -- including the standard audio input, streams, and files.

Therefore, SpeechRecognitionEngine based applications can be constructed as clients of a particular recognition engine, as standalone speech recognition applications using inprocess recognition engines, and as servers, providing access to a recognition engine to clients.

Applications using SpeechRecognitionEngine effectively do so by selecting the correct recognizer and culture when constructing an instance, connecting to the appropriate audio input, creating event handlers to receive audio recognition results, controlling the grammars used in recognition, and by starting and stopping recognition engines.

To support this, SpeechRecognitionEngine provides programmatic control over:

SpeechRecognitionEngine implements IDispose.

Inheritance Hierarchy

System.Object
  Microsoft.Speech.Recognition.SpeechRecognitionEngine

Example

The example below queries the system to find a recognition engine with the identification string and CultureID. Note, before this instance of SpeechRecognitionEngine can be used, it must have its input set, using SetInputToNull, SetInputToWaveStream, or SetInputToDefaultAudioDevice).

private SpeechRecognitionEngine SelectRecognitionEngine(CultureInfo requiredCulture, string requiredId) {
  // Select based on a specific recognitionEngine configuration:
  SpeechRecognitionEngine speechRecognitionEngine=null;
  foreach (RecognzierInfo config in SpeechRecognitionEngine.InstalledRecognizers()) {
    if (config.Culture.Equals(requiredCulture) && config.Id== requiredId) {
      speechRecognitionEngine = new SpeechRecognitionEngine(config);
      break;
    }
    
  }
  return speechRecognitionEngine;
}

Thread Safety

All public static (Shared in Visual Basic) members of this type are thread-safe. Instance members are not guaranteed to be thread-safe.

Platforms

Development Platforms

Windows XP Professional with Service Pack 2 (SP2), Windows Server 2003, Windows Vista Ultimate Edition, Windows Vista Business Edition, Windows Vista Enterprise Edition

Target Platforms

See Also

Reference

SpeechRecognitionEngine Members
Microsoft.Speech.Recognition Namespace