且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

C#中的语音识别

更新时间:2023-11-19 21:37:28



我想了解您的问题是什么,我还没有在我的环境中尝试过.
但是,每当一个单词被识别时,就会调用RecognitionEngine.SpeechRecognized事件,因此在您的情况下,您总是必须说开始",然后说上".但是我认为这行不通,因为您的开关位于if-"start"语句中.
因此,您需要的是一个bool变量,例如,如果识别出开始"(true),它将可以处理您的切换,否则bool仍然为false.

希望对您有所帮助!

此致
Hi,

I''m trying to understand what''s your problem is, I didn''t tried it in my enviroment yet.
But recognitionEngine.SpeechRecognized event is called everytime a word is recognized, so in your case you would always have to say "start" and then "up" or something. But I think this can''t work because your switch is IN the if-"start" statement.
So what you need is something like a bool variable, like if "start" was recognized (true), it can handle your switch, otherwise bool is still false.

Hope that helps!

Best Regards