Does anyone know why C# Speech recognition suddenly doesnt work anymore?

Viewed 213

some days ago, I wanted to make an application that could recognize Speech and turn it into text. I needed severell hours to make the System.Speech.Recognition run. I faced Issues that were questioned alot and answered always in another way. None worked for me. In the end I got it to work.

Today I started the program, and it worked fine. It could hear me and recognize the words I said. But about 3 hours later It completly stopped to work. All I did in the time was unplug my headset once and plug it in again. I changed nothing at the code. I didnt even restart Visual Studio. It was still running from before. I now also restarted the Computer without any success. I have absolutely no idea what happened. I got a Message that dont lead to an error (Searching for this Message did not help me in any way): "Information: 0 : SAPI does not implement phonetic alphabet selection."

I know this isnt much information, if you need some i did not mentioned, just ask. Can anyone help me out solving this?

Here the code:

        using (recognizer = new SpeechRecognitionEngine(new System.Globalization.CultureInfo("de-DE")))
        {

            // Create and load a dictation grammar.
            Choices services = new Choices(new string[] { "rennen", "laufen", "schleichen", "renn", "lauf", "schleich", "jetzt", "kiste", "Generator", "Stop", "Halt", "Warte", "rechts", "links", "Rückwärts", "hinten" });

            // Create a Grammar object from the GrammarBuilder and load it to the recognizer.
            Grammar servicesGrammar = new Grammar(services);
            recognizer.LoadGrammarAsync(servicesGrammar);

            // Configure input to the speech recognizer.
            recognizer.SetInputToDefaultAudioDevice();
            

            recognizer.SpeechRecognized += new EventHandler<SpeechRecognizedEventArgs>(recognizer_SpeechRecognized);
            recognizer.RecognizeAsync(RecognizeMode.Multiple);

            // Keep the console window open.
            while (true)
            {
                Thread.Sleep(5);
            }

        }

    public void recognizer_SpeechRecognized(object sender, SpeechRecognizedEventArgs e)
    {
        //Nothing Important here, because it never reaches that point
    }
1 Answers

For everyone that has the same Problem: Im sorry I cant give you an answer how it worked again. It suddenly worked again, without any changes... very strange behavior

Related