3

Good day! I try to write simple speech to text engine use Speech SDK 11. So try to execute test from this example .

So , i just create console app and run code. (with task)

 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();
    }

But i get this exception:Speech Recognition is not available on this system. SAPI and Speech Recognition engines cannot be found.I try to install SpeechSDK51 ,but have no result.

Can you tell me how to fix this error?

Thank you!

P.S. Error arises at :

 // Create a new SpeechRecognitionEngine instance.
    SpeechRecognitionEngine sre = new SpeechRecognitionEngine();
user2545071
  • 1,408
  • 2
  • 24
  • 46

2 Answers2

6

Did you add both the x64 and the x86 versions of the runtime component? It worked for me.

Ricardo Peres
  • 13,724
  • 5
  • 57
  • 74
1

Faced the same issue. The runtime wasn't installed. Installing the runtime from microsoft official download page resolved my issue.

Mahbubur Rahman
  • 4,961
  • 2
  • 39
  • 46