Not a Member Yet,
Click here to Register
How do you like the new design?






ID: 397
Viewed: 3339
Added: Aug 19, 2002
Version:
Snippet uploaded by: snippet
Written By: Unknown
Demo: Sorry, no demo



User Rated at: 5 Stars5 Stars5 Stars5 Stars5 Stars
Rate This:

Thank you for your vote. Please wait...

It appears you already voted for this snippet

It appears your vote value was empty

I can start you off with an easy example if you like. Add a TextBox and a Microsfot Direct Text-To-Speech control (from the components list) and insert the following code into it.

Highlight all by clicking in box
<!---Declaration--->
Options Explicit
Dim DirectSR1 As New DirectSR
Dim DirectSS1 As New DirectSS

Highlight All
<!---Code--->
DirectSS1.Speak Text1.Text

'The engine will speak whatever is in Text1.
DirectSS1.Speak Text1.Text

'The engine will speak whatever is in Text1.


'*******************************************************************************

'This next example will "hear" you and respond to you 'depending on what you say. Add a Text-to-Speech and Direct 'Recognition control and insert the following code into it.

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)
If Phrase = "hello" Then DirectSS1.Speak "Hello to you too"
If Phrase = "goodbye" Then DirectSS1.Speak "See you later"
End Sub

Private Sub Form_Load()
' The following are words that the Engine will reconize
DirectSR1.GrammarFromString "[Grammar]" + vbNewLine + _
"type=cfg" + vbNewLine + _
"[]" + vbNewLine + _
"=goodbye" + vbNewLine + _
"=hello" + vbNewLine
DirectSR1.Activate
End Sub
'----------------------------------------------
'If you say hello or goodbye your computer should respond.

'*****************************************************
' might work
'this might work. its api and uses microsofts dll's and 'stuff.

'i dont know if you need all of this i have to get off soon so i dont have time to go threw.
Private Declare Function mciGetErrorString Lib "winmm.dll" Alias "mciGetErrorStringA" (ByVal dwError As Long, ByVal lpstrBuffer As String, ByVal uLength As Long) As Long
Private Declare Function GetShortPathName Lib "kernel32" Alias "GetShortPathNameA" (ByVal lpszLongPath As String, ByVal lpszShortPath As String, ByVal cchBuffer As Long) As Long
Private Declare Function mciSendString Lib "winmm.dll" Alias "mciSendStringA" (ByVal lpstrCommand As String, ByVal lpstrReturnString As String, ByVal uReturnLength As Long, ByVal hwndCallback As Long) As Long
Private TheFileName As String, RecordMode As Boolean, dwreturn(1 To 4) As Long
Private ret As String * 128, OpenFile As Boolean, playingfile As Boolean

Private Function IsItPlaying() As Boolean 'See the read me file
Static yn As String * 30
dwreturn(1) = mciSendString("status mpeg mode", yn, Len(yn), 0)
If dwreturn(1) <> 0 Then
MCIError dwreturn(1)
Exit Function
End If
IsItPlaying = (Mid$(yn, 1, 7) = "playing")
End Function

'http://www.microsoft.com/speech/;


No Comments to show

Please completely fill out the form below if you want to review this snippet. All reviews are subject to validation.


Replying to a Comment...


Adding your comment. Please wait...

Thanks for adding your comment!. After further review it will be added.

There was a problem adding your comment. Please try again.

Please complete all the fields in the form before sending.

© 2002 - 2017 snippetlibrary.com All Rights Reserved. Conditions