So I'm trying out SAPI 5.3 in Vista and I was trying to write something simple to start out with. I get the synthesizer working to where it speaks, but now i'm trying to get the recognizer working so I can get what people say. I'd like to get the text result of their speech, meaning the 1st and most likely recognized candidate. Now I'm having problem getting the sub event handler to work.
It keeps saying this for Public Sub GotSpeech.Code:Imports System.Speech Public Class Form1 Public synth As New Speech.Synthesis.SpeechSynthesizer Public recognizer As New Speech.Recognition.SpeechRecognitionEngine Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click synth.Speak("This is a test.") End Sub Public Sub GotSpeech(ByVal phrase As System.Speech.Recognition.SpeechRecognizedEventArgs) Handles recognizer.SpeechRecognized words.Text += phrase.Result.Text & "\n" End Sub End Class
I'm not really sure what it wants from me with the "WithEvents" variable.Code:Error 1 Handles clause requires a WithEvents variable defined in the containing type or one of its base types.




Reply With Quote