I'm creating a program in C# using System.Speech.Recognition that recognizes voice commands and translates them to internal commands for another process.
Is there any for my app to internally control the state of the microphone input? (on/asleep/off) This question is similar to this one but its accepted answer turned to C++ which is beyond my power. The suggested C# method to set the SpeechRecognizer.State property is not working since it is read-only.
开发者_如何学PythonThe ideal would be if I could hide the Windows Speech microphone control altogether and have my own control inside my app. Really all I need is to control the voice input to my app and let other programs work transparently.
Thanks in advance.
As far as not relying on the Windows Speech recognizer, switch from using System.Speech.Recognition.SpeechRecognizer
to using the System.Speech.Recognition.SpeechRecognitionEngine
instead. That allows for better control over the grammars recognized by the engine.
By switching to the SpeechRecognitionEngine
it means that the microphone will be listening for whatever grammars you provide the entire time the engine is running. I'm not sure if this is the behavior you want or not, but it sounds to be that way.
精彩评论