-
December 29th, 2003, 06:20 AM
#1
MsAgents
hi gurus
I am using msagent for text to speach and for speach commands.
text to speach is working fine but it's not reacting for speach commands.
when iam opening voice command window by right click on character say genie, awindow appears with text "Speach Input is Not Available in English"
i am using following code taken from msdn.
Private Sub Agent1_ActivateInput(ByVal CharacterID As String)
Agent1.Characters.Character("genie").Play "Congratulate"
Agent1.Characters.Character("genie").Play "Explain"
Agent1.Characters.Character("genie").Speak "Hi I am Gin How R U"
End Sub
Private Sub Agent1_Click(ByVal CharacterID As String, ByVal Button As Integer, ByVal Shift As Integer, ByVal x As Integer, ByVal y As Integer)
'Agent1.Characters.Character("genie").Activate
End Sub
Private Sub Agent1_Command(ByVal UserInput As Object)
Select Case LCase(UserInput.Name)
Case "bye bye"
Agent1.Characters.Character("genie").Speak "Bye bye"""
Agent1.Characters.Character("genie").Play "Wave"
Set MyRequest = Agent1.Characters.Character("genie").Hide
Case "down"
Agent1.Characters.Character("genie").GestureAt Agent1.Characters.Character("genie").Left, Screen.Height / Screen.TwipsPerPixelY
Agent1.Characters.Character("genie").Speak "All fall down."
Case "happy"
Agent1.Characters.Character("genie").Play "Pleased"
Agent1.Characters.Character("genie").Speak "I’m happy."
Case "Hello"
Agent1.Characters.Character("genie").Speak "Hello Merlin."
Agent1.Characters.Character("genie").Play "DoMagic1"
Agent1.Characters.Character("genie").Speak "Abracadabra, hocus pocus."
Agent1.Characters.Character("genie").Play "DoMagic2"
Agent1.Characters.Character("genie").Speak "Visual Basic now can" & "\Map=""spoke ith""=""spoketh""\."""
Case "left"
Agent1.Characters.Character("genie").GestureAt 0, Agent1.Characters.Character("genie").Height
Agent1.Characters.Character("genie").Speak "Left is that away."
Case "move"
Agent1.Characters.Character("genie").MoveTo Screen.Width / Screen.TwipsPerPixelX * Rnd, _
Screen.Height / Screen.TwipsPerPixelY * Rnd
Agent1.Characters.Character("genie").Speak "I Like flying."
Case "Right"
Agent1.Characters.Character("genie").GestureAt Screen.Width / Screen.TwipsPerPixelX, Agent1.Characters.Character("genie").Height
Agent1.Characters.Character("genie").Speak "Keep to the right."
Case "Sad"
MsgBox "This is UP"
Agent1.Characters.Character("genie").Play "Sad"
Agent1.Characters.Character("genie").Speak "I’m sad."
Case "Up"
MsgBox "This is UP"
Agent1.Characters.Character("genie").GestureAt Agent1.Characters.Character("genie").Left, 0
Agent1.Characters.Character("genie").Speak "The sky is falling."
Case Else
Agent1.Characters.Character("genie").Speak "I didn’t understand you."
Agent1.Characters.Character("genie").Play "Confused"
End Select
End Sub
Private Sub Agent1_DblClick(ByVal CharacterID As String, ByVal Button As Integer, ByVal Shift As Integer, ByVal x As Integer, ByVal y As Integer)
Agent1.Characters.Character("genie").Play "Congratulate"
Agent1.Characters.Character("genie").Play "Explain"
Agent1.Characters.Character("genie").Speak "Hi I am Gin How R U"
End Sub
Private Sub Form_Load()
Dim g_ctlAgent As Agent
'Set the object variable for the Microsoft Agent ActiveX control.
'set g_ctlAgent= new
'Establish a connection to Microsoft Agent.
Agent1.Connected = True
'Load the character animation data file from the default folder.
Agent1.Characters.Load "genie", _
"D:\Users\Yv\SoundDump\Agents\genie.acs"
'Set the object variable for the character.
'Set genie = Agent1.Characters(CharacterID:="genie")
Agent1.Characters.Character("genie").Show
Agent1.Characters.Character("genie").LanguageID = &H409
'Agent1.Characters.Character("genie"). = "MyAgent Commands"
Agent1.Characters.Character("genie").Commands.Caption = "MyAgent Commands"
Agent1.Characters.Character("genie").Commands.Visible = True
Agent1.Characters.Character("genie").Commands.Voice = "MyAgent Commands"
Agent1.Characters.Character("genie").Commands.Visible = True
Agent1.Characters.Character("genie").Commands.Voice = "MyAgent Commands"
Agent1.Characters.Character("genie").Commands.Add "Bye bye", "Bye bye", "... bye bye ...", True, True
Agent1.Characters.Character("genie").Commands.Add "Down", "Down", "... down ...", True, True
Agent1.Characters.Character("genie").Commands.Add "Happy", "Happy", "... happy ...", True, True
Agent1.Characters.Character("genie").Commands.Add "Hello", "Hello", "Hello Merlin", True, True
Agent1.Characters.Character("genie").Commands.Add "Left", "Left", "... left ...", True, True
Agent1.Characters.Character("genie").Commands.Add "Move", "Move", "... move ...", True, True
Agent1.Characters.Character("genie").Commands.Add "Right", "Right", "... right ...", True, True
Agent1.Characters.Character("genie").Commands.Add "Sad", "Sad", "... sad ...", True, True
Agent1.Characters.Character("genie").Commands.Add "Up", "Up", "... up ...", True, True
End Sub
thanx
-
December 29th, 2003, 03:55 PM
#2
There is a simpler way for speech commands.. If you want I can get you an example real fast..
-
December 29th, 2003, 04:06 PM
#3
Here..
Code:
Private Sub DirectSR1_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)
Select Case LCase(Phrase)
Case "up"
MsgBox "You Said: Up"
Case "down"
MsgBox "You Said: Down"
Case "hide"
MsgBox "You Said: Hide"
End Select
End Sub
Private Sub Form_Load()
Dim Grammar As String
'This is the grammar DirectSR will use it contains all the words it will recognize
Grammar = "[Grammar]" & vbCrLf & _
"langid = 1033" & vbCrLf & _
"type=cfg" & vbCrLf & _
"[<Start>]" & vbCrLf & _
"<start>=Up" & vbCrLf & _
"<start>=Down" & vbCrLf & _
"<start>=Hide"
DirectSR1.GrammarFromString Grammar 'Load up our grammar we created above
End Sub
Make sure you include the Microsoft Direct Speech Recognition Control
-
December 30th, 2003, 07:50 AM
#4
Thanx buddy for reply.
direct speech recognition control is not working my side.I copied the code which u given.
Is any addtional seeting required.I have tested my mike it's working.
-
January 6th, 2004, 07:04 PM
#5
Oops, sorry about that I forgot a line.
This is how it should be.
Code:
Private Sub DirectSR1_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)
Select Case LCase(Phrase)
Case "up"
MsgBox "You Said: Up"
Case "down"
MsgBox "You Said: Down"
Case "hide"
MsgBox "You Said: Hide"
End Select
End Sub
Private Sub Form_Load()
Dim Grammar As String
'This is the grammar DirectSR will use it contains all the words it will recognize
Grammar = "[Grammar]" & vbCrLf & _
"langid = 1033" & vbCrLf & _
"type=cfg" & vbCrLf & _
"[<Start>]" & vbCrLf & _
"<start>=Up" & vbCrLf & _
"<start>=Down" & vbCrLf & _
"<start>=Hide"
DirectSR1.GrammarFromString Grammar 'Load up our grammar we created above
DirectSR1.Activate 'Forgot this line.. Sorry about that
End Sub
Last edited by Jinto; January 6th, 2004 at 07:07 PM.
-
February 26th, 2010, 01:27 AM
#6
Re: MsAgents
I have been trying this code in a VBA environment, I loaded the speech recognition controls and it should work, but it's not responding to any input from the mic.
I would appreciate any help
Thanks
Basem
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|