Click here to Skip to main content
15,889,909 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
Hello. Is there a way to convert my speech to text? I already know how to do text to speech but it would be great if I could just speak and the computer automatically turned my speech into text on the screen. For the moment I just want it to turn my speech into text in a Message Box in Visual Studio.
Posted
Updated 16-Jul-15 23:14pm
v2
Comments
[no name] 17-Jul-15 6:00am    
Since you have already written code that attempts to do this, your question is pointless.

 
Share this answer
 
 
Share this answer
 
Try this One Convert audio file to text:-

C#
Using System.Speech

public class MyRecognizer {
    public string ReadAudio() {
        SpeechRecognitionEngine sre = new SpeechRecognitionEngine();
        Grammar gr = new DictationGrammar();
        sre.LoadGrammar(gr);
        sre.SetInputToWaveFile("C:User\\Audio.wav");
        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();
     }
}
 
Share this answer
 

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