在 System.Speech.Recognition 中控制麦克风输入状态
我正在使用 System.Speech.Recognition 在 C# 中创建一个程序,该程序可识别语音命令并将其转换为另一个进程的内部命令。
我的应用程序是否有内部控制麦克风输入状态的功能? (on/asleep/off)这个问题类似于这个但它接受的答案转向了 C++,这超出了我的能力范围。建议的用于设置 SpeechRecognizer.State 属性的 C# 方法不起作用,因为它是只读的。
理想的情况是,我可以完全隐藏 Windows 语音麦克风控件,并在我的应用程序中拥有自己的控件。实际上,我所需要的只是控制我的应用程序的语音输入,并让其他程序透明地工作。
提前致谢。
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.
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
只要不依赖 Windows 语音识别器,请从使用 System.Speech.Recognition.SpeechRecognizer 切换为使用 System.Speech.Recognition.SpeechRecognitionEngine 。这样可以更好地控制引擎识别的语法。
通过切换到 SpeechRecognitionEngine,这意味着麦克风将在引擎运行的整个过程中监听您提供的任何语法。我不确定这是否是您想要的行为,但听起来就是这样。
As far as not relying on the Windows Speech recognizer, switch from using
System.Speech.Recognition.SpeechRecognizer
to using theSystem.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.