using System; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using System.Speech.Recognition; using static System.Windows.Forms.VisualStyles.VisualStyleElement; using System.Globalization; using System.Speech.Synthesis; namespace WindowsFormSpeechtotext { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { SpeechRecognitionEngine speechRecognition = new SpeechRecognitionEngine (new System.Globalization.CultureInfo("en-US")); speechRecognition.SetInputToDefaultAudioDevice(); Grammar grammar = new DictationGrammar(); speechRecognition.LoadGrammar(grammar); speechRecognition.SpeechRecognized += new EventHandler<SpeechRecognizedEventArgs> (SpeechRecognition_SpeechRecognized); // speechRecognition.RecognizeAsync(RecognizeMode.Multiple); } private void SpeechRecognition_SpeechRecognized (object sender, SpeechRecognizedEventArgs e) { richTextBox1.Text += e.Result.Text + "\r\n"; }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)