Compartir a través de


Note

Please see Azure Cognitive Services for Speech documentation for the latest supported speech solutions.

SpeechDetectedEventArgs Class

Provides data for the SpeechDetected event.

Inheritance Hierarchy

System.Object
  System.EventArgs
    Microsoft.Speech.Recognition.SpeechDetectedEventArgs

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

Syntax

'Declaration
Public Class SpeechDetectedEventArgs _
    Inherits EventArgs
'Usage
Dim instance As SpeechDetectedEventArgs
public class SpeechDetectedEventArgs : EventArgs

Remarks

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.

Examples

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);
  };

Thread Safety

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

See Also

Reference

SpeechDetectedEventArgs Members

Microsoft.Speech.Recognition Namespace

AudioStateChanged

SpeechDetected