| | |
Voice Recogntion VB06 newbie asking
Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Oct 2006
Posts: 1
Reputation:
Solved Threads: 0
Hello you all.
I am an MA student in Creative Music Technology and currently
trying to write a little game based on voice recognition.
I downloaded the speech SDK 5.1 from Microsoft and had a look at the example code.
Evertime I hit "run" I am prompted with:
"Runtime Error (lots of numbers)
Method 'initialized' of object 'IVcommand' failed".
When I press "debug" in this dialogue, it says "MSDN collection does
not exist."
What is wrong?
Please help!
Great a many thanks,
bye,
Lea
Option Explicit
Public My_menu As Long
Public Sub_menu As Long
Public Frm_Active As Long
Private Loop_1 As Long
Private TCount As Long
Private Text_Forms() As Frm_Text
Private Frm_loaded() As Boolean
'boolean means "1 or 0" or "Yes or No".
Public Frm_Count As Long
Public Frm_VC_Vis As Boolean
'these are all the variables to be declared and all the routines to be
'happening within the program and their return value types.
Private Sub MDIForm_Load()
'this is the main form "Frm_Main")
Dim Command As String, Description As String, Category As String, Flags As Long, Action As String
VoiceCmd.Initialized = 1
VoiceCmd.Enabled = 1
My_menu = VoiceCmd.MenuCreate("Main Commands", "commands State", 4)
'we create a menu the name of which will be "My_menu".
VoiceCmd.AddCommand My_menu, 1, "open", "Open File", "listen list", 0, ""
VoiceCmd.AddCommand My_menu, 1, "show list", "show voice commands list", "listen list", 0, ""
VoiceCmd.AddCommand My_menu, 1, "exit", "Exit App", "listen list", 0, ""
VoiceCmd.AddCommand My_menu, 1, "stop listening", "Stop Listen", "listen list", 0, ""
VoiceCmd.Activate My_menu
Sub_menu = VoiceCmd.MenuCreate("Sub Commands", "commands State", 4)
'now we create another menu, a "Sub_menu".
VoiceCmd.AddCommand Sub_menu, 1, "close", "Close File", "listen list", 0, ""
VoiceCmd.AddCommand Sub_menu, 1, "save", "Save File", "listen list", 0, ""
VoiceCmd.AddCommand Sub_menu, 1, "select all", "Select all text", "listen list", 0, ""
VoiceCmd.AddCommand Sub_menu, 1, "select to end", "Select text to end", "listen list", 0, ""
VoiceCmd.AddCommand Sub_menu, 1, "select to begin", "select text to begin", "listen list", 0, ""
ReDim Text_Forms(0)
ReDim Frm_loaded(0)
End Sub
Private Sub File_Close_Click()
' Code to 'Close' a file
Unload Text_Forms(Frm_Active)
End Sub
Private Sub File_Open_Click()
' Code to 'OPEN' a File
' When we load a file here, is this then the file containing lists of commands that can be recognised?
Dim New_Frm As Long
CD1.FileName = ""
CD1.Filter = "*.txt|*.txt"
CD1.ShowOpen
New_Frm = -1
If (CD1.FileName <> "") Then
For Loop_1 = 0 To UBound(Text_Forms)
If Not Frm_loaded(Loop_1) Then
New_Frm = Loop_1
Exit For
End If
Next Loop_1
If New_Frm = -1 Then
New_Frm = (UBound(Text_Forms) + 1)
ReDim Preserve Text_Forms(New_Frm)
ReDim Preserve Frm_loaded(New_Frm)
End If
Set Text_Forms(New_Frm) = New Frm_Text
Load Text_Forms(New_Frm)
Text_Forms(New_Frm).Load_File CD1.FileName
Frm_loaded(New_Frm) = True
Text_Forms(New_Frm).My_Index = New_Frm
End If
Frm_Active = -1
End Sub
Private Sub File_Save_Click()
' Code to 'SAVE' a file
Text_Forms(Frm_Active).Save_text
End Sub
Private Sub Main_Exit_Click()
' Code to 'EXIT' the application
Unload Me
End Sub
Private Sub MDIForm_Unload(Cancel As Integer)
' release the usage of the command menu.
VoiceCmd.Enabled = 0
TCount = VoiceCmd.CountCommands(My_menu)
For Loop_1 = TCount To 1 Step -1
VoiceCmd.Remove My_menu, Loop_1
Next Loop_1
VoiceCmd.ReleaseMenu My_menu
TCount = VoiceCmd.CountCommands(Sub_menu)
For Loop_1 = TCount To 1 Step -1
VoiceCmd.Remove Sub_menu, Loop_1
Next Loop_1
VoiceCmd.ReleaseMenu Sub_menu
End Sub
Private Sub Voice_Listen_Click()
If Voice_Listen.Checked Then
' Deactivate my list of commands. These will now not show in the
' 'What can I say' form of Microsoft Voice apllication
VoiceCmd.Deactivate My_menu
Voice_Listen.Checked = False ' uncheck the menu item
Else
' Activate my list of commands. These will show in the 'What can I say' form of
' Microsoft Voice apllication
VoiceCmd.Activate My_menu
Voice_Listen.Checked = True ' check the menu item
End If
End Sub
Private Sub Voicecmd_CommandRecognize(ByVal ID As Long, ByVal CmdName As String, ByVal Flags As Long, ByVal Action As String, ByVal NumLists As Long, ByVal ListValues As String, ByVal Command As String)
If Frm_VC_Vis Then
Frm_VoiceCmd.Detect.Caption = Command
End If
' One of our listed commands has been spoken
' Look for it in a list and execute the relevant commands
Select Case UCase(Command)
Case "OPEN"
File_Open_Click
Case "EXIT"
Unload Me
Case "SAVE"
File_Save_Click
Case "CLOSE"
File_Close_Click
Case "SHOW LIST"
Frm_VoiceCmd.Visible = True
Case "STOP LISTENING"
Voice_Listen_Click
Case Else
If Not Frm_Active = -1 Then
Text_Forms(Frm_Active).Voice_commands (UCase(Command))
End If
End Select
End Sub
Public Sub Add_Sub_Commands()
VoiceCmd.Activate Sub_menu
If Frm_VC_Vis Then
Frm_VoiceCmd.Refresh_List
End If
End Sub
Public Sub Rem_Sub_Commands()
VoiceCmd.Deactivate Sub_menu
If Frm_VC_Vis Then
Frm_VoiceCmd.Refresh_List
End If
Frm_Active = -1
'so "No, the form is not active anymore." ?
End Sub
Private Sub VoiceCmd_VUMeter(ByVal Level As Long)
' this code is for checking the input meters.
If Frm_VC_Vis Then
If Frm_VoiceCmd.VU_Meter.Max < Level Then Frm_VoiceCmd.VU_Meter.Max = Level
Frm_VoiceCmd.VU_Meter.Value = Level
End If
End Sub
Private Sub Voice_show_Click()
Frm_VoiceCmd.Visible = True
Frm_VC_Vis = True
End Sub
Public Sub Unload_Text_Frm(Index As Long)
Frm_loaded(Index) = False
End Sub
I am an MA student in Creative Music Technology and currently
trying to write a little game based on voice recognition.
I downloaded the speech SDK 5.1 from Microsoft and had a look at the example code.
Evertime I hit "run" I am prompted with:
"Runtime Error (lots of numbers)
Method 'initialized' of object 'IVcommand' failed".
When I press "debug" in this dialogue, it says "MSDN collection does
not exist."
What is wrong?
Please help!
Great a many thanks,
bye,
Lea
Option Explicit
Public My_menu As Long
Public Sub_menu As Long
Public Frm_Active As Long
Private Loop_1 As Long
Private TCount As Long
Private Text_Forms() As Frm_Text
Private Frm_loaded() As Boolean
'boolean means "1 or 0" or "Yes or No".
Public Frm_Count As Long
Public Frm_VC_Vis As Boolean
'these are all the variables to be declared and all the routines to be
'happening within the program and their return value types.
Private Sub MDIForm_Load()
'this is the main form "Frm_Main")
Dim Command As String, Description As String, Category As String, Flags As Long, Action As String
VoiceCmd.Initialized = 1
VoiceCmd.Enabled = 1
My_menu = VoiceCmd.MenuCreate("Main Commands", "commands State", 4)
'we create a menu the name of which will be "My_menu".
VoiceCmd.AddCommand My_menu, 1, "open", "Open File", "listen list", 0, ""
VoiceCmd.AddCommand My_menu, 1, "show list", "show voice commands list", "listen list", 0, ""
VoiceCmd.AddCommand My_menu, 1, "exit", "Exit App", "listen list", 0, ""
VoiceCmd.AddCommand My_menu, 1, "stop listening", "Stop Listen", "listen list", 0, ""
VoiceCmd.Activate My_menu
Sub_menu = VoiceCmd.MenuCreate("Sub Commands", "commands State", 4)
'now we create another menu, a "Sub_menu".
VoiceCmd.AddCommand Sub_menu, 1, "close", "Close File", "listen list", 0, ""
VoiceCmd.AddCommand Sub_menu, 1, "save", "Save File", "listen list", 0, ""
VoiceCmd.AddCommand Sub_menu, 1, "select all", "Select all text", "listen list", 0, ""
VoiceCmd.AddCommand Sub_menu, 1, "select to end", "Select text to end", "listen list", 0, ""
VoiceCmd.AddCommand Sub_menu, 1, "select to begin", "select text to begin", "listen list", 0, ""
ReDim Text_Forms(0)
ReDim Frm_loaded(0)
End Sub
Private Sub File_Close_Click()
' Code to 'Close' a file
Unload Text_Forms(Frm_Active)
End Sub
Private Sub File_Open_Click()
' Code to 'OPEN' a File
' When we load a file here, is this then the file containing lists of commands that can be recognised?
Dim New_Frm As Long
CD1.FileName = ""
CD1.Filter = "*.txt|*.txt"
CD1.ShowOpen
New_Frm = -1
If (CD1.FileName <> "") Then
For Loop_1 = 0 To UBound(Text_Forms)
If Not Frm_loaded(Loop_1) Then
New_Frm = Loop_1
Exit For
End If
Next Loop_1
If New_Frm = -1 Then
New_Frm = (UBound(Text_Forms) + 1)
ReDim Preserve Text_Forms(New_Frm)
ReDim Preserve Frm_loaded(New_Frm)
End If
Set Text_Forms(New_Frm) = New Frm_Text
Load Text_Forms(New_Frm)
Text_Forms(New_Frm).Load_File CD1.FileName
Frm_loaded(New_Frm) = True
Text_Forms(New_Frm).My_Index = New_Frm
End If
Frm_Active = -1
End Sub
Private Sub File_Save_Click()
' Code to 'SAVE' a file
Text_Forms(Frm_Active).Save_text
End Sub
Private Sub Main_Exit_Click()
' Code to 'EXIT' the application
Unload Me
End Sub
Private Sub MDIForm_Unload(Cancel As Integer)
' release the usage of the command menu.
VoiceCmd.Enabled = 0
TCount = VoiceCmd.CountCommands(My_menu)
For Loop_1 = TCount To 1 Step -1
VoiceCmd.Remove My_menu, Loop_1
Next Loop_1
VoiceCmd.ReleaseMenu My_menu
TCount = VoiceCmd.CountCommands(Sub_menu)
For Loop_1 = TCount To 1 Step -1
VoiceCmd.Remove Sub_menu, Loop_1
Next Loop_1
VoiceCmd.ReleaseMenu Sub_menu
End Sub
Private Sub Voice_Listen_Click()
If Voice_Listen.Checked Then
' Deactivate my list of commands. These will now not show in the
' 'What can I say' form of Microsoft Voice apllication
VoiceCmd.Deactivate My_menu
Voice_Listen.Checked = False ' uncheck the menu item
Else
' Activate my list of commands. These will show in the 'What can I say' form of
' Microsoft Voice apllication
VoiceCmd.Activate My_menu
Voice_Listen.Checked = True ' check the menu item
End If
End Sub
Private Sub Voicecmd_CommandRecognize(ByVal ID As Long, ByVal CmdName As String, ByVal Flags As Long, ByVal Action As String, ByVal NumLists As Long, ByVal ListValues As String, ByVal Command As String)
If Frm_VC_Vis Then
Frm_VoiceCmd.Detect.Caption = Command
End If
' One of our listed commands has been spoken
' Look for it in a list and execute the relevant commands
Select Case UCase(Command)
Case "OPEN"
File_Open_Click
Case "EXIT"
Unload Me
Case "SAVE"
File_Save_Click
Case "CLOSE"
File_Close_Click
Case "SHOW LIST"
Frm_VoiceCmd.Visible = True
Case "STOP LISTENING"
Voice_Listen_Click
Case Else
If Not Frm_Active = -1 Then
Text_Forms(Frm_Active).Voice_commands (UCase(Command))
End If
End Select
End Sub
Public Sub Add_Sub_Commands()
VoiceCmd.Activate Sub_menu
If Frm_VC_Vis Then
Frm_VoiceCmd.Refresh_List
End If
End Sub
Public Sub Rem_Sub_Commands()
VoiceCmd.Deactivate Sub_menu
If Frm_VC_Vis Then
Frm_VoiceCmd.Refresh_List
End If
Frm_Active = -1
'so "No, the form is not active anymore." ?
End Sub
Private Sub VoiceCmd_VUMeter(ByVal Level As Long)
' this code is for checking the input meters.
If Frm_VC_Vis Then
If Frm_VoiceCmd.VU_Meter.Max < Level Then Frm_VoiceCmd.VU_Meter.Max = Level
Frm_VoiceCmd.VU_Meter.Value = Level
End If
End Sub
Private Sub Voice_show_Click()
Frm_VoiceCmd.Visible = True
Frm_VC_Vis = True
End Sub
Public Sub Unload_Text_Frm(Index As Long)
Frm_loaded(Index) = False
End Sub
•
•
Join Date: Oct 2006
Posts: 1
Reputation:
Solved Threads: 0
•
•
•
•
Hello you all.
I am an MA student in Creative Music Technology and currently
trying to write a little game based on voice recognition.
I downloaded the speech SDK 5.1 from Microsoft and had a look at the example code.
Evertime I hit "run" I am prompted with:
"Runtime Error (lots of numbers)
Method 'initialized' of object 'IVcommand' failed".
When I press "debug" in this dialogue, it says "MSDN collection does
not exist."
What is wrong?
Please help!
Great a many thanks,
bye,
Lea
Option Explicit
Public My_menu As Long
Public Sub_menu As Long
Public Frm_Active As Long
Private Loop_1 As Long
Private TCount As Long
Private Text_Forms() As Frm_Text
Private Frm_loaded() As Boolean
'boolean means "1 or 0" or "Yes or No".
Public Frm_Count As Long
Public Frm_VC_Vis As Boolean
'these are all the variables to be declared and all the routines to be
'happening within the program and their return value types.
Private Sub MDIForm_Load()
'this is the main form "Frm_Main")
Dim Command As String, Description As String, Category As String, Flags As Long, Action As String
VoiceCmd.Initialized = 1
VoiceCmd.Enabled = 1
My_menu = VoiceCmd.MenuCreate("Main Commands", "commands State", 4)
'we create a menu the name of which will be "My_menu".
VoiceCmd.AddCommand My_menu, 1, "open", "Open File", "listen list", 0, ""
VoiceCmd.AddCommand My_menu, 1, "show list", "show voice commands list", "listen list", 0, ""
VoiceCmd.AddCommand My_menu, 1, "exit", "Exit App", "listen list", 0, ""
VoiceCmd.AddCommand My_menu, 1, "stop listening", "Stop Listen", "listen list", 0, ""
VoiceCmd.Activate My_menu
Sub_menu = VoiceCmd.MenuCreate("Sub Commands", "commands State", 4)
'now we create another menu, a "Sub_menu".
VoiceCmd.AddCommand Sub_menu, 1, "close", "Close File", "listen list", 0, ""
VoiceCmd.AddCommand Sub_menu, 1, "save", "Save File", "listen list", 0, ""
VoiceCmd.AddCommand Sub_menu, 1, "select all", "Select all text", "listen list", 0, ""
VoiceCmd.AddCommand Sub_menu, 1, "select to end", "Select text to end", "listen list", 0, ""
VoiceCmd.AddCommand Sub_menu, 1, "select to begin", "select text to begin", "listen list", 0, ""
ReDim Text_Forms(0)
ReDim Frm_loaded(0)
End Sub
Private Sub File_Close_Click()
' Code to 'Close' a file
Unload Text_Forms(Frm_Active)
End Sub
Private Sub File_Open_Click()
' Code to 'OPEN' a File
' When we load a file here, is this then the file containing lists of commands that can be recognised?
Dim New_Frm As Long
CD1.FileName = ""
CD1.Filter = "*.txt|*.txt"
CD1.ShowOpen
New_Frm = -1
If (CD1.FileName <> "") Then
For Loop_1 = 0 To UBound(Text_Forms)
If Not Frm_loaded(Loop_1) Then
New_Frm = Loop_1
Exit For
End If
Next Loop_1
If New_Frm = -1 Then
New_Frm = (UBound(Text_Forms) + 1)
ReDim Preserve Text_Forms(New_Frm)
ReDim Preserve Frm_loaded(New_Frm)
End If
Set Text_Forms(New_Frm) = New Frm_Text
Load Text_Forms(New_Frm)
Text_Forms(New_Frm).Load_File CD1.FileName
Frm_loaded(New_Frm) = True
Text_Forms(New_Frm).My_Index = New_Frm
End If
Frm_Active = -1
End Sub
Private Sub File_Save_Click()
' Code to 'SAVE' a file
Text_Forms(Frm_Active).Save_text
End Sub
Private Sub Main_Exit_Click()
' Code to 'EXIT' the application
Unload Me
End Sub
Private Sub MDIForm_Unload(Cancel As Integer)
' release the usage of the command menu.
VoiceCmd.Enabled = 0
TCount = VoiceCmd.CountCommands(My_menu)
For Loop_1 = TCount To 1 Step -1
VoiceCmd.Remove My_menu, Loop_1
Next Loop_1
VoiceCmd.ReleaseMenu My_menu
TCount = VoiceCmd.CountCommands(Sub_menu)
For Loop_1 = TCount To 1 Step -1
VoiceCmd.Remove Sub_menu, Loop_1
Next Loop_1
VoiceCmd.ReleaseMenu Sub_menu
End Sub
Private Sub Voice_Listen_Click()
If Voice_Listen.Checked Then
' Deactivate my list of commands. These will now not show in the
' 'What can I say' form of Microsoft Voice apllication
VoiceCmd.Deactivate My_menu
Voice_Listen.Checked = False ' uncheck the menu item
Else
' Activate my list of commands. These will show in the 'What can I say' form of
' Microsoft Voice apllication
VoiceCmd.Activate My_menu
Voice_Listen.Checked = True ' check the menu item
End If
End Sub
Private Sub Voicecmd_CommandRecognize(ByVal ID As Long, ByVal CmdName As String, ByVal Flags As Long, ByVal Action As String, ByVal NumLists As Long, ByVal ListValues As String, ByVal Command As String)
If Frm_VC_Vis Then
Frm_VoiceCmd.Detect.Caption = Command
End If
' One of our listed commands has been spoken
' Look for it in a list and execute the relevant commands
Select Case UCase(Command)
Case "OPEN"
File_Open_Click
Case "EXIT"
Unload Me
Case "SAVE"
File_Save_Click
Case "CLOSE"
File_Close_Click
Case "SHOW LIST"
Frm_VoiceCmd.Visible = True
Case "STOP LISTENING"
Voice_Listen_Click
Case Else
If Not Frm_Active = -1 Then
Text_Forms(Frm_Active).Voice_commands (UCase(Command))
End If
End Select
End Sub
Public Sub Add_Sub_Commands()
VoiceCmd.Activate Sub_menu
If Frm_VC_Vis Then
Frm_VoiceCmd.Refresh_List
End If
End Sub
Public Sub Rem_Sub_Commands()
VoiceCmd.Deactivate Sub_menu
If Frm_VC_Vis Then
Frm_VoiceCmd.Refresh_List
End If
Frm_Active = -1
'so "No, the form is not active anymore." ?
End Sub
Private Sub VoiceCmd_VUMeter(ByVal Level As Long)
' this code is for checking the input meters.
If Frm_VC_Vis Then
If Frm_VoiceCmd.VU_Meter.Max < Level Then Frm_VoiceCmd.VU_Meter.Max = Level
Frm_VoiceCmd.VU_Meter.Value = Level
End If
End Sub
Private Sub Voice_show_Click()
Frm_VoiceCmd.Visible = True
Frm_VC_Vis = True
End Sub
Public Sub Unload_Text_Frm(Index As Long)
Frm_loaded(Index) = False
End Sub
anyway, just download the speech recognition engine from this site...
http://www.microsoft.com/msagent/downloads.htm. and it would solve the problem..
just feel free to mail me or message me. my ym id is lexicalthinker@yahoo.com
ciao
![]() |
Similar Threads
- Best Voice Recording Software? (Windows NT / 2000 / XP)
- As a newbie, where i should start from in linux? (Getting Started and Choosing a Distro)
- voice recognition system>HELP (Visual Basic 4 / 5 / 6)
- Add a Voice Message to an E-Mail Message (Windows tips 'n' tweaks)
- Questions about building a system (was: newbie) (Troubleshooting Dead Machines)
- webcam and voice recording (PHP)
- Email Client, SMS, Voice command (Java)
- How to network two Win98 machines (Networking Hardware Configuration)
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: VB Script for Controlling Windows Media player
- Next Thread: Properties dialog flickering problem
| Thread Tools | Search this Thread |
* 6 429 2007 access activex add age application basic beginner birth bmp calculator cd cells.find click client code college column component connection connectionproblemusingvb6usingoledb copy creat ctrl+f data database datareport date delete dissertations dissertationthesis dissertationtopic edit error excel excelmacro file filename form hardware header iamthwee image inboxinvb internetfiledownload keypress label listbox listview liveperson login looping machine microsoft movingranges number objectinsert open oracle password prime program prompt range-objects readfile reading record refresh remotesqlserverdatabase report retrieve save search sendbyte sites sort sql sql2008 sqlserver subroutine tags textbox time urldownloadtofile vb vb6 vb6.0 vba visual visualbasic visualbasic6 web window windows





