Share via


SpeechRecoContext AllowVoiceFormatMatchingOnNextSet Property (SAPI 5.3)

Microsoft Speech API 5.3

Interface: ISpeechRecoContext
Type: Hidden

AllowVoiceFormatMatchingOnNextSet Property

The AllowVoiceFormatMatchingOnNextSet property determines if the recognition context can change the audio format of the output voice to match the audio format of the input stream.

AllowVoiceFormatMatchingOnNextSet can be used only if a voice has been created through the recognition context. If this property is set to True, the voice's output format will be set to the same format as the associated SR engine's audio input format. This conversion takes place only during the next setting of the SpVoice.Voice. However, if this voice object has already been bound to a stream which has specific format, the voice's format will not be changed to the SR engine's audio input format even if set to True. If False, the conversion is not made.

Using the same audio format for input and output source is useful for sound cards that do not support full-duplex audio (i.e., input format must match output format). If the input format quality is lower than the output format quality, the output format quality will be reduced to equal the input quality.

By default, AllowVoiceFormatMatchingOnNextSet is set to True.

Syntax

Set: ISpeechRecoContext.AllowVoiceFormatMatchingOnNextSet = Boolean
Get: Boolean = ISpeechRecoContext.AllowVoiceFormatMatchingOnNextSet

Parts

  • SpeechRecoContext
    The owning object.
  • Boolean
    Set: A Boolean variable that sets the property.
    Get: A Boolean variable that gets the property.

Example

The following Visual Basic form code demonstrates retrieving and setting AllowVoiceFormatMatchingOnNextSet. Paste this code into the Declarations section of the form.

  
Option Explicit

Public WithEvents RecognitionContext As SpSharedRecoContext
Private Sub Form_Load()
    On Error GoTo EH

    Set RecognitionContext = New SpSharedRecoContext
    Dim voiceChange As Boolean

    voiceChange = RecognitionContext.AllowVoiceFormatMatchingOnNextSet
    RecognitionContext.AllowVoiceFormatMatchingOnNextSet = True
    voiceChange = RecognitionContext.AllowVoiceFormatMatchingOnNextSet

EH:
    If Err.Number Then ShowErrMsg
End Sub

Private Sub ShowErrMsg()

    ' Declare identifiers:
    Dim T As String

    T = "Desc: " & Err.Description & vbNewLine
    T = T & "Err #: " & Err.Number
    MsgBox T, vbExclamation, "Run-Time Error"
    End

End Sub