Quantcast
Channel: Visio General Questions and Answers for IT Professionals forum
Viewing all articles
Browse latest Browse all 2333

How to Convert wav file to text file and stop Page execution in asp.net

$
0
0
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.




Viewing all articles
Browse latest Browse all 2333

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>