RecognizedAudio.StartTime Property

Gets the time audio input began.

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

Syntax

'Declaration
Public ReadOnly Property StartTime As DateTime
public DateTime StartTime { get; }
public:
property DateTime StartTime {
    DateTime get ();
}
/** @property */
public DateTime get_StartTime ()
public function get StartTime () : DateTime

Property Value

Returns a System.DateTime object.

Remarks

The value returned by StartTime is the absolute wall-clock time of the beginning of audio processing.

This contrasts with the offset in the audio input stream returned by AudioPosition, which is relative value, determined by how a recognition engine manages its input buffer.

StartTime can be useful for latency and performance calculations.

Example

In the example below, an application first checks to see if the recognition operation has been emulated by determining if the RecognizedAudio object received is non null. If the RecognizedAudio object is non-null information about the recognized audio is written to a Windows.Forms.Label for display.

    if (result != null) { //Clear
    RecognizedAudio resultRecognizedAudio = result.Audio;
    if (resultRecognizedAudio == null) {
        label.Text += String.Format(
            "  Emulated input\n");
    } else {
        label.Text += String.Format(
        "  Candidate Phrase at:       {0} mSec\n" +
        "  Phrase Length:             {1} mSec\n" +
        "  Input State Time:          {2}\n" +
        "  Input Format:              {3}\n",
        resultRecognizedAudio.AudioPosition.TotalMilliseconds,
        resultRecognizedAudio.Duration.TotalMilliseconds,
        resultRecognizedAudio.StartTime.ToShortTimeString(),
        resultRecognizedAudio.Format.EncodingFormat.ToString());
    }

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

RecognizedAudio Class
RecognizedAudio Members
Microsoft.Speech.Recognition Namespace
System.DateTime
RecognizedAudio.AudioPosition Property