我的程序中有一个问题。我想将语音转换为文本,我有一个代码:
Choices sList = new Choices();
sList.Add(new string[] { "hello" });
Grammar gr = new Grammar(new GrammarBuilder(sList));
try {
sRecognize.RequestRecognizerUpdate();
sRecognize.LoadGrammar(gr);
sRecognize.SpeechRecognized += sRecognize_SpeechRecognized;
sRecognize.SetInputToDefaultAudioDevice();
sRecognize.RecognizeAsync(RecognizeMode.Multiple);
sRecognize.Recognize();
}
catch (Exception ex) {
MessageBox.Show(ex.Message.ToString());
}
但是当我使用它时,Visual Studio 会给出异常“platformnotsupportedexception”并说“未安装识别器”。我有一个麦克风,但我不知道为什么这不起作用。请帮我。