Click here to Skip to main content
15,896,606 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
hi,

i want to convert wave file to Text format. i treid the below code it shows some output , but the words are not the same whats on the wave file, some words are correct and some are not correct.

no the main pbm is when i run the page it just keeps loading and not showing the output. if i put break point only i can able to see the output. What might be the pbm how to solve this?.
am new to this concept i dont know how to solve, i searched a lot for 2 days but cant find any reults.

pls help me out..

the below Are the codes I tried:

Code 1:
C#
public void converttotext()
    {
        string name = "F:\\August 2013\\test4.wav";
        SpeechRecognitionEngine sre = new SpeechRecognitionEngine();
        Grammar gr = new DictationGrammar();
        sre.LoadGrammar(gr);
        sre.SetInputToWaveFile(name);
        //sre.BabbleTimeout = new TimeSpan(Int32.MaxValue);
        //sre.InitialSilenceTimeout = new TimeSpan(Int32.MaxValue);
        //sre.EndSilenceTimeout = new TimeSpan(10);
        //sre.EndSilenceTimeoutAmbiguous = new TimeSpan(10);
        RecognitionResult result = sre.Recognize(new TimeSpan(10));

        text = result.Text;

        sre.Dispose();

        return text;
}


Code 2:
C#
SpeechRecognitionEngine RecognitionEngine;
                using (RecognitionEngine = new SpeechRecognitionEngine(new CultureInfo("en-US")))
                    {
                    RecognitionEngine.SetInputToWaveFile("F:\\August 2013\\test4.wav");
                    RecognitionEngine.SetInputToDefaultAudioDevice();
//RecognitionEngine.RecognizeCompleted += new EventHandler<recognizecompletedeventargs>(RecognitionEngine_RecognizeCompleted); 
                    RecognitionEngine.LoadGrammar(new DictationGrammar());
                    RecognitionResult Result = RecognitionEngine.Recognize();
                     RecognitionEngine.RecognizeAsync(RecognizeMode.Single);

                    StringBuilder Output = new StringBuilder();
                    foreach (RecognizedWordUnit Word in Result.Words)
                        {
                            Output.Append(Word.Text + " ");
                        }

// RecognitionEngine.RecognizeAsyncStop();

                    Label3.Text = Output.ToString();

                    RecognitionEngine.Dispose();
//Dispose();</recognizecompletedeventargs>
Posted
Updated 27-Oct-13 19:47pm
v2
Comments
Sampath Lokuge 28-Oct-13 3:08am    
Check this link : http://stackoverflow.com/questions/5946601/convert-audio-file-to-text-using-system-speech
Bernhard Hiller 28-Oct-13 4:39am    
"some words are correct and some are not correct" - that's what you have to expect! Speech recognition hardly ever achives 100% accuracy. Even with native speakers, a small error rate is common.

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