开发者

Controlling the microphone input state in System.Speech.Recognition

开发者 https://www.devze.com 2023-01-05 03:28 出处:网络
I\'m creating a program in C# using System.Speech.Recognition that recognizes voice commands and translates them to internal commands for another process.

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.

开发者_如何学Python

The 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消