B
B
Hello
I need a bit of help... I'm working on presentation using Speech recognition
and Synthesis, but i
don't succeed to make it work.The recognition engine sets off, understands
my querry, than the text-to-speech replies, but then the following voice
commands don'T seem to be working.
I'm also receiving error messages with the SlideShowWindow...and I don't
seem to find the command to the next slide... If anyone can figure out why,
would be great!!!!Cheers, Bernice
Here is the code:
Public WithEvents DirectSR As DirectSR
Public WithEvents DirectSS As DirectSS
Private Sub DirectSR_PhraseFinish(ByVal flags As Long, ByVal beginhi As
Long, ByVal beginlo As Long, ByVal endhi As Long, ByVal endlo As Long, ByVal
Phrase As String, ByVal parsed As String, ByVal results As Long)
If (parsed = "") Then
Else
Select Case parsed
Case "Hello"
DirectSR.Deactivate
DirectSS.Speak "Hey guys welcome to my website!"
DirectSR.GrammarFromFile "C:\Demos\voice1.txt"
Case "Sleep"
DirectSR.Deactivate
DirectSS.Speak "I am sleeping"
DirectSR.GrammarFromFile "C:\Demos\computer.txt"
Case "Flat"
With SlideShowWindows(1).View
.GotoSlide 3
End With
Case "House"
With SlideShowWindows(1).View
.GotoSlide 5
End With
Case "City"
With SlideShowWindows(1).View
.GotoSlide 2
End With
Case "Where"
With SlideShowWindows(1).View
.GotoSlide 9
End With
Case "Profile"
With SlideShowWindows(1).View
.GotoSlide 20
End With
Case "Back"
With SlideShowWindows(1).View
.GotoSlide (.LastSlideViewed.SlideIndex)
End With
Case "Quit"
SendKeys "%{F4}"
End Select
End If
End Sub
Private Sub DirectSS_AudioStop(ByVal hi As Long, _
ByVal lo As Long)
DirectSR.Activate
End Sub
'PowerPoint and Speech Object Definitions
Dim App As PowerPoint.Application
Public DirectSR As DirectSR
Public DirectSS As DirectSS
Dim SClass As New SpeechClass
Public Sub Init()
On Error GoTo ErrorMessage
Dim Engine, Voice As Long
Set DirectSR = New DirectSR
Set DirectSS = New DirectSS
Set SClass.DirectSR = DirectSR
Set SClass.DirectSS = DirectSS
Engine = DirectSR.Find("MfgName = Microsoft")
DirectSR.Select Engine
DirectSR.GrammarFromFile "C:\Demos\computer.txt"
DirectSR.Activate
Voice = DirectSS.Find("MfgName = Microsoft")
DirectSS.Select Voice
GoTo NoError
ErrorMessage:
MsgBox "Unable to initialize speech recognition engine.Make sure an
engine that supports speech recognition is installed."
End
NoError:
End Sub
I need a bit of help... I'm working on presentation using Speech recognition
and Synthesis, but i
don't succeed to make it work.The recognition engine sets off, understands
my querry, than the text-to-speech replies, but then the following voice
commands don'T seem to be working.
I'm also receiving error messages with the SlideShowWindow...and I don't
seem to find the command to the next slide... If anyone can figure out why,
would be great!!!!Cheers, Bernice
Here is the code:
Public WithEvents DirectSR As DirectSR
Public WithEvents DirectSS As DirectSS
Private Sub DirectSR_PhraseFinish(ByVal flags As Long, ByVal beginhi As
Long, ByVal beginlo As Long, ByVal endhi As Long, ByVal endlo As Long, ByVal
Phrase As String, ByVal parsed As String, ByVal results As Long)
If (parsed = "") Then
Else
Select Case parsed
Case "Hello"
DirectSR.Deactivate
DirectSS.Speak "Hey guys welcome to my website!"
DirectSR.GrammarFromFile "C:\Demos\voice1.txt"
Case "Sleep"
DirectSR.Deactivate
DirectSS.Speak "I am sleeping"
DirectSR.GrammarFromFile "C:\Demos\computer.txt"
Case "Flat"
With SlideShowWindows(1).View
.GotoSlide 3
End With
Case "House"
With SlideShowWindows(1).View
.GotoSlide 5
End With
Case "City"
With SlideShowWindows(1).View
.GotoSlide 2
End With
Case "Where"
With SlideShowWindows(1).View
.GotoSlide 9
End With
Case "Profile"
With SlideShowWindows(1).View
.GotoSlide 20
End With
Case "Back"
With SlideShowWindows(1).View
.GotoSlide (.LastSlideViewed.SlideIndex)
End With
Case "Quit"
SendKeys "%{F4}"
End Select
End If
End Sub
Private Sub DirectSS_AudioStop(ByVal hi As Long, _
ByVal lo As Long)
DirectSR.Activate
End Sub
'PowerPoint and Speech Object Definitions
Dim App As PowerPoint.Application
Public DirectSR As DirectSR
Public DirectSS As DirectSS
Dim SClass As New SpeechClass
Public Sub Init()
On Error GoTo ErrorMessage
Dim Engine, Voice As Long
Set DirectSR = New DirectSR
Set DirectSS = New DirectSS
Set SClass.DirectSR = DirectSR
Set SClass.DirectSS = DirectSS
Engine = DirectSR.Find("MfgName = Microsoft")
DirectSR.Select Engine
DirectSR.GrammarFromFile "C:\Demos\computer.txt"
DirectSR.Activate
Voice = DirectSS.Find("MfgName = Microsoft")
DirectSS.Select Voice
GoTo NoError
ErrorMessage:
MsgBox "Unable to initialize speech recognition engine.Make sure an
engine that supports speech recognition is installed."
End
NoError:
End Sub