RecognizedAudio Class

Microsoft Speech Platform SDK 11

Collapse imageExpand ImageCopy imageCopyHover image

Represents audio input that is associated with a RecognitionResult.

Inheritance Hierarchy

System..::..Object
  Microsoft.Speech.Recognition..::..RecognizedAudio

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

Syntax

Visual Basic (Declaration)
<SerializableAttribute> _
Public Class RecognizedAudio
Visual Basic (Usage)
Dim instance As RecognizedAudio
C#
[SerializableAttribute]
public class RecognizedAudio

Remarks

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 nullNothingnullptrunita null reference (Nothing in Visual Basic). For more information about emulated speech recognition, see the EmulateRecognize()()()() and EmulateRecognizeAsync()()()() methods of the SpeechRecognitionEngine class.

Examples

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

C# Copy imageCopy Code
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",
        resultRecognizedAudio.AudioPosition.TotalMilliseconds,
        resultRecognizedAudio.Duration.TotalMilliseconds,
        resultRecognizedAudio.StartTime.ToShortTimeString(),
        resultRecognizedAudio.Format.EncodingFormat.ToString());
  }

Thread Safety

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

See Also