RecognizedAudio Class

Represents audio input that is associated with a RecognitionResult.


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

public class RecognizedAudio

A speech recognizer generates information about the audio input as part of the recognition operation. To access the recognized audio, use the Audio property.

A recognition result can be produced by the following events and methods of the SpeechRecognitionEngine class:

Important noteImportant

A recognition result produced by emulated speech recognition does not contain recognized audio. For such a recognition result, its Audio property returns a null reference (Nothing in Visual Basic). For more information about emulated speech recognition, see the EmulateRecognize() and EmulateRecognizeAsync() methods of the SpeechRecognitionEngine class.

In the example below, an application first determines whether recognition operation has been emulated by determining if the RecognizedAudio object received is not a null reference (Nothing in Visual Basic). If the RecognizedAudio object is not a null reference (Nothing in Visual Basic), information about the recognized audio is written to a Label for display.

if (result != null) 
{ // Clear
  RecognizedAudio resultRecognizedAudio = result.Audio;
  if (resultRecognizedAudio == null) 
    label.Text += String.Format(
            "  Emulated input\n");
  } else 
    label.Text += String.Format(
        "  Candidate Phrase at:       {0} mSec\n" +
        "  Phrase Length:             {1} mSec\n" +
        "  Input State Time:          {2}\n" +
        "  Input Format:              {3}\n",

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