|
-
Jan 28th, 2003, 12:15 PM
#1
Thread Starter
Junior Member
Microsoft .NET Speech SDK Beta 2 ! How much u know?
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?
-
Apr 20th, 2003, 12:07 AM
#2
Junior Member
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.
-
Apr 20th, 2003, 07:15 AM
#3
Sleep mode
-
Apr 20th, 2003, 09:17 AM
#4
Junior Member
Thanks a bunch! I appreciate the help.
-
Apr 20th, 2003, 09:19 AM
#5
Sleep mode
Sure ! much more stuff if you just google the net !
-
Apr 20th, 2003, 10:13 AM
#6
Junior Member
Okay... so I found the kind of code I've been looking for! Go Here 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?
-
Apr 20th, 2003, 10:17 AM
#7
Sleep mode
No more Set keywords in VB.NET . Can you post the code that uses Set keyword ?
-
Apr 20th, 2003, 10:22 AM
#8
Junior Member
VB Code:
'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.
Last edited by 347Studboy; Apr 20th, 2003 at 10:32 AM.
-
Apr 20th, 2003, 10:26 AM
#9
Sleep mode
Try this now ...
VB Code:
'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
-
Apr 20th, 2003, 10:35 AM
#10
Junior Member
It's still not working... when I do this:
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.
Last edited by 347Studboy; Apr 20th, 2003 at 10:38 AM.
-
Apr 20th, 2003, 10:38 AM
#11
Sleep mode
Are you getting the Intelle..(the dropdown menu) showing SpVoice object . Did you make reference ? Try without new It may work !
-
Apr 20th, 2003, 10:41 AM
#12
Junior Member
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.
-
Apr 20th, 2003, 10:55 AM
#13
Sleep mode
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 ?
-
Apr 20th, 2003, 10:57 AM
#14
Junior Member
SpeechJazz is my project name. You can find the page with this example here.
-
Apr 20th, 2003, 11:37 AM
#15
Sleep mode
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 . !
-
Apr 20th, 2003, 01:59 PM
#16
Junior Member
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.
-
Apr 22nd, 2003, 11:58 PM
#17
Junior Member
YAY!
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:
VB Code:
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.
-
Apr 24th, 2003, 12:47 PM
#18
-
Apr 24th, 2003, 10:37 PM
#19
Junior Member
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.
-
Apr 25th, 2003, 05:29 PM
#20
Sleep mode
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 .
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|