Share via


ISpeechVoiceStatus VisemeId Property (SAPI 5.3)

Microsoft Speech API 5.3

Interface: ISpeechVoiceStatus

VisemeId Property

The VisemeId property retrieves the ID of the current viseme being spoken by the voice.

Syntax

Set: (This property is read-only)
Get: Integer = ISpeechVoiceStatus.VisemeId

Parts

  • ISpeechVoiceStatus
    The owning object.
  • Integer
    Set: (This property is read-only)
    Get: An Integer variable returning the VisemeId.

Example

The following Visual Basic form code demonstrates the use of the VisemeId property of an ISpeechVoiceStatus object. To run this code, create a form with the following controls:

  • A command button called Command1
  • Two text boxes called Text1 and Text2

Paste this code into the Declarations section of the form.

The Form_Load procedure creates a voice object and places a sentence in the text box. The Command1_Click procedure speaks the contents of the text box asynchronously, and loops until the voice has finished speaking. Inside the loop, the code checks VisemeId property periodically and displays it in Text2.

  
Option Explicit

Private V As SpeechLib.SpVoice

Private Sub Command1_Click()
    Dim ii As Integer

    On Error GoTo EH

    Text2.Text = ""
    V.Speak Text1.Text, SVSFlagsAsync

    Do
        For ii = 0 To 20000
            DoEvents
        Next ii
        Text2.Text = Text2.Text & V.Status.VisemeId & " "

    Loop While V.Status.RunningState = SRSEIsSpeaking

EH:
    If Err.Number Then ShowErrMsg
End Sub

Private Sub Form_Load()

    Set V = New SpVoice
    Text1.Text = "say, see, sigh, so, sue."
    Text2.Text = ""

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