Click to See Complete Forum and Search --> : Microsoft .NET Speech SDK Beta 2 ! How much u know?
maychia
Jan 28th, 2003, 11:15 AM
I am downloading the Microsoft .NET Speech SDK Beta 2.
Can this speech engine develop .NET window application?
I read on the documentation, it just say to develop a
speech web application..but never mention about window
application.
anyone of you know about .NET Speech?
;)
347Studboy
Apr 20th, 2003, 12:07 AM
Hello all! I'm glad I found this topic so fast... I need help with Speech recognition as well. See, I want to figure out how to use the sample coding in the SDK, but they were all programmed in VB6, and I can't open the projects because I don't have VB.Net Proffesional. So, all I need to know is where I can get information on using the voice recognition events in VB.Net... or however you use Speech Recognition to control applicaitons.
Pirate
Apr 20th, 2003, 07:15 AM
You maybe have a look at these links(two examples at the bottom) http://www.c-sharpcorner.com/SpeechNet.asp
http://www.speechstudio.com/suite.htm
347Studboy
Apr 20th, 2003, 09:17 AM
Thanks a bunch! I appreciate the help.
Pirate
Apr 20th, 2003, 09:19 AM
Sure ! much more stuff if you just google the net !;)
347Studboy
Apr 20th, 2003, 10:13 AM
Okay... so I found the kind of code I've been looking for! Go Here (http://www.eggheadcafe.com/articles/20011124.asp) to see the page. Unfortunately, whenever I try to use the code, I get an error... I think the "Set" function works differently in VB.Net, but I'm not sure how to use it. Any ideas?
Pirate
Apr 20th, 2003, 10:17 AM
No more Set keywords in VB.NET . Can you post the code that uses Set keyword ?
347Studboy
Apr 20th, 2003, 10:22 AM
'To use the Text to Speech interface, we would use the following code:
Dim Voice As SpVoice
Set Voice = New SpVoice
Voice.Speak "Howdy!" ,SVSFlagsAsync
'I don't think it could get much easier!
'And to use the Speech Recognition classes, we would do the following:
Dim WithEvents RecoContext As SpSharedRecoContext
Dim Grammar As ISpeechRecoGrammar
Set RecoContext = New SpSharedRecoContext
Set Grammar = RecoContext.CreateGrammar(1)
Grammar.DictationLoad
Grammar.DictationSetState SGDSActive
' the following is the event handler for the recognition event...
Private Sub RecoContext_Recognition(ByVal StreamNumber As Long, _
ByVal StreamPosition As Variant, _
ByVal RecognitionType As SpeechRecognitionType, _
ByVal Result As ISpeechRecoResult _
)
Dim strText As String
' put strText in a TextBox, or whatever..
strText = Result.PhraseInfo.GetText.
End Sub
I tried to use this code, but like you confirmed for me, "Set" is no longer used in VB.Net.
Pirate
Apr 20th, 2003, 10:26 AM
Try this now ...
'To use the Text to Speech interface, we would use the following code:
Dim Voice As SpVoice
Voice = New SpVoice
Voice.Speak "Howdy!" ,SVSFlagsAsync
'I don't think it could get much easier!
'And to use the Speech Recognition classes, we would do the following:
Dim WithEvents RecoContext As SpSharedRecoContext
Dim Grammar As ISpeechRecoGrammar
Dim RecoContext = New SpSharedRecoContext
Grammar = RecoContext.CreateGrammar(1)
Grammar.DictationLoad
Grammar.DictationSetState SGDSActive
' the following is the event handler for the recognition event...
Private Sub RecoContext_Recognition(ByVal StreamNumber As Long, _
ByVal StreamPosition As Variant, _
ByVal RecognitionType As SpeechRecognitionType, _
ByVal Result As ISpeechRecoResult _
)
Dim strText As String
' put strText in a TextBox, or whatever..
strText = Result.PhraseInfo.GetText.
End Sub
347Studboy
Apr 20th, 2003, 10:35 AM
It's still not working... when I do this:
Voice = New SpVoice
It's telling me "Declaration expected" for the Voice variable. O_0
EDIT: Why is the font so small? Well, that coding, in case you can't read it, says "Voice = New SpVoice".
DOUBLE EDIT: Nevermind, I think I found the problem with the font. Still need help with the code.
Pirate
Apr 20th, 2003, 10:38 AM
Are you getting the Intelle..(the dropdown menu) showing SpVoice object . Did you make reference ? Try without new It may work !
347Studboy
Apr 20th, 2003, 10:41 AM
I did try without the New thing, and I did get the menu when I typed Voice.(menu pops up here). But unfortunately... even though the syntax is correct, when I actually run the program, I get an error.
An unhandled exception of type 'System.NullReferenceException' occurred in SpeechJazz.exe
Additional information: Object reference not set to an instance of an object.
That's what the error says.
Pirate
Apr 20th, 2003, 10:55 AM
What the hell is "SpeechJazz.exe " ? Is it your proj name ? Where did you get this VB6 example I might convert it on my machine ?
347Studboy
Apr 20th, 2003, 10:57 AM
SpeechJazz is my project name. You can find the page with this example here (http://www.eggheadcafe.com/articles/20011124.asp).
Pirate
Apr 20th, 2003, 11:37 AM
I built that VB6 , but with automation ugly errors . Did you get it WORKING well in VB6 ?If so , can you send it to me hopefully I can tweak something to VB.NET proj . !
347Studboy
Apr 20th, 2003, 01:59 PM
No, I don't even have VB6... so I can't help you there. That's my main problem; most sites offer help with VB6 or C++, not VB.Net. *Sigh*... Oh well.
347Studboy
Apr 22nd, 2003, 11:58 PM
Well, I did it. I got my coding to work! I haven't had too much time to play around with it, but here it is, just the same:
Public Class Form1
Inherits System.Windows.Forms.Form
'Declaring variables and stuff
Dim MyVoice As New SpeechLib.SpVoice()
Dim WithEvents RecoContext As New SpeechLib.SpSharedRecoContext()
Dim Grammar As SpeechLib.ISpeechRecoGrammar()
'The "Windows Form Designer generated code" goes here....
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'Error handling... I always use it! ;)
On Error GoTo errPro
'Making the voice say whatever is in the text box
MyVoice.Speak(TextBox1.Text, SpeechLib.SpeechVoiceSpeakFlags.SVSFlagsAsync)
GoTo Done
errPro:
If MsgBox(Err.Description, MsgBoxStyle.OKCancel) = MsgBoxResult.Cancel Then Me.Close()
Done:
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'This was the only place I could think to start the recognition; it wasn't working in General Declarations for some reason....
RecoContext.CreateGrammar(1).DictationSetState(SpeechLib.SpeechRuleState.SGDSActive)
End Sub
Private Sub RecoContext_Recognition(ByVal StreamNumber As Integer, ByVal StreamPosition As Object, ByVal RecognitionType As SpeechLib.SpeechRecognitionType, ByVal Result As SpeechLib.ISpeechRecoResult) Handles RecoContext.Recognition
On Error GoTo errPro
'Here it recognized something I said... so it displays the phrase it recognized with the Label1 control.
Label1.Text = Result.PhraseInfo.GetText
'Now, here's where I make the program do stuff by commanding it with my voice:
Select Case LCase(Result.PhraseInfo.GetText)
Case "mary, exit" : Me.Close()
End Select
'...Well, I haven't gotten much done yet... :P
GoTo Done
errPro:
If MsgBox(Err.Description, MsgBoxStyle.OKCancel) = MsgBoxResult.Cancel Then Me.Close()
Done:
End Sub
Private Sub Label1_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Label1.TextChanged
'Just positioning the Label... no biggy.
Label1.Left = (Me.Size.Width - Label1.Text.Length) / 2
End Sub
End Class
Try it out! It's fun! Because frankly, with this and the ability to remotely control other Applications, I do sincerely believe that I can take total control over Windows itself with the sound of my voice.
Pirate
Apr 24th, 2003, 12:47 PM
Glad you got it working :) . I'm not at my Dev PC , so I'll try it out later...;)
347Studboy
Apr 24th, 2003, 10:37 PM
Yeah, it's pretty great. *Sigh*... I've started an application that runs alongside AIM, and types into the message window whatever I say. There are also special commands for things like sending messages. It works okay so far, but it would be better if the recognition was a little more accurate.
Pirate
Apr 25th, 2003, 05:29 PM
That's a lot of fun , interesting ! Well , MS are developing this new tech rapidly . We never thought to have a speaking or understanding progams in the past , but now it's quite easy job . :)
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.