using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; using System.Speech.Recognition; namespace speech_Recognition { /// <summary> /// Interaction logic for Window1.xaml /// </summary> public partial class Window1 : Window { private SpeechRecognitionEngine _recognizer = new SpeechRecognitionEngine(); public Window1() { InitializeComponent(); } private void button_Rec_Click(object sender, RoutedEventArgs e) { _recognizer.SetInputToDefaultAudioDevice(); _recognizer.LoadGrammar(new DictationGrammar()); _recognizer.SpeechRecognized += new EventHandler<SpeechRecognizedEventArgs>(_recognizer_SpeechRecognized); _recognizer.RecognizeAsync(RecognizeMode.Multiple); } void _recognizer_SpeechRecognized(object sender, SpeechRecognizedEventArgs e) { foreach (RecognizedWordUnit word in e.Result.Words) { listBox_Results.Items.Add(word.Text); } } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)