Hi:
Well. I hope this could be useful for you, I found the answer by myself.
I've three links which explain several points about voice recognition
Here you are
vbspeech.zip
http://www.codeguru.com/vb/gen/vb_misc/plugins/print.php/c11223/#more
Writing_Your_First_Speech_Recognition_Program
and finally this short text about some dificulties which we could have trying to use the Voice recognition
In order to make the program running, u all must install the full
speech api sdk which is about 40MB. It can be downloadable from microsoft
site and the filename is something like "sapisdk4suite". After the
installation, u MUST GO TO MICROPHONE SETUP WIZARD (microsoft voice) to get
the microphone configuration.
If u do not configure the microphone, the system can't get your voice.
Another issues is the grammar setting is quite different from what
given in microsoft site. Here are the coding that i get from microsoft
site:
Private Sub DirectSR1_PhraseFinish(ByVal flags As Long, ByVal beginhi
As Long, ByVal beginlo As Long, ByVal endhi
As Long, ByVal endlo As Long, ByVal Phrase As String, ByVal parsed As
String, ByVal results As Long)
Text1.Text = Phrase
End Sub
Private Sub Form_Load()
DirectSR1.GrammarFromString "[Grammar]" + vbNewLine + _
"type=cfg" + vbNewLine + _
"[]" + vbNewLine + _
"=red" + vbNewLine + _
"=blue" + vbNewLine + _
"=green" + vbNewLine
DirectSR1.Activate
End Sub
************************
One line, add it right after you .activate the thing
DirectSR1.AboutDlg hWnd, "test"
I have also installed the newest FULL version of the sdk from the
microsoft site, and my grammar format looks like:
DirectSR1.GrammarFromString "[Grammar]" & vbCrLf & _
"langid = 1033" & vbCrLf & _
"type=cfg" & vbCrLf & _
"[]" & vbCrLf & _
"=Select All" & vbCrLf & _
"=Select Yes" & vbCrLf & _
"=Select No" & vbCrLf
My guess as to why the about box makes it work is that MS wants some
recognition for their free technology.
*********************
posts: 6252
since: Jan 25, 2002
from: Greenville, SC If you use them, make sure you don't distribute
them. Users have to download from MS. You also have to put the MS logo
about the characters on your webpage or software box etc. Have to have
MS's copywrite somewhere on it also.
*****************************
Dim Animation As Variant
For Each Animation In Agent1.Characters("Merlin").AnimationNames
List1.AddItem Animation
Next
**************************
Recognize and Talk Back
by leo de velez([email protected])Saturday, November 17, 2001
[Click here to return to the article.] [Edit] [Delete]
Option Explicit
Private Declare Function ShellExecute Lib "shell32.dll" _
Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal _
lpOperation As String, ByVal lpFile As String, ByVal _
lpParameters As String, ByVal lpDirectory As String, _
ByVal nShowCmd As Long) As Long
Private Sub Command1_Click()
Select Case Command1.Caption
Case "Disable"
DirectSR1.Deactivate
Command1.Caption = "Enable"
Label1 = "Disabled"
Case "Enable"
DirectSR1.Activate
Command1.Caption = "Disable"
Label1 = "Ready"
End Select
End Sub
Private Sub DirectSR1_PhraseFinish(ByVal flags As Long, ByVal beginhi
As Long, ByVal beginlo As Long, ByVal endhi As Long, ByVal endlo As
Long, ByVal Phrase As String, ByVal parsed As String, ByVal results As
Long)
Dim sFile As String
Dim noth As Long
If Phrase <> "" Then
Label1.Caption = "Matched word is " & Phrase
DirectSS1.Speak "You said" & Phrase
Else
Label1.Caption = "No word matched"
End If
Select Case Phrase
Case "Notepad"
sFile = "c:\windows\notepad.exe"
noth = ShellExecute(0, "OPEN", _
Environ("SystemRoot") & sFile, "", "", 1)
Case "Media Player:"
sFile = "C:\Program Files\Windows Media Player\mplayer2.exe"
noth = ShellExecute(0, "OPEN", _
sFile, "", "", 1)
Case "Hi"
DirectSS1.Speak "Hello"
Case "Hello"
DirectSS1.Speak "Hi, how are you?"
Case "Thank you"
DirectSS1.Speak "You are welcome"
Case "How are you"
DirectSS1.Speak "Im fine, thank you"
End Select
End Sub
Private Sub Form_Load()
Dim totaldata As String
totaldata = "[Grammar]" & vbCrLf & _
"langid = 1033" & vbCrLf & _
"type=cfg" & vbCrLf & _
"[]" & vbCrLf & _ 'Insert LESS THAN and GREATER THAN signs and also
Insert START between "[ ]" and Remove this comment
"=Hi" & vbCrLf & _ 'Insert LESS THAN and GREATER THAN signs and also
Insert START before the EQUAL SIGN " =" and Remove this comment. Do the
same below
"=Notepad" & vbCrLf & _
"=Media Player" & vbCrLf & _
"=Thank you" & vbCrLf & _
"=How are you" & vbCrLf & _
"=Hello" & vbCrLf
DirectSR1.GrammarFromString (totaldata)
DirectSR1.AboutDlg hwnd, "test"
End Sub
Enter your message below
Sign in or Join us (it's free).