RecognizedAudio.Format 属性

定义

获取识别引擎处理的音频格式。

public:
 property System::Speech::AudioFormat::SpeechAudioFormatInfo ^ Format { System::Speech::AudioFormat::SpeechAudioFormatInfo ^ get(); };
public System.Speech.AudioFormat.SpeechAudioFormatInfo Format { get; }
member this.Format : System.Speech.AudioFormat.SpeechAudioFormatInfo
Public ReadOnly Property Format As SpeechAudioFormatInfo

属性值

语音识别器处理的音频的格式。

示例

以下示例处理 SpeechRecognitionEngine.SpeechRecognizedSpeechRecognizer.SpeechRecognized 事件,并将有关与识别结果关联的已识别音频的控制台信息输出。

// Handle the SpeechRecognized event.   
void SpeechRecognizedHandler(object sender, SpeechRecognizedEventArgs e)  
{  
  if (e.Result == null) return;  

  RecognitionResult result = e.Result;  

  Console.WriteLine("Grammar({0}): {1}",  
    result.Grammar.Name, result.Text);  

  if (e.Result.Audio != null)  
  {  
    RecognizedAudio audio = e.Result.Audio;  

    Console.WriteLine("   start time: {0}", audio.StartTime);  
    Console.WriteLine("   encoding format: {0}", audio.Format.EncodingFormat);  
    Console.WriteLine("   position: {0}, duration: {1}",  
      audio.AudioPosition, audio.Duration);  
  }  

  // Add event handler code here.  
}  

适用于

另请参阅