Gets the position in the audio stream where speech was detected.
Namespace:
Microsoft.Speech.Recognition
Assembly:
Microsoft.Speech (in Microsoft.Speech.dll)
Syntax
Visual Basic (Declaration) |
---|
Public ReadOnly Property AudioPosition As TimeSpan
Get |
C# |
---|
public TimeSpan AudioPosition { get; } |
Property Value
Type:
System..::..TimeSpanReturns the location of a detected phrase within the speech buffer of a recognition engine.
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.
| Copy Code |
---|
_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);
}; |
See Also