







Gets the audio associated with the recognition result.
Namespace:
Microsoft.Speech.Recognition
Assembly:
Microsoft.Speech (in Microsoft.Speech.dll)
Syntax
| Visual Basic (Declaration) |
|---|
Public ReadOnly Property Audio As RecognizedAudio Get |
| Visual Basic (Usage) |
|---|
Dim instance As RecognitionResult Dim value As RecognizedAudio value = instance.Audio |
| C# |
|---|
public RecognizedAudio Audio { get; } |
Property Value
Type: Microsoft.Speech.Recognition..::..RecognizedAudioThe audio associated with the recognition result or nullNothingnullptrunita null reference (Nothing in Visual Basic) if the recognizer generated the result from a call to the EmulateRecognize()()()() or EmulateRecognizeAsync()()()() methods.
Examples
The following example shows a handler for the SpeechRecognized event and some of the information about the associated RecognitionResult.
| C# | Copy Code |
|---|---|
// Handle the SpeechRecognized event.
void SpeechRecognizedHandler(object sender, SpeechRecognizedEventArgs e)
{
if (e.Result == null) return;
// Add event handler code here.
// The following code illustrates some of the information available
// in the recognition result.
Console.WriteLine("Grammar({0}): {1}", e.Result.Grammar.Name, e.Result.Text);
Console.WriteLine("Audio for result:");
Console.WriteLine(" Start time: "+ e.Result.Audio.StartTime);
Console.WriteLine(" Duration: " + e.Result.Audio.Duration);
Console.WriteLine(" Format: " + e.Result.Audio.Format.EncodingFormat);
// Display the semantic values in the recognition result.
foreach (KeyValuePair<String, SemanticValue> child in e.Result.Semantics)
{
Console.WriteLine(" {0} key: {1}",
child.Key, child.Value.Value ?? "null");
}
Console.WriteLine();
// Display the recognition alternates for the result.
foreach (RecognizedPhrase phrase in e.Result.Alternates)
{
Console.WriteLine(" alt({0}) {1}", phrase.Confidence, phrase.Text);
}
} | |
