Search code examples
c#speech-recognitionsapi

SpeechRecognitionEngine recognizers


I just downloaded the fr-FR runtime language pack so that I can recognize French speech through my program.

However, my program throws the error

Additional information: No recognizer of the required ID found.

at

SpeechRecognitionEngine recognizer = 
    new SpeechRecognitionEngine(new System.Globalization.CultureInfo("fr-FR"));

en-US and en-GB works because they are pre-installed with my system, I just installed these new language packs but they are still throwing this exception.

Also, if this helps, when I do

foreach (var x in SpeechRecognitionEngine.InstalledRecognizers())
{
    Console.Out.WriteLine(x.Name);
}

it prints

MS-1033-80-DESK

EDIT: This is not a possible duplicate because this isn't about having no recognizers installed, it's about C# SAPI not seeing that I have the installed pack for the current language


Solution

  • I was able to get this to work... there is an extra step involved.

    Since you're using System.Speech, it uses the installed Desktop speech recognition that comes with Windows. The error you're getting is not because you don't have the language installed, but because you didn't install the speech recognizer for that language.

    So, head on over to Setting > Time and Language > Region and language (which is probably where you installed the language from). After you install the language, select the language, and click 'Options'. You should see options to download the language pack, spell checking, and the one we're interested in, Speech. Click Download, and wait for the download/install to finish.

    Once it's done, you won't get a notification, but you can go into Settings > Time and Language > Speech and see your installed recognizers there, or you can go to Settings > Speech Recognition > Advanced Speech Options to see the same list.

    Now when you run your program, it should work. BTW, if you want to see the installed speech recognizers in your code, use this instead:

    foreach (var x in SpeechRecognitionEngine.InstalledRecognizers())
                {
                    Console.WriteLine(x.Culture.Name);   
                }
    

    You only get a code when asking for the recognizers name, you want the culture's name. (as you saw, MS-1033-80-DESK corresponds to en-US. For reference, fr-FR is MS-1036-80-DESK).