protected void Button1_Click1(object sender, EventArgs e) { string text1 = ReadAudio(); System.IO.File.WriteAllText(Server.MapPath("~/Uploads/Text/" + filenamewithoutextension + ".txt"), text1); } public string ReadAudio() { SpeechRecognitionEngine sre = new SpeechRecognitionEngine(); Grammar gr = new DictationGrammar(); sre.LoadGrammar(gr); sre.SetInputToWaveFile(bestpath); sre.BabbleTimeout = new TimeSpan(Int32.MaxValue); sre.InitialSilenceTimeout = new TimeSpan(Int32.MaxValue); sre.EndSilenceTimeout = new TimeSpan(100000000); sre.EndSilenceTimeoutAmbiguous = new TimeSpan(100000000); StringBuilder sb = new StringBuilder(); while (true) { try { var recText = sre.Recognize(); if (recText == null) { break; } sb.Append(recText.Text); } catch (Exception ex) { //handle exception //... break; } } return sb.ToString(); }
Hi Team,
i have send image of my asp page in that i am uploading wav file and converting to text and displaying to text area but the process is not complating please help me out from this problem.