SpeechDetectedEventArgs Class

Provides data for the SpeechDetected event.


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

public class SpeechDetectedEventArgs : EventArgs

An instance of SpeechDetectedEventArgs is created when the SpeechRecognitionEngine object raises the SpeechDetected event. To obtain the location in the audio stream where the event was raised, access the AudioPosition property in the handler for the event.

SpeechDetected events are generated when a recognition engine can identify audio input as human speech.

SpeechDetectedEventArgs derives from EventArgs.

In the example below, a handler is created for SpeechDetected events which initializes a display every time speech is detected and displays status information, including audio position.

_recognizer.SpeechDetected +=
  delegate(object sender, SpeechDetectedEventArgs eventArgs) 

    // Clear previous recognition information.
    _audioDeviceStatusLabel.Enabled = true;
    _audioDeviceStatusLabel.Visible = true;
    Utils.DisplayAudioInputFormat(_audioStateLabel, _recognizer);
    Utils.DisplayRecognizerState(_recognizerStateLabel, _recognizer.State);
    Utils.DisplaySpeechDetected(_speechDetectedLabel, eventArgs.AudioPosition);

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