AudioPosition Property
From Microsoft Speech Platform SDK 11
| SpeechDetectedEventArgs..::..AudioPosition Property |
| SpeechDetectedEventArgs Class Example See Also Send Feedback |
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 |
| Visual Basic (Usage) |
|---|
Dim instance As SpeechDetectedEventArgs Dim value As TimeSpan value = instance.AudioPosition |
| 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.
_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);
}; | |