语音识别在此系统上不可用.找不到SAPI和语音识别引擎

本文关键字:语音识别 找不到 SAPI 引擎 系统 | 更新日期: 2023-09-27 18:10:24

大家好!我尝试用语音SDK 11编写简单的语音到文本引擎。所以尝试执行这个例子中的test。

所以,我只是创建控制台应用程序和运行代码。(任务)

 Task speechRecognizer = new Task(DoWork);
        speechRecognizer.Start();
        speechRecognizer.Wait();
static void DoWork()
    {
        // Create a new SpeechRecognitionEngine instance.
        SpeechRecognitionEngine sre = new SpeechRecognitionEngine();
        // Configure the input to the recognizer.
        sre.SetInputToWaveFile(@"c:'Test'Colors.wav");
        // Create a simple grammar that recognizes "red", "green", or "blue".
        Choices colors = new Choices();
        colors.Add(new string[] { "red", "green", "blue" });
        // Create a GrammarBuilder object and append the Choices object.
        GrammarBuilder gb = new GrammarBuilder();
        gb.Append(colors);
        // Create the Grammar instance and load it into the speech recognition engine.
        Grammar g = new Grammar(gb);
        sre.LoadGrammar(g);
        // Register a handler for the SpeechRecognized event.
        sre.SpeechRecognized +=
          new EventHandler<SpeechRecognizedEventArgs>(sre_SpeechRecognized);
        // Start recognition.
        sre.Recognize();
    }

但我得到这个例外:语音识别在这个系统上不可用。找不到SAPI和语音识别引擎。我尝试安装SpeechSDK51,但是没有结果。

你能告诉我如何修复这个错误吗?

谢谢!

注:错误出现在:

 // Create a new SpeechRecognitionEngine instance.
    SpeechRecognitionEngine sre = new SpeechRecognitionEngine();

语音识别在此系统上不可用.找不到SAPI和语音识别引擎

您是否添加了x64和x86版本的运行时组件?

面临同样的问题。未安装运行时。从microsoft官方下载页面安装运行时解决了我的问题。