SpeechRecognitionEngine.BabbleTimeout プロパティ


SpeechRecognitionEngine が認識を終了する前にバックグラウンド ノイズのみを含む入力を受け入れる時間間隔を取得または設定します。Gets or sets the time interval during which a SpeechRecognitionEngine accepts input containing only background noise, before finalizing recognition.

 property TimeSpan BabbleTimeout { TimeSpan get(); void set(TimeSpan value); };
public TimeSpan BabbleTimeout { get; set; }
member this.BabbleTimeout : TimeSpan with get, set
Public Property BabbleTimeout As TimeSpan



時間の間隔。The duration of the time interval.


このプロパティが 0 秒未満の値に設定されています。This property is set to less than 0 seconds.

次の例は、 BabbleTimeout InitialSilenceTimeout 音声認識を開始する前にのプロパティとプロパティを設定する基本的な音声認識を示す、コンソールアプリケーションの一部を示して SpeechRecognitionEngine います。The following example shows part of a console application that demonstrates basic speech recognition that sets the BabbleTimeout and InitialSilenceTimeout properties of a SpeechRecognitionEngine before initiating speech recognition. 音声認識エンジンのおよびイベントのハンドラーは、 AudioStateChanged RecognizeCompleted イベント情報をコンソールに出力して InitialSilenceTimeout 、のプロパティが SpeechRecognitionEngine 認識操作に与える影響を示します。Handlers for the speech recognizer's AudioStateChanged and RecognizeCompleted events output event information to the console to demonstrate how the InitialSilenceTimeout properties of a SpeechRecognitionEngine affect recognition operations.

using System;  
using System.Speech.Recognition;  

namespace SpeechRecognitionApp  
  class Program  
    static void Main(string[] args)  

      // Initialize an in-process speech recognizer.  
      using (SpeechRecognitionEngine recognizer =  
        new SpeechRecognitionEngine(  
          new System.Globalization.CultureInfo("en-US")))  
        // Load a Grammar object.  

        // Add event handlers.  
        recognizer.AudioStateChanged +=  
          new EventHandler<AudioStateChangedEventArgs>(  
        recognizer.RecognizeCompleted +=  
          new EventHandler<RecognizeCompletedEventArgs>(  

        // Configure input to the speech recognizer.  

        recognizer.InitialSilenceTimeout = TimeSpan.FromSeconds(3);  
        recognizer.BabbleTimeout = TimeSpan.FromSeconds(2);  
        recognizer.EndSilenceTimeout = TimeSpan.FromSeconds(1);  
        recognizer.EndSilenceTimeoutAmbiguous = TimeSpan.FromSeconds(1.5);  

        Console.WriteLine("BabbleTimeout: {0}", recognizer.BabbleTimeout);  
        Console.WriteLine("InitialSilenceTimeout: {0}", recognizer.InitialSilenceTimeout);  
        Console.WriteLine("EndSilenceTimeout: {0}", recognizer.EndSilenceTimeout);  
        Console.WriteLine("EndSilenceTimeoutAmbiguous: {0}", recognizer.EndSilenceTimeoutAmbiguous);  

        // Start asynchronous speech recognition.  

        // Keep the console window open.  
        while (true)  

    // Create a grammar and build it into a Grammar object.   
    static Grammar CreateServicesGrammar(string grammarName)  

      // Create a grammar for finding services in different cities.  
      Choices services = new Choices(new string[] { "restaurants", "hotels", "gas stations" });  
      Choices cities = new Choices(new string[] { "Seattle", "Boston", "Dallas" });  

      GrammarBuilder findServices = new GrammarBuilder("Find");  

      // Create a Grammar object from the GrammarBuilder. 
      Grammar servicesGrammar = new Grammar(findServices);  
      servicesGrammar.Name = ("FindServices");  
      return servicesGrammar;  

    // Handle the AudioStateChanged event.  
    static void AudioStateChangedHandler(  
      object sender, AudioStateChangedEventArgs e)  
      Console.WriteLine("AudioStateChanged ({0}): {1}",  
        DateTime.Now.ToString("mm:ss.f"), e.AudioState);  

    // Handle the RecognizeCompleted event.  
    static void RecognizeCompletedHandler(  
      object sender, RecognizeCompletedEventArgs e)  
      Console.WriteLine("RecognizeCompleted ({0}):",  

      string resultText;  
      if (e.Result != null) { resultText = e.Result.Text; }  
      else { resultText = "<null>"; }  

        " BabbleTimeout: {0}; InitialSilenceTimeout: {1}; Result text: {2}",  
        e.BabbleTimeout, e.InitialSilenceTimeout, resultText);  
      if (e.Error != null)  
        Console.WriteLine(" Exception message: ", e.Error.Message);  

      // Start the next asynchronous recognition operation.  


各音声認識エンジンには、無音と音声を区別するためのアルゴリズムが用意されています。Each speech recognizer has an algorithm to distinguish between silence and speech. 認識エンジンは、どのレコグナイザーが読み込まれ、有効になっている音声認識文法の初期ルールとも一致しない、無音でない入力をバックグラウンドノイズとして分類します。The recognizer classifies as background noise any non-silence input that does not match the initial rule of any of the recognizer's loaded and enabled speech recognition grammars. バブルのタイムアウト間隔内で、レコグナイザーがバックグラウンドノイズと無音のみを受信した場合、認識エンジンはその認識操作を終了します。If the recognizer receives only background noise and silence within the babble timeout interval, then the recognizer finalizes that recognition operation.

バブル timeout 期間が0に設定されている場合、レコグナイザーはバブル timeout チェックを実行しません。If the babble timeout period is set to 0, the recognizer does not perform a babble timeout check. タイムアウト間隔には、負でない値を指定できます。The timeout interval can be any non-negative value. 既定値は0秒です。The default is 0 seconds.