Hi,
I'm try to develop a voice recognition program using vb.net. My question is how can i add "paint" to commandchoices at run time when a button is pressed.
Dim commandChoices As New Choices("wordpad", "notepad", "word")
I need to add/append "paint"to this line when a button is pressed at runtime.
Please help me with sample code.
What I have tried:
recog = New SpeechRecognitionEngine()
recog.SetInputToDefaultAudioDevice()
recog.RecognizeAsyncStop()
recog.UnloadAllGrammars()
---form load event---
Dim commandChoices As New Choices("wordpad", "notepad", "word")
Dim grammarBuilder As New GrammarBuilder(New Choices("open", "close", "Hello"))
grammarBuilder.Append(commandChoices)
Dim commandChoices1 As New Choices("google", "facebook", "yahoo", "apple")
Dim grammarBuilder1 As New GrammarBuilder(New Choices("goto"))
grammarBuilder1.Append(commandChoices1)
Dim grammarbuilder2 As New GrammarBuilder(New Choices("Calculator", "TaskManager", "MyComputer", "CommandPrompt", "C-Panel", "D-Drive", "C-Drive"))
Dim g As New Grammar(New Choices(grammarBuilder, grammarBuilder1, grammarbuilder2))
g.Name = "Available programs"
recog.LoadGrammarAsync(g)
recog.RecognizeAsync(RecognizeMode.Multiple)
AddHandler recog.AudioLevelUpdated, AddressOf Me.auevent
AddHandler recog.SpeechRecognized, AddressOf Me.recevent
AddHandler recog.SpeechRecognitionRejected, AddressOf Me.recfailevent