-1
Imports SpeechLib

Public Class Form1
    Public vox = CreateObject("sapi.spvoice")
    Private Sub cmdSpeak_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdSpeak.Click
        Dim t As String = "Hello , This is a Text"
        Say(t)
    End Sub

    Public Sub Say(ByVal text As String)
        vox.Speak(text,SpeechVoiceSpeakFlags.SVSFlagsAsync)
    End Sub

    Private Sub cmdPause_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdPause.Click
        vox.pause()
    End Sub

    Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        vox.AlertBoundary = SVEPhoneme
    End Sub
End Class

I am getting an error

Name 'SVEPhoneme' is not declared.

How and where do I declare it ?

SpongeBob SquarePants
  • 995
  • 12
  • 25
  • 45

2 Answers2

0

SVEPhoneme represents the Phoneme event, which occurs when the engine completes a phoneme while speaking.

Try setting SVEPhoneme to be the integer 64.

http://msdn.microsoft.com/en-us/library/ms720886(v=vs.85).asp

Nick
  • 2,928
  • 2
  • 18
  • 25
0

It is SpeechVoiceEvents.SVEPhoneme

This is all a lot easier if you make this code early bound:

Public vox as New SpVoice

Or better yet, use the .NET wrapper for the sapi, System.Speech assembly.

Imports System.Speech.Synthesis

Public Class Form1
    Public vox As New SpeechSynthesizer

    Public Sub Say(ByVal text As String)
        vox.SpeakAsync(text)
    End Sub
End Class
Hans Passant
  • 873,011
  • 131
  • 1,552
  • 2,371