Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Speech.Recognition;
- namespace Test
- {
- class Program
- {
- static void Main(string[] args)
- {
- // Create an in-process speech recognizer for the en-US locale.
- SpeechRecognitionEngine recognizer = new SpeechRecognitionEngine(new System.Globalization.CultureInfo("es-ES"));
- // 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);
- // Keep the console window open.
- Console.ReadLine();
- }
- // Handle the SpeechRecognized event.
- static void recognizer_SpeechRecognized(object sender, SpeechRecognizedEventArgs e)
- {
- Console.WriteLine("Recognized text: " + e.Result.Text);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement