I am trying to use speech recognition in .net to recognize podcast speech in an mp3 file and get the result as a string. All the examples that I saw related to the use of a microphone, but I do not want to use a microphone and provide a sample mp3 file as a sound source. Can someone point me to some resource or send an example.
EDIT -
I converted the audio file to a wav file and tried this code on it. But it only extracts the first 68 words.
public class MyRecognizer { public string ReadAudio() { SpeechRecognitionEngine sre = new SpeechRecognitionEngine(); Grammar gr = new DictationGrammar(); sre.LoadGrammar(gr); sre.SetInputToWaveFile("C:\\Users\\Soham Dasgupta\\Downloads\\Podcasts\\Engadget_Podcast_353.wav"); sre.BabbleTimeout = new TimeSpan(Int32.MaxValue); sre.InitialSilenceTimeout = new TimeSpan(Int32.MaxValue); sre.EndSilenceTimeout = new TimeSpan(100000000); sre.EndSilenceTimeoutAmbiguous = new TimeSpan(100000000); RecognitionResult result = sre.Recognize(new TimeSpan(Int32.MaxValue)); return result.Text; } }
Soham dasgupta
source share