SpeechRecognitionEngine Constructor (RecognizerInfo)


Initializes a new instance of the SpeechRecognitionEngine using the information in a RecognizerInfo object to specify the recognizer to use.

Namespace:   System.Speech.Recognition
Assembly:  System.Speech (in System.Speech.dll)

public SpeechRecognitionEngine(
	RecognizerInfo recognizerInfo


Type: System.Speech.Recognition.RecognizerInfo

The information for the specific speech recognizer.

You can create an instance of this class for any of the installed speech recognizers. To get information about which recognizers are installed, use the InstalledRecognizers method.

Before the speech recognizer can begin recognition, you must load at least one speech recognition grammar and configure the input for the recognizer.

To load a grammar, call the LoadGrammar or LoadGrammarAsync method.

To configure the audio input, use one of the following methods:

The following example shows part of a console application that demonstrates basic speech recognition, and initializes a speech recognizer that supports the English language.

 using System;
using System.Speech.Recognition;

namespace SpeechRecognitionApp
  class Program
    static void Main(string[] args)

      // Select a speech recognizer that supports English.
      RecognizerInfo info = null;
      foreach (RecognizerInfo ri in SpeechRecognitionEngine.InstalledRecognizers())
        if (ri.Culture.TwoLetterISOLanguageName.Equals("en"))
          info = ri;
      if (info == null) return;

      // Create the selected recognizer.
      using (SpeechRecognitionEngine recognizer =
        new SpeechRecognitionEngine(info))

        // Create and load a dictation grammar.
        recognizer.LoadGrammar(new DictationGrammar());

        // Add a handler for the speech recognized event.
        recognizer.SpeechRecognized += 
          new EventHandler<SpeechRecognizedEventArgs>(recognizer_SpeechRecognized);

        // Configure input to the speech recognizer.

        // Start asynchronous, continuous speech recognition.

        // Keep the console window open.
        while (true)

    // Handle the SpeechRecognized event.
    static void recognizer_SpeechRecognized(object sender, SpeechRecognizedEventArgs e)
      Console.WriteLine("Recognized text: " + e.Result.Text);

.NET Framework
Available since 3.0
Return to top