Share via


ISpeechRecoResultDispatch SpeakAudio Method (SAPI 5.3)

Microsoft Speech API 5.3

Interface: ISpeechRecoResultDispatch

SpeakAudio Method

The SpeakAudio method plays the audio sequence containing the recognized phrase.

The audio portion of the recognition is not automatically available. By default, the recognition context does not retain audio. Call RetainedAudio and set it to SRAORetainAudio to retain the audio. Although RetainedAudio can be toggled at anytime, audio for a specific phrase must be retained before recognition attempts begin. Therefore, RetainedAudio must be called before the phrase is spoken.

SpeakAudio combines two other methods. The first, ISpeechRecoResultDispatch.Audio, which retrieves the audio. The second call is SpVoice.SpeakStream, which plays it back.

  
    ISpeechRecoResultDispatch.SpeakAudio(
    [StartElement As Long = 0],
    [Elements As Long = -1],
    [Flags As SpeechVoiceSpeakFlags = SVSFDefault]
) As Long


Parameters

  • StartElement
    [Optional] Specifies the starting element. The default value is zero, indicating that the first element is used.
  • Elements
    [Optional] Specifies the number of elements to speak. Default value is -1, indicating that all elements are to be played.
  • Flags
    [Optional] Specifies the Flags. Default value is SVSFDefault indicating that no special speak restrictions are imposed.

Return Value

The SpeakAudio method returns a Long indicating the stream number.

Remarks

Even if there are no elements, that is, StartElement = 0 and Elements = 0, the audio will still be played. Unrecognized results not having elements will still have audio.