Change the language of Speech Recognition Engine library

Fernando Santiago picture Fernando Santiago · Dec 20, 2012 · Viewed 13.8k times · Source

I am working on a program (in C#) to recognize voice commands from the user and execute in the PC, i.e. the user says "start menu" and the PC opens the start menu.

I have find a cool library: SpeechRecognitionEngine for the speech recognition, the problem is that I need to recognize spanish language too, is there any way to change the language?

Answer

keyboardP picture keyboardP · Dec 20, 2012

You can use the SpeechRecognitionEngine(CultureInfo) overload.

var speechRec = new SpeechRecognitionEngine(new CultureInfo("es-ES")));

This assumes that the user has the Spanish culture installed, otherwise an ArgumentException will be thrown. The SpeechRecognitionEngine class implements IDisposable, so it's a good idea to call speechRec.Dispose() when you're done, or use it in a using statement.