RecognitionResult.Audio プロパティ

定義

認識結果に関連付けられているオーディオを取得します。Gets the audio associated with the recognition result.

public:
 property System::Speech::Recognition::RecognizedAudio ^ Audio { System::Speech::Recognition::RecognizedAudio ^ get(); };
public System.Speech.Recognition.RecognizedAudio Audio { get; }
member this.Audio : System.Speech.Recognition.RecognizedAudio
Public ReadOnly Property Audio As RecognizedAudio

プロパティ値

RecognizedAudio

認識の結果に関連付けられたオーディオ、または認識エンジンが SpeechRecognitionEngine インスタンスまたは SpeechRecognizer インスタンスの null メソッドまたは EmulateRecognize メソッドの呼び出しから結果を生成した場合は EmulateRecognizeAsyncThe audio associated with the recognition result or null if the recognizer generated the result from a call to the EmulateRecognize or EmulateRecognizeAsync methods of a SpeechRecognitionEngine or SpeechRecognizer instance.

次の例は、 SpeechRecognized イベントのハンドラーと、関連付けられているに関する情報の一部を示して RecognitionResult います。The following example shows a handler for the SpeechRecognized event and some of the information about the associated RecognitionResult.

// 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 information about the words in the recognition result.  
  foreach (RecognizedWordUnit word in e.Result.Words)  
  {  
    RecognizedAudio audio = e.Result.GetAudioForWordRange(word, word);  
    Console.WriteLine(" {0,-10} {1,-10} {2,-10} {3} ({4})",  
      word.Text, word.LexicalForm, word.Pronunciation,  
      audio.Duration, word.DisplayAttributes);  
  }  

  // Display the recognition alternates for the result.  
  foreach (RecognizedPhrase phrase in e.Result.Alternates)  
  {  
    Console.WriteLine(" alt({0}) {1}", phrase.Confidence, phrase.Text);  
  }  
}  

注釈

認識結果に含まれる特定の範囲の単語に関連付けられているオーディオのセクションを取得するには、メソッドを使用し GetAudioForWordRange ます。To get a section of the audio that is associated with a specific range of words in the recognition result, use the GetAudioForWordRange method.

適用対象

こちらもご覧ください