using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Speech; using System.Threading; using System.Speech.Recognition ; using System.Speech.Synthesis ; using System.Globalization; using System.IO; using System.Text; namespace testcode { public partial class Read : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void Button1_Click(object sender, EventArgs e) { SpeechRecognitionEngine RecognitionEngine; using (RecognitionEngine = new SpeechRecognitionEngine(new CultureInfo("en-US"))) { RecognitionEngine.SetInputToWaveFile(Server.MapPath("~/speech.wav")); RecognitionEngine.LoadGrammar(new DictationGrammar()); RecognitionResult Result = RecognitionEngine.Recognize(); StringBuilder Output = new StringBuilder(); foreach (RecognizedWordUnit Word in Result.Words) { Output.Append(Word.Text + " "); textBox1.Text = Output.ToString(); } } } } }
RecognitionEngine.SetInputToWaveFile(Server.MapPath("~/speech.wav"));
Button1_Click
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)