SpeechRecognitionEngine.SpeechDetected Event
Event raised by recognition engine when speech is detected.
Assembly: System.Speech (in System.Speech.dll)
Windows Desktop Speech Technology based recognition engines have algorithms able to distinguish between background sound, random noise, and speech.
When the algorithm is satisified, a SpeechDetected is raised.
SpeechDetected events are always be followed by one or more SpeechHypothesized events, and finally by either a SpeechRecognized or SpeechRecognitionRejected event when the recognizer has finished processing the speech.
The position of the audio input to trigger a SpeechDetected event can be obtained by the SpeechDetected handler through the AudioPosition property of the SpeechDetectedEventArgs object passed to the handler.
The example below shows the subscription of an anonymous method as a handler for SpeechDetected. The handler displays the current state of the recognition engine, including the audio position of the speech that generated the event (Utils.DisplaySpeechDetected).
_recognizer.SpeechDetected +=
delegate(object sender, SpeechDetectedEventArgs eventArgs) {
//Clear previous recognition information
_audioDeviceStatusLabel.Enabled = true;
_audioDeviceStatusLabel.Visible = true;
Utils.DisplayAudioInputFormat(_audioStateLabel, _recognizer);
Utils.DisplaySpeechDetected(_speechDetectedLabel, eventArgs.AudioPosition);
};
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.
Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.