Click here to Skip to main content
15,887,421 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
i have a code working for a smal sound wave but i have to convert a full lenght english song to text.... my code is only working with a short sound wave...i have written my code below ...what is wrong with this code and what are the changes i have to make in this code ...thanks
C#
if(open.ShowDialog() == DialogResult.OK)
           {
             SpeechRecognitionEngine sre = new SpeechRecognitionEngine();
               Grammar gr = new DictationGrammar();
               sre.LoadGrammar(gr);
               sre.SetInputToWaveFile(open.FileName);
               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;
                   }
               }
               richTextBox1.AppendText( sb.ToString());


           }
Posted
Updated 30-Jan-14 20:21pm
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900