School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!
You're Browsing As A Guest! Register Now...
Become an Expert!

Join 358,488 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 2,184 people online right now.Registration is fast and FREE... Join Now!



Visual basic 6.0 Speech Recognition

52 Weeks of Code Challenge: Android

Week #11 of the 52 Weeks of Code Challenge is Android, you should give it a shot. Click Here!

Visual basic 6.0 Speech Recognition how to make a simple speech program using vb 6.0 Rate Topic: -----

#1 gdhamz  Icon User is offline

  • New D.I.C Head
  • Pip

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 05-February 09


Dream Kudos: 0

Posted 05 February 2009 - 08:02 PM

hi all,
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 ** :code:
Was This Post Helpful? 0
  • +
  • -


#2 N34r  Icon User is offline

  • New D.I.C Head
  • Pip

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 22-February 09


Dream Kudos: 0

Re: Visual basic 6.0 Speech Recognition

Posted 23 February 2009 - 06:05 PM

Hi i'm trying something similar, add me or mail me to <email removed>

Moderator Note: Removed email address.
- Core

Was This Post Helpful? 0
  • +
  • -

#3 Core  Icon User is offline

  • Jasper
  • Icon

Reputation: 316
  • View blog
  • Posts: 3,692
  • Joined: 08-December 08


Dream Kudos: 1000

Expert In: .NET Framework

Re: Visual basic 6.0 Speech Recognition

Posted 23 February 2009 - 06:11 PM

Moved to VB6. :)
Was This Post Helpful? 0
  • +
  • -



Fast Reply

  

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users



Live Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month