次の方法で共有


ISpeechRecoResultDispatch Audio Method (SAPI 5.3)

Microsoft Speech API 5.3

Interface: ISpeechRecoResultDispatch

Audio Method

The Audio method creates an audio stream from the audio data in the result object.

The resulting stream can be used as input for SPVoice.SpeakStream. However, a single call to ISpeechRecoResultsDispatch.SpeakAudio performs the same action of speaking the recognized result

The audio portion of the recognition is not automatically available. By default, the recognition context does not retain audio. To retain it, call the RetainedAudio property and set it to SRAORetainAudio. While 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.

  
    ISpeechRecoResultDispatch.Audio(
    [StartElement As Long = 0],
    [Elements As Long = -1]
) As ISpeechBaseStream

Parameters

  • StartElement
    [Optional] Specifies which element to use as a starting point. If omitted, zero is used and indicates the first alternate as the starting point. Because it is zero based, the second element would be one.
  • Elements
    [Optional] Specifies the number of elements to retrieve. Default is -1 (that is, SPPR_ALL_ELEMENTS), which specifies all alternate elements are retrieved.

Return Value

The Audio method returns an ISpeechBaseStream object.

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.