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

C# 语音识别在此系统上不可用。找不到SAPI和语音识别引擎,c#,microsoft-speech-platform,C#,Microsoft Speech Platform,你好! 我尝试使用SpeechSDK 11编写简单的语音到文本引擎。 所以试着执行这个例子中的测试 所以,我只是创建控制台应用程序并运行代码。(带任务) 您是否同时添加了x64和x86版本的运行时组件?这对我很有效。面临同样的问题。未安装运行时。从安装运行时解决了我的问题 Task speechRecognizer = new Task(DoWork); speechRecognizer.Start(); speechRecognizer.Wait(); st

你好! 我尝试使用SpeechSDK 11编写简单的语音到文本引擎。 所以试着执行这个例子中的测试

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


您是否同时添加了x64和x86版本的运行时组件?这对我很有效。

面临同样的问题。未安装运行时。从安装运行时解决了我的问题

 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();
    }
 // Create a new SpeechRecognitionEngine instance.
    SpeechRecognitionEngine sre = new SpeechRecognitionEngine();