הערה
הגישה לדף זה מחייבת הרשאה. באפשרותך לנסות להיכנס או לשנות מדריכי כתובות.
הגישה לדף זה מחייבת הרשאה. באפשרותך לנסות לשנות מדריכי כתובות.
Question
Sunday, August 9, 2009 9:49 PM
i would like to be able to type a complete word, and if that word is in my list of sound wav's, then to play that wav..
basically, i need it to find the space before the word and the space after, so when i press the spacebar, it will only try to locate the last word in between those spaces, and if the word is tru , then it would say tru , if i type in tru jade, it would say tru . . then say jade .
also, if possible, to pick up the first typed word also, which would not contain the space before it..
thanx in advance..
also, if anyone knows how to get my app to recognize my voice after i name it pookie ,
so when i say " pookie, load vb ", it would say, " sure tru jade, you are the best, of course i wil l " and shut down my p.c. lol..
the loading of the app should not be a problem for me.
just getting my app to listen for pookie, and a command..
links are also welcomed to other good pookie sites..
hope this helps out with new projects as well..
thanx,
trujade..(press the submit button pookie!.. pookie?.. )
===========================================
the following was added to question post after question was answered:
===========================================
**
EDIT:: to use the code for voice recognition posted by Kenneth Haugland without getting the errors/warnings, please read the answer by jinzai , on how to add this reference for System.Speech** ..
i like**:** VB General google fast cars username password
All replies (47)
Tuesday, August 11, 2009 4:47 PM ✅Answered | 4 votes
Well, I can't help with the Voice Recognition, but I can show you how to find a word in text. This was a lot more complicated in VB6.0 and earlier, but .Net has made this a fairly straight forward process.
The code below requiers a TextBox, a ListBox, and a Button. Just copy the code into a project run it and click the button to watch what happens. I also provided another less eligent solution, that you might like. It's closer to what we had to do in VB 6.0. :)
Hope this helps
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
TextBox1.Text = "Hello, Tru Jade. How are you doing today?"
End Sub
Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
'You can use the String.Split function to split a string by any character
'The function returns an array of strings
'Define a string array to hold the words retrurned by the split function
Dim Words As String() = TextBox1.Text.Split(" ")
'Just to show you that it works I'll display them in a list box
For Each word In Words
ListBox1.Items.Add(word)
Next
'' Or you could use the Substring function to return the word, be aware though you will need to remove it from
'' the input string in order to continue the parsing by single words
'' *** Just Comment out the above and uncomment the code below and run the project again
'Dim word As String = TextBox1.Text.Substring(0, TextBox1.Text.IndexOf(" "))
'While word IsNot ""
' ListBox1.Items.Add(word)
' If TextBox1.Text <> "" Then
' TextBox1.Text = TextBox1.Text.Substring(word.Length + 1) 'split occurs before the space
' If TextBox1.Text.IndexOf(" ") > 0 Then
' word = TextBox1.Text.Substring(0, TextBox1.Text.IndexOf(" "))
' Else
' ListBox1.Items.Add(TextBox1.Text)
' TextBox1.Text = ""
' word = ""
' End If
' End If
'End While
End Sub
End Class
Programming is easy, understanding how is not.
Tuesday, August 11, 2009 5:56 PM ✅Answered | 1 vote
No problem, I'm always willing to teach a noob. I havn't forgotten that not too long ago I was one too. :)
For this example you only need a textbox and a button. Type what ever you want in the text box and click the button, I wouldn't make it too long or else you'll be clicking for a long time. :)
If the program recoginizes one of your words, then it will display it in a Message Box if not it will Announce it as an Unknown Word.
Try any cassing you want it won't matter if the spelling is the same then the word will be recognized. Also, be aware that you will need to either include punctuation characters in the case, or remove them before the select is processed.
Hope this helps! :)
Public Class Form1
Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
'You can use the String.Split function to split a string by any character
'The function returns an array of strings
'Define a string array to hold the words retrurned by the split function
Dim Words As String() = TextBox1.Text.Split(" ")
'Loop through the words in the string processing each one.
For Each word In Words
word = word.ToLower 'or you could use ToUpper for Upper case
'This line is where you tell the code what variable you want to
'select the condition of
Select Case word
'Each case inside the Select Structure will be checked against the case variable
'You need to use the correct type here, so if case variable is a string then use a string, etc...
'You can use anything inside of a case that you would and If...Then statement.
Case "hello" 'lower case because we converted it to all lower case
MessageBox.Show("Hello")
Case "tru"
MessageBox.Show("Tru")
Case "jade"
MessageBox.Show("Jade")
Case Else 'this is the default, if none of the other cases work then this case will be executed
MessageBox.Show("Unknown Word")
End Select
Next
End Sub
End Class
Programming is easy, understanding how is not.
Tuesday, August 11, 2009 11:53 PM ✅Answered | 1 vote
Ok a little more complicated than I though:
Translated code from above:
(Need to add some references to make this work on XP)
Imports System.Speech.Recognition
Imports System.Speech.Recognition.SrgsGrammar
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Label1.Text = "Application started"
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'A simple message when the user speaks "Button click"
MessageBox.Show("You clicked me!")
End Sub
Public Sub New()
' This call is required by the Windows Form Designer.
InitializeComponent()
' Add any initialization after the InitializeComponent() call.
Dim recognizer As New SpeechRecognizer()
'this event is raised when the user begins to speak
AddHandler recognizer.SpeechDetected, AddressOf recognizer_SpeechDetected
'this is raised when spoken words are not recognized as compliant to our grammar rules
AddHandler recognizer.SpeechRecognitionRejected, AddressOf recognizer_SpeechRecognitionRejected
'this is raised when the application correctly recognizes spoken words
AddHandler recognizer.SpeechRecognized, AddressOf recognizer_SpeechRecognized
'A new custom grammar. According to our new grammar, only the following combinations are allowed:
'"Button click" "Button close" "Application click" and "Application close" but we'll implement
'a speech control later, to enable just "Button click" and "application close".
'The rule is that each choice in the first Append method can be combined with each word specified
'in the second method.
Dim grammar As New GrammarBuilder()
grammar.Append(New Choices("Button", "Application"))
grammar.Append(New Choices("click", "close"))
'A grammar must be loaded into the engine. This is possible by loading an object or an xml file
recognizer.LoadGrammar(New Grammar(grammar))
End Sub
Private Sub recognizer_SpeechDetected(ByVal sender As Object, ByVal e As SpeechDetectedEventArgs)
Label1.Text = "Speech engine has detected that you spoke something"
End Sub
Private Sub recognizer_SpeechRecognitionRejected(ByVal sender As Object, ByVal e As SpeechRecognitionRejectedEventArgs)
MessageBox.Show("Sorry but the " & e.Result.Text & " phrase could not be recognized")
End Sub
Private Sub recognizer_SpeechRecognized(ByVal sender As Object, ByVal e As SpeechRecognizedEventArgs)
Select Case e.Result.Text.ToUpper
Case Is = "BUTTON CLICK"
'this can programmatically raise a Click event onto a button
Button1_Click(Me, Nothing)
'Dim peer As New ButtonAutomationPeer(Button1)
'Dim invokeProv As IInvokeProvider = peer.GetPattern(PatternInterface.Invoke)
'invokeProv.Invoke()
Case Is = "APPLICATION CLOSE"
Me.Close()
Case Else
MessageBox.Show("The phrase " & e.Result.Text & " contains valid words but doesn't match valid results")
End Select
End Sub
Private Sub Form1_FormClosing(ByVal sender As System.Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles MyBase.FormClosing
MessageBox.Show("Application is shutting down")
End Sub
End Class
I dont have a microphone on my computer so somebody else is goning to test it... Hope it helps:)
Kenneth
Wednesday, August 12, 2009 7:35 PM ✅Answered | 1 vote
I knew I would regret sleeping when I had found another Easter Egg for you, trujade.
You have to add that reference using project properties...references...the .NET tab...Microsoft Speech 5.3 or something similar. (My work machine is XP, and SAPI is apparently not installed on it. Stupid company rules!)
I was going to surprise you tonight with it, although I don't remember the locale to give the voice (Anna) an English accent. I'll post s short snippet for the speech part in a few hours...I haven't messed with the recognition yet, but...they are both in the same namespace... System.Speech
Thursday, August 13, 2009 12:30 PM ✅Answered | 1 vote
trujade,
Glad to hear that pookie is alive, remindes me of the old Short Circuit movies. :) Some of my favorites, those.
Anyway, I accidently clicked on Propose as Answer, so if you would kindly unpropose it that would be good. :)
You can get pookie to say anything you wan't by using the SpeechSynthesizer in the Speech namespace. ( I fooled around with it yesterday out of curiosity, :) ) All that is needed is to add a TextBox, and a Button to a form, in code you will need to create a SpeechSynthesizer object and call the speek method something like this:
Imports System.Speech.Synthesis
Public Class Form1
Dim pookie As New SpeechSynthesizer()
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
pookie.Speak(TextBox1.Text)
End Sub
End Class
I didn't try any slang words but, it will definately say "Hello, how are you today?" Now obviously you can use it in more complex situations but this will show you how simple using the speech namespace can be.
Enjoy!
Programming is easy, understanding how is not.
Sunday, August 9, 2009 11:21 PM
by the way, i am using such code to play the wav files, if it helps.
My.Computer.Audio.Play("C:\Users\trujade\Desktop\wav files\ok.wav", AudioPlayMode.Background)
trujade.
i like**:** VB General google fast cars username password
Monday, August 10, 2009 12:37 AM | 1 vote
Have you looked into the System.Speech namespace ?coding for fun Be a good forum member mark posts that contain the answers to your questions or those that are helpful Please format your code in your posts with the button . Makes it easier to read .
Monday, August 10, 2009 1:58 AM
about the system.speech namespace, that stuff is far too technical for me to understand.. i will keep searching online for links about it, hopefully i will be able to understand it eventually..
thanx.
trujade....
i like**:** VB General google fast cars username password
Tuesday, August 11, 2009 9:35 AM | 1 vote
Have you tried using the ComboBox and its 2 properties AutoCompleteMode and AutoCompleteSource? You can set them so that it will find matching entries as you type (if they exist). These settings for those 2 properties will do what you describe:
ComboBox1 Property settings:
AutoCompleteMode = SuggestAppend
AutoCompleteSource = ListItems
ComboBox1 settings via code:
ComboBox1.AutoCompleteMode = AutoCompleteMode.SuggestAppend
ComboBox1.AutoCompleteSource = AutoCompleteSource.ListItems
Doug
SEARCH ... then ask
Tuesday, August 11, 2009 3:47 PM
@doug ,
if you could create a small project to implement such as you stated, i would gladly appreciate it..
any and all input is of good use.. this is a new project, that has one goal, to get pookie to cuss me out.. (lol), but getting to that goal, the project can change..
otherwise, here is what i have so far for pookie..
Public Class pookie1
Dim pookie As String = ("C:\Users\trujade\Desktop\vb.net\x.pookie\!pookie\")
Dim numbers As String = ("C:\Users\trujade\Desktop\vb.net\x.pookie\numbers\")
Dim sentences As String = ("C:\Users\trujade\Desktop\vb.net\x.pookie\sentences\")
Dim words As String = ("C:\Users\trujade\Desktop\vb.net\x.pookie\words\")
Private Sub TextBox1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown
If e.KeyCode = Keys.Space Then
TextBox2.AppendText(TextBox1.Text)
If TextBox1.Text.Contains("tru") Then
My.Computer.Audio.Play(words & "tru.wav", AudioPlayMode.Background)
ElseIf TextBox1.Text.Contains("jade") Then
My.Computer.Audio.Play(words & "jade.wav", AudioPlayMode.Background)
ElseIf TextBox1.Text.Contains("hello") Then
My.Computer.Audio.Play(words & "hello.wav", AudioPlayMode.Background)
ElseIf TextBox1.Text.Contains("how") Then
My.Computer.Audio.Play(words & "how.wav", AudioPlayMode.Background)
ElseIf TextBox1.Text.Contains("are") Then
My.Computer.Audio.Play(words & "are.wav", AudioPlayMode.Background)
ElseIf TextBox1.Text.Contains("you") Then
My.Computer.Audio.Play(words & "you.wav", AudioPlayMode.Background)
ElseIf TextBox1.Text.Contains("doing") Then
My.Computer.Audio.Play(words & "doing.wav", AudioPlayMode.Background)
ElseIf TextBox1.Text.Contains("today") Then
My.Computer.Audio.Play(words & "today.wav", AudioPlayMode.Background)
Else
My.Computer.Audio.Play(pookie & "unknown data.wav", AudioPlayMode.Background)
Dim x As Integer = -1
x = ListBox1.FindString(TextBox1.Text)
If x > -1 Then
Else
ListBox1.Items.Add(TextBox1.Text) ' add word for pookie to learn
End If
End If
TextBox1.Text = "" ' clear for new data
End If
End Sub
Private Sub cleartext_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cleartext.Click
TextBox1.Text = Nothing
TextBox2.Text = Nothing
End Sub
Private Sub bye_pookie_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bye_pookie.Click
'My.Computer.Audio.Play(pookie & "affirmative.wav", AudioPlayMode.Background)
' System.Threading.Thread.Sleep(1000) ' gives it time to play the wav before pookie1 exits
End
End Sub
Private Sub pookie1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
TextBox1.Select()
My.Computer.Audio.Play(pookie & "computeraccessed.wav", AudioPlayMode.Background)
End Sub
End Class
2 textboxes, when i press the 'space bar' in textbox 1, it checks for a word, then responds either by wav, or adding the word for pookie to learn.
trujade.i like**:** VB General google fast cars username password
Tuesday, August 11, 2009 3:59 PM | 1 vote
I have not use the Speech namespace, but...I have used the TTS API (SAPI), and it is very complete; you can program it with XML files, and also you can simply give it text to speak. The voice recognition portion of that is probably what you are after. (I think that Sync uses something very similar, if not exactly that.)
Anyway, the API can be experimented with using Control Panel, although I still want to know how to make voices for it...that would make it more useful for me.
(I'd rather have Kate Beckinsale do all of the cussing...as opposed to Nurse Chapel, that is.)
Tuesday, August 11, 2009 4:06 PM
jinzai.. lol about kate.. ;o)
do you have any helpful pookie links for me to link to?
i am to much of a noob to understand namespaces, minus well where in code to implement them or even call a command, that is if they have commands..
about the api.. i have never used code in an api, do not know what exactly it is, and how to access it.
xml, can you give an example of how to go about?
do reply for a noob to understand. ;o)
thanx,
trujade.i like**:** VB General google fast cars username password
Tuesday, August 11, 2009 5:17 PM
PEng1 , if i could vote more than one helpful, i would.. ;o)
both codes seems to work amazingly.
thank you.
this should be a good start for reading back the text, going down the listbox, line by line..
i thank you again..
i am going to teach pookie how to thank, by cussing with a thank you.. lol.
should keep the project interesting..
trujade.
i like**:** VB General google fast cars username password
Tuesday, August 11, 2009 5:23 PM | 1 vote
Trujade, thanks for the vote, it's always good to when one of the user appriciates the help. I'm also glad that I could be of some use.
Be aware that the list box is only there for display purposes. In the acctual implementation you wouldn't need it, and you could just use the Words string array going through each index.
Also, to speed up the processing of the commands you might want to consider using a Select Case as opposed to all the IF...Then...ElseIF statements.
Glad I could helpProgramming is easy, understanding how is not.
Tuesday, August 11, 2009 5:35 PM
about the select case, if it speeds up the process, which it should, can you post a sample?
i am new to case/select as well, but it is always good to learn properly, as you have done with your previous post. thanx for the comments.;o)
something as if case is "hello" or case is "Hello" or case is "HELLO" then play hello.wav..
next case, and so on.. just a basic example with a few case lines.. ;o)
thanx for the input on such..
i have a feeling this list will get quite long, so speeding up the response is a necessity.
also, if it is possible to get the text "hello" no matter what the typing is , ex. "HeLLO, heLLo, etc.. ", just to get the word hello ..
i saw in a post somewhere here in vb.general, it is possible to get a word, no matter how it is typed.. just wish i would have saved that thread link.
thanx again PEng1,
trujade..
i like**:** VB General google fast cars username password
Tuesday, August 11, 2009 5:59 PM
PEng1 , if i could vote more than one helpful, i would.. ;o)
both codes seems to work amazingly.
thank you.
I did it for you :)
Doug
SEARCH ... then ask
Tuesday, August 11, 2009 6:05 PM | 1 vote
...I voted for it, too...so there are 3 votes now.
I wrapped the SAPI dll for use in DarkBasic Professional last year. At home, I have a sample application with both XML and raw text files. I will try to get them posted tonight. I wanted a way to make background conversations in video games without having to devote the time to write actual conversations. (I used the "cheese and soda crackers" line at a barely audible level with about 12 voices.)
Namespaces are not at all complicated, they are merely a way of establishing scope...so that a name is unique within a namespace. (That way, you can have foo.bar and candy.bar without conflict. It is similar to a class in that respect...only.)
Tuesday, August 11, 2009 6:17 PM
PEng1 , much better than having it search for differently typed word of the same word.
i can type "tru" as TrU, and it still catches it.. very wow'ed..
do keep your alerts on for this thread (personally, most of my threads have the alerts on). just in case new questions appear, which they should for any proficient application, and/or you might have different suggestions for pookie . ;o)
btw, nice job on the comment lines.
thanx PEng1...
Doug , thanx.
now start helping to wipe pookie's butt and stop wiping mine.. ... lol.. j/k..it was kind of you.
this should get me started on quite a bit, hopefully i will have more questions to add before a moderator marks doug's reply as an answer and not the rest that helped out pookie's cussing..;o)
thanx guys,
trujade.
i like**:** VB General google fast cars username password
Tuesday, August 11, 2009 6:45 PM | 1 vote
Trujade,
I forgot to mention that once a case is found, then the Select Structure is exited. So only one case can be true on each pass.
For a more complex situation where this was used chieck out this thread. I know it is long, but there is a wealth of information in it, especially for some one who is still trying to pick up on OOP concepts. Inside the over 100 some odd posts there is a good example of another use of the select case structure.
Enjoy! :) The code I am talking about is somewhere near half way down.
http://social.msdn.microsoft.com/Forums/en-US/vbgeneral/thread/2ed91ce0-db65-4c76-96b4-4ee5d0f8bd3f
Programming is easy, understanding how is not.
Tuesday, August 11, 2009 7:17 PM
I forgot to mention that once a case is found, then the Select Structure is exited. So only one case can be true on each pass.
this should not have any effect on pookie, since when i typed "hello tru" i got two msgboxes.
i will have to add a sleep code for every wav file, depending on the lenght of the wav, in order to have pookie speak correctly, and not just the last word..
thanx for the info.. ;o)
about that link..
talk about a needle in a haystack..
i think i found it, nope, maybe this one.. lol.. i did find the case stuff, and quite a few other codes i could find use for..
that link is bookmarked..
thanx again PEng1.
trujade.
i like**:** VB General google fast cars username password
Tuesday, August 11, 2009 7:24 PM | 1 vote
this should not have any effect on pookie, since when i typed "hello tru" i got two msgboxes.
That's because the Select Case is nested inside of a For Loop. Other wise you would only get one msgbox.
Yeah, that link got pretty lengthy, but I think it really helped the OP, and will go a long way to helping many others.
Sometimes I think that we users, and I am guilty of this too, are to quick to tell the OP we're not going to write the code for them. I find that giving a well written example goes a lot further to helping than just telling someone to use a certain method and providing a link.
Of course there are cases where a lazy student just wants someone to do the work for them. I try to help the most I can, and If that means that someone takes advantage of me, then that's a risk I'll take. The best way to learn this stuff is to do it, but a well built example never hurts.
Glad I could help.
PEng1
Programming is easy, understanding how is not.
Tuesday, August 11, 2009 7:29 PM
could not agree more about a well built example.
trujade.i like**:** VB General google fast cars username password
Tuesday, August 11, 2009 10:33 PM | 1 vote
I just woke from a horrible nightmare, so I'm still trying to collect myself...wanted to pass along an idea before I forget about it. LOL Trujade, I see where you mentioned something about making your WAV's sleep until they are needed for playing. I thought you might build a list of WAV's needed to "say" what you want, and have the computer "say" them in a process, waiting for each process to finish before playing the next WAV in the list. I haven't tried anything about this idea and at this point, don't know for sure if it would even work, but it should. My mind isn't back to full functionality just yet, but I seem to recall something from Process that is supposed to "wait for exit". Maybe one of the others here will understand what I'm talking about and expound on this...while I "regain composure".
Doug
SEARCH ... then ask
Tuesday, August 11, 2009 11:27 PM | 1 vote
Have you seen this : http://code.msdn.microsoft.com/SpeechRecoDemo/Release/ProjectReleases.aspx?ReleaseId=1511
Might be worth a try:)
Kenneth
Wednesday, August 12, 2009 7:22 PM
I just woke from a horrible nightmare, so I'm still trying to collect myself....
Doug
SEARCH ... then ask
talking about a horrible nightmare, i had to do a full destruct install on my o.s.
i recently d/led a project, which by looking at the code, had nothing to do with creating a virus, so i ran it.
the virus must have been implemented somewhere else in the project, not noticeable..
this virus was trying to copy my projects and god know what else.
i could not save any of my projects/sample projects, or anything else on my system due to not wanting that virus back after i reinstalled and ran a project or anything else i had.. a total complete loss. basically a nightmare..
i am not sure if this virus attached it's self just by loading the project.. i am so _________ p'o'ed right now.. pardon my language. _______ looser that created that virus.
back to the thread...
Kenneth, thanx for the posts.. the first link to the SpeechRecoDemo i was able to load, seems like it will do the job, i just not have yet had time to redo my speech recognition.. it is also based on a wpf application, which i know nothing off.. looks like html to me. ;o) i will post back here once i get this wpf project working and will let you know the results.. thanx. ;o)
the second post, with the code, i found something similar online before this thread, but got the same error for the imports..
Warning 1 Namespace or type specified in the Imports 'System.Speech.Recognition' doesn't contain any public member or cannot be found. Make sure the namespace or the type is defined and contains at least one public member. Make sure the imported element name doesn't use any aliases. C:\Users\trujade\AppData\Local\Temporary Projects\WindowsApplication1\Form1.vb 1 9 WindowsApplication1
and a whole bunch of not defined's.
probably because of the imports.
i figured it was the code, but the imports should import. any suggestions?
thanx again everyone, but it might be a while before i can continue with this project.. (sighs)
good thing pookie cannot get upset, since pookie is gone also.. hopefully not for long.
trujade.
(those underlines i placed there.. ;o)
i like**:** VB General google fast cars username password
Wednesday, August 12, 2009 7:50 PM
jinzai, you are the easter bunny, santa claus, and the thanksgiving turkey.. lol..
do not know what to add, other then a huge thanx ..
the project loads and sends me to speech recognizer, as the wpf project did.. . i just need to run this setup, and will post the results..
btw, for references, it is System.Speech in the .net tab..
(sigh of relief)
hope i'm not getting my hopes up, but it is looking promising..
time to bring pookie back! yay..
thanx,
trujade.
i like**:** VB General google fast cars username password
Wednesday, August 12, 2009 8:34 PM
guys, i do not want to say this out loud, but
pookie has ears!
just ears, nothing else..lol
by using Kenneth's example, i can click on the button using voice. way awesome..
changing the word from application to pookie, prompts the message box, stating that
"the phrase pookie close contains valid words but doesn't match valid results"
i changed the Case Is also,
Case Is = "pookie close"
Me.Close()
just in case you were wondering.
any ideas of teaching pookie words.. like pookie's name?
about starting visual basic, yay!
thank you all for the helpful information, pookie's ears, tiny mind, etc..
trujade..
(jinzai , looking forward to getting that easter egg. ;o)
i like**:** VB General google fast cars username password
Thursday, August 13, 2009 4:24 PM
Hmm....
Trujade: What download did you use to install the SpeachRecognizer?
I can get the coputer to speak... but it won't lisen.... littrely...
I get an exeption here:
recognizer.LoadGrammar(New Grammar(grammar))
and it says:
A first chance exception of type 'System.PlatformNotSupportedException' occurred in System.Speech.dll
Kenneth
Thursday, August 13, 2009 5:17 PM
@PEng1..
that is something pookie needed, a way to verbally cuss me out.. lol
thank you again.. very well appreciated ..
@Kenneth..
i simply added the code you posted , now marked as answer, and i added the system.speech reference from the file menu, project/add reference. ..
i have not had much time to play around with it, but, it would click button 1, or load vb.net..
...
just tested it, to make sure of this, and now i find out that it was the system's voice reco. doing the clicking and loading vb.net, not pookie ..
i simply added a label that would catch this, if applied..
at least i get the msgbox.
MessageBox.Show("Sorry but the " & e.Result.Text & " phrase could not be recognized")
so, it does listen, but not understand..
thanx for the input..
if i correct this, or if anyone else does, a reply is always nice...
trujade..i like**:** VB General google fast cars username password
Thursday, August 13, 2009 5:21 PM
@Kenneth..
if you were mentioning about a d/l, like from microsoft, i never had to..
windows 7 comes with speech recognition installed by default.. i think xp has one already installed, so should vista..
just do a search on your pc for speech..
hope this helps, if this is what you were referring to.
trujade.i like**:** VB General google fast cars username password
Thursday, August 13, 2009 5:38 PM | 1 vote
I sat on a different computer yesterday... It worked there.... And that was an XP computer....
Now Im running Windows Vista Home Premium... But it seems that Window Speechrecognition only applyes to English or US vista... Im currently on a Norwegian edition....
I have added System.Speech as a referance.... but it dosent work...
and have a look here... http://www.microsoft.com/enable/training/windowsvista/sr.aspx
seems you can do this on a large scale as well ;)
But again... I coudnt find it on my computer....Kenneth
Thursday, August 13, 2009 5:54 PM
sorry to hear that about vista..
glad i skipped over it from xp to windows 7.
thanx for the link.
trujade.i like**:** VB General google fast cars username password
Thursday, August 13, 2009 6:07 PM
I have it on my Vista Home Premium, Kenneth. How did you add that reference? If you look at my post above, you'll se t hat I had to add it from the project properties dialog. When I get home, I will try to get you some more information.
I am nearly certain it does not relate to local; there is a sample that uses voice Lili to speak Chinese, but...alas, Lili does not live on my computer, either.
You can verify that it is installed using Control Panel; there is an icon named Speech there that you can test SAPI using whatever voices are currently installed on your machine, (Here at work...I have XP Pro and Microsoft Sam. There is also Mary, but both Sam and Mary are older voices, and Anna and Lili are newer ones.)
None of them sound like Majel Barrett Roddenberry, however. (Sadly, she passed away last December.)
Thursday, August 13, 2009 6:18 PM
Hmm....
The reference was added the normal way...
Right click on My Project -> Add Reference
Added System.Speech
... That did the trick for my namespaces but not for the recognice code....
So I added Microsoft Speech 5.3 from the COM objects in Add referance... but the same error presisted...Kenneth
Saturday, August 15, 2009 12:07 AM
I figured out why it wont run recognizer on my computer... It has to do with the Languange... I tried to change the current culture to en-UK but it didnt help... And I also tried to invoke the Speech Recognition program in vista... Got the error that This Languange does not support speech recognition. So I guess thats it... Enybody got an Idea how to fix it... I can speak english so thats not an issue... but....Kenneth
Saturday, August 15, 2009 1:32 AM
Kenneth ,
try this:
http://www.microsoft.com/windows/windows-7/get/download.aspx .. you have 6 days left.
i have found this much more efficient than vista. (vista, used at my friend's office)...
as i mentioned in a previous reply, i skipped vista on my o.s, completely ... reason, vista at my friend's office, was slowly dieing..
wish i knew why..
just slower and slower daily, slower everything, thru time.
some say that windows 7 is an upgrade from vista..
i say it is a miracle..
nothing to do with any of the old versions of microsoft's windows.. an o.s. that is it's own ..
the only slowness i have found, was tracking cookies slowing it down.. this is from searching for solutions to daily questions.
it sux that there are developers that design these, so called tracking cookies, but i am also glad to use html on my webpages, not crazy developing softwares that attach cookies, minus well viruses to your o.s.
html lover, css noob..
use a good virus scanner every so often, clean that nonsense ( tracking cookies ), and you should be a happy camper.
i hope i overstated the "attaching part", especially for viruses..
i love my "wot" world of trust, from firefox. ;o) a new addon to firefox, thru time, it should be another miracle..
thanx to you, kenneth, and peng1, of course, jinzai, pookie, is now poohkie, (lol), for the voice reco.. my name is true, not tru.. loose some, win alot.
it does recognize the words in the preset list, as in your code, just does not correspond to the commands.. voice reco app. displays my app's preset list, that is all.
jinzai..
if you have any goodies to share, do so.
like that easter egg..
plus, since you are familiar with the speech reco, i have one question..
that list in kenneth's code,
'A grammar must be loaded into the engine. This is possible by loading an object or an xml file
how do i add an xml file with such..
never used xml in vb, so nooooob again on that part...
trujade.
i like**:** VB General google fast cars username password
Saturday, August 15, 2009 2:08 AM
I hope you are right Trujade.... Im downloadiing now... *Hulk* A little afraid that I have to install all my programs again.....
A side note to Speech recognizer from microsoft:
http://www.youtube.com/watch?v=2Y_Jp6PxsSQ
It is actually much better than that... But still funny.... Sorry Microsoft... I love your work... So forgive me....
Kenneth
Saturday, August 15, 2009 2:23 AM
plus, since you are familiar with the speech reco, i have one question..
that list in kenneth's code,'A grammar must be loaded into the engine. This is possible by loading an object or an xml file How do i add an xml file with such.. never used xml in vb, so nooooob again on that part... trujade. i like: VB General google fast cars username password
*XML is just a file like a txt file... but it is easyer to deal with... Start a new question about XML ... Im sure youll get lots of replies...
Kenneth
Saturday, August 15, 2009 2:24 AM
windows 7, even on a clean install, seems to save all of your old files/programs, in a folder called, "windows.old".
i am not happy about it saving, especially on a clean install, but this should help to run you old programs on the system..
just locate this "windows.old" folder, right below windows in c:\ and you should find your old "program files" folder in it..
then test your programs, which should work, and add their shortcuts where needed...
when needed, i install my original (xp), then install windows 7 shortly..
this, i do when i code a new project to soon be published, and i need a clean system for it.
wish i had more p.c.'s, but then again, i do not like clutter.
btw, using the taskbar on top, seems to help..it is close to all the needed controls/menus/toolbars.. just a suggestion..
also, show desktop button, very last item on the toolbar. looks like a panel.
the go one folder up, not sure if vista had it, xp did, but just use the address bar..
hope you find this useful..
if you have any questions about windows 7, this thread is far more than answered, so i do not mind the extra goodies in my thread..
trujade.
i like**:** VB General google fast cars username password
Saturday, August 15, 2009 2:29 AM
Ok...
http://msdn.microsoft.com/en-us/library/ms723634(VS.85).aspx
Heres the info from the link:
Grammar Format Tags (SAPI 5.3)
Microsoft Speech API 5.3
Grammar Format Tags
The SAPI text grammar format is composed of XML tags, which can be structured to define the phrases that the speech recognition engine recognizes. The formal XML schema for the text grammar format is defined in a separate document, called XML Schema: Grammar. The following document explains each tag in more detail, including sample source code, sample XML grammar snippets, and relevant application scenarios.
The XML tags descriptions are organized by XML element, where each element description contains information for relevant attributes.
XML Tags: Elements
<DEFINE>
Summary: The DEFINE tag is used for declaring a set of string identifiers for numeric values.
XML Attributes: None XML Parent Elements: GRAMMAR: The container for the entire XML grammar. XML Child Elements: ID (1 or more required): The DEFINE tag can contain one or more ID tags, each of which defines one string identifier. Detailed Description: None XML Grammar Sample(s): <GRAMMAR> <DEFINE> <ID NAME="TheNumberFive" VAL="5"/> </DEFINE> <!-- Note that the ID takes a number, which is actually "5" --> <RULE ID="TheNumberFive" TOPLEVEL="ACTIVE"> <P>five</P> </RULE> </GRAMMAR>
Kenneth
Saturday, August 15, 2009 2:34 AM
As you see all XML files have Elements Nodes and Childes to that node....
You can write to a XML File the following way:
Public Class XMLfiles
Public Sub ToXML(ByVal filename As String)
Dim enc As New System.[Text].UnicodeEncoding()
' Opens the document
Dim tWriter As Xml.XmlTextWriter = New Xml.XmlTextWriter(filename, enc)
tWriter.Formatting = Xml.Formatting.Indented
tWriter.Indentation = 3
tWriter.WriteStartDocument()
tWriter.WriteStartElement("Main Element")
Dim cls As Double = 0
tWriter.WriteAttributeString("Title", cls.ToString)
tWriter.WriteEndElement()
tWriter.Close()
End Sub
Public Sub LoadXML(ByVal filename As String)
Dim XMLReader As Xml.XmlReader
XMLReader = New Xml.XmlTextReader(filename)
Dim Title as double
While XMLReader.Read
Select Case XMLReader.NodeType
Case Xml.XmlNodeType.Element
' Debug.WriteLine(XMLReader.Name)
If XMLReader.AttributeCount > 0 Then
While XMLReader.MoveToNextAttribute
If XMLReader.Name = "Title" Then
Title = XMLReader.Value
End If
End While
End If
Case Xml.XmlNodeType.Text
' Debug.WriteLine(XMLReader.Value)
Case Xml.XmlNodeType.Comment
'Debug.WriteLine(XMLReader.Value)
End Select
End While
XMLReader.Close()
End Sub
End Class
Kenneth
Saturday, August 15, 2009 2:39 AM
....
A side note to Speech recognizer from microsoft:
http://www.youtube.com/watch?v=2Y_Jp6PxsSQ
It is actually much better than that... But still funny.... Sorry Microsoft... I love your work... So forgive me....
Kenneth
that youtube video.. roflmao ..
now you know why i needed pookie..
although, the killer part, lol.. have not had any serial killer messages in my text, but i hope not too with pookie.
ms, all but love, as kenneth mentioned.
thanx kenneth. ;o)
trujade.
i like**:** VB General google fast cars username password
Saturday, August 15, 2009 2:50 AM
kenneth , your recent reply, xml info,
even from that link to the msdn library, since i never used xml in vb.net, i would not know where to begin..
once you get your o.s. working properly, and you find a solution for xml and adding the grammar, by using code in a windows applications, do post on here..
about fighting fire w/fire..
http://www.youtube.com/watch?v=fOFmKTJBPeE
just wish microsoft would have sponsored the series..;o)
trujade.
i like**:** VB General google fast cars username password
Saturday, August 15, 2009 3:08 AM
the last xml reply i did not get in time, so i replied, but i will leave that post there for that fire link. ;o)
i will look over it tomorrow, as well as xml googling, and understanding it some..
i did want to add this.
if you had vista as your o.s., the "hrb updates", if you do get them as my friend does, skip them . they would relate to vista o.s..
i have not had any since i had xp previously, but windows7 installs updates on it's own, no need for confirmations..
i told my buddy, after i got him loving windows7, to skip those hrb updates, and no problem from windows7 performance by doing so, resulted.
just a suggestion about updating from vista..
trujade.i like**:** VB General google fast cars username password
Saturday, August 15, 2009 7:10 AM
Got Windows 7... Yehy.... But... Had to install all my program again... But no worries VB is up an running.....Kenneth
Saturday, August 15, 2009 3:25 PM
kenneth , it is always good to be one step ahead..
hopefully by using windows7, will do just that for your programming. ;o)
about your xml code, i have problems loading the xml..
not really looking for a reply back with a solution, since i will stick to my .txt files for now.. xml is a whole new ball game..
if you do by chance, successfully have "pookie" listen and proceed with grammar from an xml file, do post on here..
i am one to find viewing code, more educational, than reading on how to create the code.
thanx for all your help.
trujade.
i like**:** VB General google fast cars username password
Wednesday, September 2, 2009 10:28 PM
Have you tried using the ComboBox and its 2 properties AutoCompleteMode and AutoCompleteSource? You can set them so that it will find matching entries as you type (if they exist). These settings for those 2 properties will do what you describe:
ComboBox1 Property settings:
AutoCompleteMode = SuggestAppend
AutoCompleteSource = ListItemsComboBox1 settings via code:
ComboBox1.AutoCompleteMode = AutoCompleteMode.SuggestAppend
ComboBox1.AutoCompleteSource = AutoCompleteSource.ListItemsDoug
SEARCH ... then ask
doug , thanx.. i am finally finding use for your suggestion. ;o)
i live here and this is my reason ... trujade.