SpeechDetectedEventArgs.AudioPosition Property
Gets the audio position of a detected speech segment.
Namespace: Microsoft.Speech.Recognition
Assembly: Microsoft.Speech (in microsoft.speech.dll)
Syntax
'Declaration
Public ReadOnly Property AudioPosition As TimeSpan
public TimeSpan AudioPosition { get; }
public:
property TimeSpan AudioPosition {
TimeSpan get ();
}
/** @property */
public TimeSpan get_AudioPosition ()
public function get AudioPosition () : TimeSpan
Property Value
Returns an instance of System.TimeSpan, which contains the location of a detected phrase within the speech buffer of a recognition engine.
Example
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.DisplayAudioInputStatus(_audioDeviceStatusLabel, _recognizer.AudioStatus);
Utils.DisplaySpeechDetected(_speechDetectedLabel, eventArgs.AudioPosition);
};
Thread Safety
All public static (Shared in Visual Basic) members of this type are thread-safe. Instance members are not guaranteed to be thread-safe.
Platforms
Development Platforms
Windows XP Professional with Service Pack 2 (SP2), Windows Server 2003, Windows Vista Ultimate Edition, Windows Vista Business Edition, Windows Vista Enterprise Edition
Target Platforms
See Also
Reference
SpeechDetectedEventArgs Class
SpeechDetectedEventArgs Members
Microsoft.Speech.Recognition Namespace
SpeechDetectedEventArgs Class
AudioStatusChanged
SpeechDetected