Share via

SpVoice Resume method (SAPI 5.3)

Microsoft Speech API 5.3

Object: SpVoice

Resume Method

The Resume method causes the voice to resume speaking when paused.




Return Value



The following Visual Basic form code demonstrates the use of the Pause and Resume methods. To run this code, create a form with the following control:

  • A command button called Command1

Paste this code into the Declarations section of the form.

The Form_Load procedure creates a voice object. The first call of the Command1_Click procedure causes the voice to begin speaking a text stream. Subsequent Command1 clicks alternately pause and resume the voice. When the voice has finished speaking the stream, the EndStream causes the voice to speak it again.

The voice's AlertBoundary setting of SVEPhoneme means that the Pause method can interrupt the voice within word boundaries. The text stream spoken contains a number of long words in order to show this interruption of words more clearly.

  Option Explicit

Private WithEvents V As SpeechLib.SpVoice

Private Sub Command1_Click()

    Select Case Command1.Caption

    Case "Start"
        Call SpeakAgain
        Command1.Caption = "Pause"

    Case "Pause"
        Command1.Caption = "Resume"

    Case "Resume"
        Command1.Caption = "Pause"

    End Select

End Sub

Private Sub Form_Load()

    Set V = New SpVoice
    V.AlertBoundary = SVEPhoneme    'Let words be interrupted
    Command1.Caption = "Start"

End Sub

Private Sub V_EndStream(ByVal StreamNumber As Long, ByVal StreamPosition As Variant)
    Call SpeakAgain
End Sub

Private Sub SpeakAgain()
    V.Speak "this phenomenal asynchronous stream contains multisyllabic " _
            & "pronunciations and circumlocutions.", SVSFlagsAsync
End Sub