greetings!
i am a newbie in visual basic 6.0
i am planning to do my research and its speech recognition
i had search this codes for quite some time but i really dont know how to make this.
this are the codes and i really want to know about this things.but unfortunately im so newbie.i had sapi 5.1 installed in my pc,windows xp and VB6. please help me understand this code and help me make my form out of this code.thank you so much.Gobless U!
Option Explicit Dim WithEvents RecoContext As SpSharedRecoContext Dim Grammar As ISpeechRecoGrammar Dim Voice As SpVoice Dim m_bRecoRunning As Boolean Dim m_cChars As Integer Private Sub Form_Load() SetState False m_cChars = 0 Set Voice = New SpVoice Timer1.Enabled = True End Sub Private Sub btnStart_Click() Debug.Assert Not m_bRecoRunning ' Initialize recognition context object and grammar object, then ' start dictation If (RecoContext Is Nothing) Then Debug.Print "Initializing SAPI reco context object..." Set RecoContext = New SpSharedRecoContext Set Grammar = RecoContext.CreateGrammar(1) Grammar.Dictationload End If Grammar.DictationSetState SGDSActive SetState True End Sub Private Sub btnStop_Click() Debug.Assert m_bRecoRunning Grammar.DictationSetState SGDSInactive SetState False End Sub ' This function handles Recognition event from the reco context object. ' Recognition event is fired when the speech recognition engines recognizes ' a sequences of words. Private Sub RecoContext_Recognition(ByVal StreamNumber As Long, _ ByVal StreamPosition As Variant, _ ByVal RecognitionType As SpeechRecognitionType, _ ByVal Result As ISpeechRecoResult _ ) Dim strText As String strText = Result.PhraseInfo.GetText Debug.Print "Recognition: " & strText & ", " & _ StreamNumber & ", " & StreamPosition ' Append the new text to the text box, and add a space at the end of the ' text so that it looks better txtSpeech.SelStart = m_cChars txtSpeech.SelText = strText & " " m_cChars = m_cChars + 1 + Len(strText) Debug.Assert m_bRecoRunning Grammar.DictationSetState SGDSInactive SetState False Voice.Speak strText txtSpeech.Text = "" Debug.Print "Initializing SAPI reco context object..." Set RecoContext = New SpSharedRecoContext Set Grammar = RecoContext.CreateGrammar(1) Grammar.Dictationload Grammar.DictationSetState SGDSActive SetState True End Sub ' This function handles the state of Start and Stop buttons according to ' whether dictation is running. Private Sub SetState(ByVal bNewState As Boolean) m_bRecoRunning = bNewState btnStart.Enabled = Not m_bRecoRunning btnStop.Enabled = m_bRecoRunning End Sub
** Edit **

Start a new topic
Add Reply





MultiQuote
| 


