Currently I am working on a project which can recognize the speech in a wave file. I am using SpeechRecognitionEngine class in Framework 3.5. I want to display each word which in said in wave file (something like we see in movies where every sentences spoken is display in text below). Wave file could be a voice of a person or a song. When I try to using Recognize function it only display first 4-5 words from the wave file and they are totally wrong, and have confidence level 0.004. When I try to do it asynchronously (RecognizeAsync function) then speech is not detected at all. I have also tried SAPI 5.3 but I get wrong result.
Below is my code
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim rec As New Speech.Recognition.SpeechRecognitionEngine
Dim fs As New FileStream("C:\Test.wav", FileMode.Open, FileAccess.Read)
rec.SetInputToWaveStream(fs)
rec.LoadGrammar(New DictationGrammar)
AddHandler rec.SpeechRecognized, AddressOf SpeechRecognized_Click
AddHandler rec.RecognizeCompleted, AddressOf RecognizedComplete_Click
rec.RecognizeAsync(RecognizeMode.Multiple)
End Sub
Private Sub SpeechRecognized_Click(ByVal sender As Object, ByVal e As SpeechRecognizedEventArgs)
Dim result As RecognitionResult = e.Result
RichTextBox1.AppendText(result.Text)
End Sub
Private Sub RecognizedComplete_Click(ByVal sender As Object, ByVal e As RecognizeCompletedEventArgs)
Dim result As RecognitionResult = e.Result
MsgBox(result.Text)
End Sub
Below link contains the voice file which contains wave file which I am giving as input.
http://gauravkhanna.blog.co.in/files/2009/04/voicedemo.zip - http://gauravkhanna.blog.co.in/files/2009/04/voicedemo.zip