Click here to Skip to main content
15,884,537 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
1.How to enable speech recognition without that annoying recognition window, and without having to press that button on that window?

2.I need to know how to recognize only the words in the XML that I created (to increase accuracy). Like: If I say "red" and that's not in the XML the recognizer will read it like "bread" or something in the XML.

P.S: Sorry for my english.
Posted
Updated 13-May-16 15:18pm

1 solution

First, something or somebody fooled you about the "annoying recognition window". Speech recognition does not require any windows at all. You probably worked with some stupid application, not with recognition engine itself.

The second part of the question is quite correct. You really need to supply some distinct words or phrases, to have acceptable recognition accuracy. This set of phrases is called grammar, usually created using the class System.Speech.Recognition.GrammarBuilder. Please see:
http://msdn.microsoft.com/en-us/library/system.speech.recognition.grammar[^],
http://msdn.microsoft.com/en-us/library/system.speech.recognition.grammarbuilder[^].

You build a grammar using the grammar builder based on the instance of the class Choices:
http://msdn.microsoft.com/en-us/library/system.speech.recognition.choices.aspx[^].

The purpose of it is to provide one set of choices as a constraint to an instance of the grammar used at the current moment of time. See the code sample in the article referenced above.

Basically, all you need to use the speech recognition engine can be found if you reference "Speech.dll". (This library is bundled with .NET Framework and put in GAC, so you add the reference using the tab ".NET" of the "Add Reference" window in Visual Studio.) Please see the namespace System.Speech.Recognition:
http://msdn.microsoft.com/en-us/library/system.speech.recognition.aspx[^].

The central point of this API is the class System.Speech.Recognition.SpeechRecognizer or System.Speech.Recognition.SpeechRecognitionEngine. You can choose one of them based on your requirement and application type.

Please see:
http://msdn.microsoft.com/en-us/library/system.speech.recognition.speechrecognizer.aspx[^],
http://msdn.microsoft.com/en-us/library/system.speech.recognition.speechrecognitionengine.aspx[^].

The code sample are available on each of these classes. (No window of form is required :-).)

—SA
 
Share this answer
 
v2
Comments
[no name] 1-Jul-12 14:49pm    
SA's answer very precise and detailed as always
Sergey Alexandrovich Kryukov 1-Jul-12 15:01pm    
Thank you very much,
--SA
SoMad 1-Jul-12 21:54pm    
Nice! +5.

Soren Madsen
Sergey Alexandrovich Kryukov 1-Jul-12 22:16pm    
Thank you, Soren.
--SA
Anvar Jamal 19-Apr-13 17:56pm    
not able to understand the answer of first question. the speech recognization tiny window(which it shows whether it is 'listening'/'on'/'off' opens. is there any way i can execute all my commands without letting this window open and then clicking on 'start listening' to start the process ?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900