3 Replies - 358 Views - Last Post: 10 October 2019 - 08:55 AM Rate Topic: -----

#1 ebixonexpedit   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 08-October 19

I need to add more choices at run time on voice recognition using .net

Posted 08 October 2019 - 09:33 AM

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.

Here is my code
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



Please help me

Is This A Good Question/Topic? 0
  • +

Replies To: I need to add more choices at run time on voice recognition using .net

#2 modi123_1   User is offline

  • Suitor #2
  • member icon



Reputation: 15300
  • View blog
  • Posts: 61,364
  • Joined: 12-June 08

Re: I need to add more choices at run time on voice recognition using .net

Posted 08 October 2019 - 09:38 AM

You wrote all of that, including the existing choices, but you don't know how to add a fourth choice? That's super sketchy.

Also be aware of the rules about asking for people to do your work for you.

Also seen here if anyone wants to see those responses.
https://stackoverflo...ion-at-run-time
Was This Post Helpful? 0
  • +
  • -

#3 Gabrel   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 09-October 19

Re: I need to add more choices at run time on voice recognition using .net

Posted 09 October 2019 - 05:56 AM

Start with some type of dynamic array/list, a List(Of String) would probably be a good idea. Add the fixed choices at form load time. You can then let the user add any other choices via a dialog or simple text box, and append them to your list. You then need to recreate your grammar for each additional word.

Refer..
https://stackoverflo...t-voice-command
Was This Post Helpful? 0
  • +
  • -

#4 astonecipher   User is offline

  • Senior Systems Engineer
  • member icon

Reputation: 2955
  • View blog
  • Posts: 11,472
  • Joined: 03-December 12

Re: I need to add more choices at run time on voice recognition using .net

Posted 10 October 2019 - 08:55 AM

Where ever you copied that from, should be able to tell you how they added the original list....
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1