using System.Speech.Recognition;
Windows.Media.SpeechRecognition
// Create an in-process speech recognizer for the en-US locale. SpeechRecognitionEngine recognizer = new SpeechRecognitionEngine(new System.Globalization.CultureInfo("en-US")); try { // Create and load a dictation grammar. recognizer.LoadGrammar(new DictationGrammar()); // Add a handler for the speech recognized event. recognizer.SpeechRecognized += new EventHandler<SpeechRecognizedEventArgs>(recognizer_SpeechRecognized); // Configure input to the speech recognizer. recognizer.SetInputToDefaultAudioDevice(); // Start asynchronous, continuous speech recognition. recognizer.RecognizeAsync(RecognizeMode.Multiple); } catch(Exception ex) { MessageBox.Show(ex.Message); } void recognizer_SpeechRecognized(object sender, SpeechRecognizedEventArgs e) { //Console.WriteLine("Recognized text: " + e.Result.Text); if (e.Result.Text == term) { BackColor = Color.Green; Program.speak("Correct."); } else { //Program.speak("Wrong"); } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)