Windows7 上语音识别 C# WPF 应用程序的两个问题
我制作了一个应用程序,它使用 SpeechRecognizer 类来设置简单的语法并识别简单的单词。
当我在 Win7 上运行它时,我注意到两件事。
1)我第一次启动应用程序时,语音识别栏(东西)出现,但我的应用程序的用户界面未显示(正如我在任务管理器中看到的那样,它正在运行)。 当我第二次启动应用程序时(杀死第一个实例后),它正常显示(Windows 语音识别工具栏已经运行)。
2)当我第二次说出我在应用程序中识别的单词之一时,它不会触发事件 - 相反 - 它会选择我的应用程序上的文本,我在列表框中打印出已识别单词的历史记录。
注意:当我从主屏幕中删除历史列表框时,它会按预期工作。显然,Win7 首先尝试在我的 UI 中查找该单词,当它找不到它时 - 只有这样它才会触发我的编程事件...?
这两个问题对我来说都很奇怪。
有关该应用程序的更多信息:它是一个用 C# 编写的 VS2008/.NET 3.0 WPF 应用程序。该应用程序允许用户编辑用于发送 Midi 命令的设置组(补丁)。每个补丁都标有一个短语。当说出该短语(由应用程序识别)时,所有配置的 Midi 命令都会发送到输出。用户调用的补丁的历史记录打印在应用程序主屏幕上的“历史记录”列表中。
我希望有人能帮助我解决这个问题。任何建议都是非常受欢迎的。
谢谢, 马克·雅各比
I've made an app that uses the SpeechRecognizer class to setup a simple grammar and recognize simple words.
When I run it on Win7 I notice two things.
1) The first time I start the app the Speech recognition bar (thingy) comes up, but the UI of my app is not shown (it is running as I can see in the Task Manager).
When I start the app for the 2nd time (after killing the first instance) it display normally (with the windows speech recognition toolbar already running).
2) When I speak one of the words I'm recognizing in my app a 2nd time, it does not trigger an event -instead- it selects the text on my app where I print out in a listbox the history of the recognized words.
Note: When I remove the history listbox from the main screen, it works as expected. Apperently Win7 tries to find the word in my UI first and when it cannot find it - only then does it trigger my programmatic event...??
Both problems seem very weird to me.
More info on the app: Its a VS2008/.NET 3.0 WPF app written in C#. The application allows a user to edit setting groups (patches) for sending Midi commands. Each Patch is tagged with a phrase. When that Phrase is spoken (recognized by the app) all configured Midi commands are sent to the output(s). The history of patches that were recalled by the user are printed in a 'history' list on the apps main screen.
I hope someone can help me with this. Any suggestions are most welcome.
Thanx,
Marc Jacobi
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我认为您正在使用共享语音识别器(SpeechRecognizer)。当你实例化时
SpeechRecognizer 为您提供了一个可以由其他应用程序共享的识别器,通常用于构建应用程序来控制窗口和桌面上运行的应用程序。
听起来您想使用自己的私有识别引擎(SpeechRecognitionEngine)。因此,请实例化 SpeechRecognitionEngine。
请参阅 http:// msdn.microsoft.com/en-us/library/system.speech.recognition.speechrecognizer(v=vs.90).aspx
System.Speech.Recognition 和 Microsoft.Speech.Recognition 之间有什么区别? 和 禁用内置语音识别命令?也可能有一些有用的信息。
I think you are using the shared speech recognizer (SpeechRecognizer). When you instantiate
SpeechRecognizer you get a recognizer that can be shared by other applications and is typically used for building applications to control windows and applications running on the desktop.
It sounds like you want to use your own private recognition engine (SpeechRecognitionEngine). So instantiate a SpeechRecognitionEngine instead.
see http://msdn.microsoft.com/en-us/library/system.speech.recognition.speechrecognizer(v=vs.90).aspx
What is the difference between System.Speech.Recognition and Microsoft.Speech.Recognition? and Disable built-in speech recognition commands? may also have some helpful info.
我成功了,谢谢!
使用 SpeechRecognizer 和 SpeechRecognitionEngine 之间的主要区别是:
希望有帮助。
I got it working, thanx!
The main difference between using the SpeechRecognizer and the SpeechRecognitionEngine are:
Hope it helps.