i am asking me one question:
Have i the possibilty to set a variable in the Speech Commands?
To understand what i mean:
I want to ask the Robot:
Do you like "x" ( and now i can say what i want)
Do you like fishing?
Do you like drinking?
Do you like flying?
and so on.
and the robot can give an answer: "Yes i like!"
But the important, is to set a variable!
I will say: My favorite music is "x"
Now the robot will remember the "x" (in this case it will be "Hip Hop")
And the Robot will answer:
Hip Hop (from the variable) i like also!
i think this is more complicate then the first idea, there the speech reco only must understand the start or the end of a sentence.
So it is possible?
For what i need this Commands:
I check out the forum and the manual, but i really find nothing about it.
Upgrade to ARC Pro
Become a Synthiam ARC Pro subscriber to unleash the power of easy and powerful robot programming
Thank you for your kind words. I hadn't really thought of what I posted as a lesson, but I suppose it is in a way. I just like to give details. Sometimes I think I write too much in my posts and may be insulting the intelligence of the person to whom I am addressing, but I'm glad you find it useful. Thanks again for your comment.
Sorry I haven't answered sooner. I know it is frustrating to not have an answer for hours and hours when you are really into something. But I just got home and read your posts. I wanted to let you know that I will post an answer to your questions in the next couple of hours so you may not see it until tomorrow, since I see it is already late where you are (about 11:30 PM, I believe).
and its now Sunday 0:02 so don´t worry i will not go sleep until 4-5 oclock in the morning.
And yes, its really a lesson!
i learn a lot!
Another interesting question:
What i can do if i want that 2 or 3 sentence are use the same command.
Do understand here my easy thinking code:
SO nevermind what i say "wie spät ist es" or "wie spät ist es jetzt" i will give the answer.
I know i can make another entry for "Wie spät ist es jetzt", but if the command script for the voice command is long and i have 3 or 4 variables, in the end the SR_Eval Script will be huge!
So it will be fine so say it simply:
IF you hear this (1a) and this (1b) and this (1c), so do this everytime the same command. Without to have 3 times the same entry?
Or to let the SR_Eval script not to huge, can i leave the script for the voice command outside EZB, like Technopro does it with the Textfile
if($SpeechPhrase ="was sagt der spiegel")
ReadScript = C:\spiegel_answer.txt
THis will be another idea, there i can copy so much variables i want. And the SR_Eval Script only have the necessary stuff inside.
This is not necessary for the rest of the code to work out. It is in there as a method of searching for a certain phrase in the Speech Recognition control.
In the Phrase_init script is a variable called $SRMode. Right now it is set to $DoNotSearch ($SRMode =$DoNotSearch). This prevents the code for the search function from working. To make it work you would have to change $SRMode to $Search ($SRMode =$Search) in the Phrase_Init script, then run the Phrase_Init script again so that change that will happen. When you say "hello" you will hear "Row 2" spoken as well as one of the randomly chosen phrases. This is because, in what I originally put in, "hello" is in the second row in the Speech Recognition control. If you say "skippy" it will say "row 1" since "skippy" is in row 1.
This is not really helpful with just 2 phrases in the Speech Recognition control, but what if you had 2 hundred? If you had that script in each phrase row, you would be able to find where that phrase is in the list by simply speaking it's name. Then you would have an idea of how far to scroll down to find it. That is why the comment (#1, #2) is also at the beginning. It gives you a row number to go by as you scroll to the proper row in the Speech Recognition control.
Of course, each row would be a little different since each would need a different number. For example the code for row number 145 for phrase number 145 would look like this:
Then, when you say whatever the phrase is in row 145, you would hear "Row 145."
To turn this function off you would set the $SRMode variable back to $DoNotSearch and run the Phrase_Init script again.
As I said, none of this is necessary to anything else working so you can ignore it and leave $SRMode set to $DoNotSearch. Or you can delete it all if you wish.
This does bring up an interesting point, however. As I mentioned in another post, I am adding a feature to my external program that works with the data in the Speech Recognition control. The feature will take what is in a given project's Speech Recognition control's phrases and scripts and automatically transform them in a form that can simply be pasted into the SR_Eval script. This will save you the trouble of having to do that manually for each one. I will now also add a check box that will allow for the choice of automatically putting in the search function as well.
At the moment it has no meaning because I did not use it in the H-Section part in the SR_Eval script as I had meant to. This is another mistake on my part.
I'll explain. I like to setup variables for things I may use more than once in the script code. In this case it was for the word "hello". By setting a variable to the word, I can use it wherever I like in the code and not have to worry about changes I might make later on.
Using hello as an example. Let's say I put the string "hello" in my code just like that, ie: the word in quotes (that is called a literal string). And I put it in several places in the script. Maybe even in other scripts. Then, at some point, I want to change it to "hi" or "bonjour" instead. Now I will have to find every place I put in "hello" and change it to the new word.
If, instead, I setup a variable like this:
I only have to change the variable and that change will happen automatically in every place I used $Hello. I don't have to change anything else. Just that one variable in Phrase_Init.
That is what I meant to illustrate here by defining $Hello, but I forgot to use it in the code in SR_Eval.
Now, in this particular case there is one more point to cover concerning $Hello. This particular variable is also related to a phrase in the Speech Recognition control. What brought up this whole topic is the fact you cannot use variables in the Speech Recognition control Phrase area. All the phrases must be put in using the actual word. So if a change is made to $Hello, you also have to make it in the Speech Recognition Phrase area. Therefore, if you changed:
you also have to change that in the Speech Recognition control. Where it is "Hello" in the second row in the Phrase area you would put "test". Then in the SR_Eval you would put $Geht, like this:
Then, when you say "test" into the microphone, the robot would say one of the random sentences.
So, changing $Hello ="hello" to $Geht ="test" doesn't really do anything by itself. You have to make changes in other places as well.
If all that is too confusing right now, just ignore it and put the literal string you want to use in the Speech Recognition control and the SR_Eval script for now.
It would be nice if that would work, but it won't. The reason is because the array can only work with basic types. The Script manual defines the types as:
So when you try to put in:
$GehtResponses ="Geht mir super das Wetter bringt mich gut in Stimmung" + ControlCommand (windowName, etc etc)
It will not take it. It could take the first part like this:
$GehtResponses ="Geht mir super das Wetter bringt mich gut in Stimmung"
That would be fine because it is a string. Anything between quotes is a string. But it cannot take ControlCommands or any command. Thus, this is also invalid:
$GehtResponses = SpeakRSS( "http://www.tagesschau.de/newsticker.rdf";, 0 )
As is this:
$GehtResponses ="Könnte besser sein aber sonst alles ok" + Servo(D14, 25)
To do what you want you would have to resort to using If-Elseif statements like this:
Note, I changed the SayWait to Say so that it would be spoken while whatever else is happening is taking place. If you want it to be spoken first, then the action happens, just change it back to SayWait. Also $GehtResponses is a blank (empty) string so that when the Say instruction is executed, nothing will be heard.
In this particular case, since we have to use If-Elseif statements anyway, we could forget the array entirely and do this:
On the other hand, if you had many strings and only a few of the possibilities needed commands as well, it could still be useful to use an array.
One other point I need to make here. It's about the $ArrayDefined variable. In order to have all the arrays in the SR_Eval script there will have to be a similar variable for each array. This is because not all will be defined and set with sentences at the same time. As it is now, once one is done, the $ArrayDefined variable will be set to "True". Once that happens, no other array will be defined. This assumes the other arrays will be in different places in the script. So you will have to define and use a variable for each array in the Phrase_Init script.
Additionally, each array must have a unique name since arrays are just like any other variable in that respect. So, you could name the new $ArrayDefined variables according to the array name as in:
The corresponding $ArrayDefined variables could be:
Then used like this:
That's one reason it can be best to define the arrays in a separate script all at the same time, but that's a whole other discussion in itself.
First I want to correct one mistake on your part. You may know this and simply put the wrong thing in the code, but, where you say:
if($SpeechPhrase ="wie spät ist es" and "wie spät ist es jetzt" )
if($SpeechPhrase ="wie spät ist es" or "wie spät ist es jetzt" )
Now, let me see if I understand the question. Is it that you do not want to make entries in the Speech Recognition control for other variations of the phrase? In the example, you would have one entry in the Speech Recognition control for the phrase "wie spät ist es" but no entry for "wie spät ist es jetzt". But you still want the SR_Eval script to treat "wie spät ist es" and "wie spät ist es jetzt" the same. Is that correct?
now i understand more and more!
Ok the idea with the Variable ($Hello = Bonjour) i understand, yeah is cool like this.
I know the problem from website making. If you want to change a link, you must search the hole site. Today we all use Website with database and it easy to change something, because you only must change the placeholder and everything for this placeholder will be also change!
With the search Function. I know it sound not cool, but why you not write in the Command in the Speech Control which line you will find the Script, then you must also not search.
Forget my last question with the 2 sentence.
Know i understand more and i think its easier to have the script for the voice command ousite from the SR_Eval script.
Like my last post is.
But thanx a lot for you help. Your post are really good and informativ!
I'm sorry, but I don't quite understand what you mean here. Perhaps you could give an example?
now problem: Here my example:
I am searching for a Function what will read a script in a text file.
in the spiegel_answer.txt will be:
i only try to outsource a little bit.
I'm not sure if you meant this line to be the defining of a variable:
ReadScript = C:\spiegel_answer.txt
If so, it should go like this:
$ReadScript = "C:\spiegel_answer.txt"
Anyway, there is a script command that can read an entire file at once:
FileReadAll( filename )
Using the $ReadScript from above, It would be used like this:
So that can read a script from a file. The problem is there is nothing you can do with it. To execute a script, it must be in a script control and then that script control would be run. Unfortunately there is no command or instruction that will put text into a script control. No command that can copy text from a script control either for that matter. There is also no way that I know of that can run a script from a variable.
I just wanted to mention that I have the program working to where it will copy the Speech Recognition phrases and scripts from the Speech Recognition control in an .EZB project file and create the data, in the proper format, for placing those phrases and scripts into the SR_Eval script by pasting it in.
The program has not been tested much yet, so I am hesitant to send it out to be used by others. However, I thought it might be helpful to you if you uploaded a copy of some project of yours that has all the phrases in it. You could save it to the cloud briefly and I could download it for modification and put the result back up to the cloud for you to download.
There is a way to make a project with only the Speech recognition control in it so that you would not have to upload a project with everything else in it just to do this one thing. If you wish to do that I can give you detailed instructions on how to do it. Once you download the project with the modified Speech Recognition control, you can import it into whatever project you like using a blank Speech Recognition control and an a blank SR_Eval script. That can be done using the "Merge" function.
If you don't wish to do this, that that is fine and I completely understand. I just thought I would mention it so you could work with this method for all your phrases as soon as possible. It only takes a few seconds for the program to do this so I can upload the modified project to the cloud within minutes of downloading yours. Assuming nothing unforeseen happens during the conversion process. Which is another reason for me to to it this first time since I can fix whatever goes wrong on the spot.
sorry about my delay! I make free on sunday from roboics. ;-)
I really not complete understand what you me with upload and downbload the project, do use thos copy software for the speech commands.
i understand this will copy all speech command from the speech control to a file and then past this to the SR_Eval Script? Right.
So this is interesting if i have a lot of speech commands and now i am starting the SR_Eval Script. So i don´t must write the hole script again to the SR_Eval Script, this will do the Software automaticly?
My problem is i am at the beginning, so my hole command are also in the SR_Eval Script.
But i have a old EZB Project with commands what i really like to copy to the SR_Eval Script i my new EZB Project.
There its interessting. SO i must upload the old project to the EZB Cloud?
To the Question with the scripts in a external text file, i understand that i only can use the textfile for reading a text, not for scripts. Not everything is easy ;-)
But (sorry) back to my idea for variable sentences:
I had and idea for a script like this:
another idea what your are posting:
I have saved both commands "wie spät ist es" and "wie früh ist es" in the Speech Control.
But both Scripts will not work. I understand that i can´t make complete diffrent sentences, i think they must start with the same letter, what in this case is the "w".
Or i am completely on the wrong way?
thanx for your link, but i want to have it complete opposite.
I say 2 or 3 diffrent sentences and i will hear the same answer.
I german we have a lot of variable to ask something. The sentences starts allmoust the same;
Wie heißt du?
Wie ist den Name?
Wie wirst du genannt?
(how is your name?)
All starts with "Wie" but means the same.
Wie geht es dir?
Wie gehts dir?
(How are you?)
2 only little bit diffrent sentences, but diffrent ... but means the same,
If i will make for every important variable a command, my script will be huge!
The same with "What is the time"
Wie spät ist es
Was sagt die Uhr
Was sagt die Uhrzeit
Wieviel Uhr haben wir
all means "What is the time"
I like this Script "SR_Eval" from WBS00001 for the possibilty to pause and unpause the speech reco. But if i must copy the "What is the time" script 4 times, you can image how long the SR_Eval script will be. And if there is to much inside the script, it will be hard and confuse to work with.
DO you understand the problem?
I don´t want to have 20 or 60 Speech Commands. I think they can be 200 diffrent (incl. variables) Speech Commands. And this will be a big Script.... i must scroll 5 minutes to come to the end ;-)
Have these different Phrases in Speech Reconition;
and they would all run a script like the following;
Now it is my turn to apologize for not getting back to you sooner.
Yes. That is correct.
Be sure to click the box that says "Is public" at the bottom of the upload page so I can access and download it. When I do, I can get all the parts of the Speech Recognition control and format them for the SR_Eval script. I will place an SR_Eval script on the project and paste the modified phrases and scripts from the Speech Recognition control into the new SR_Eval script.
This process will also modify what is currently in the Speech Recognition control with the same phrases that are in it now, but they will be in alphabetical order. In the script part for each phrase will be just a "#" character. There has to be something there to prevent the Speech Recognition control from erasing the phrase. It doesn't always erase it, but it's better to be sure. You can put some text there after the # character to describe what the phrase is for if you like but that is not required.
EDIT If there is already a # as the first character in the first line of the existing script for a given phrase, whatever else is in that line will also be kept as it is because it is already a comment line. That way, if you already have a comment on that first line, it will be transferred to the new Speech Recognition control so you won't have to type it in again.
I am not putting the "search" code for each phrase like I have in the ESRP. If that is desired later I can put it in then.
When I finish the modified project, I will upload it to the cloud for you to download. I will name it differently by adding "_MOD" to the end of the project name. That way there will be no accidental overwriting of the project you sent to me.
Once you have the modified project and verify it works I can give you instructions on how to merge it with another project.
NOTE: It is possible to add what is in the Speech Recognition control in the modified project with what is already in a Speech Recognition control in another project. If you do it that way, however, what you already have in the Speech Recognition control in the other project will not be in alphabetical order after the merge operation. It would be best to add the phrases and scripts you have done recently using the ESRP project to the ones in the old project that you are going to send to me. That way everything will be included in the new SR_Eval script.
The problem that Boris faces is that he does not want to have all those phrases and their variations in the Speech Recognition control. He would like to have just one version actually in the Speech Recognition control but somehow have the evaluation script for that one phrase work with all the variations as well.
So far, that simply does not seem to be a possibility because of the way the Speech Recognition control works. It get's good accuracy because it doesn't have to figure out what the speech input means. It only has to match it to one of the phrases in the Phrases area of the control. It then gives an output on what it thinks is the best match.
I forgot to address the problem you had.
This is my mistake again if I posted that you should write it as:
Sorry for the confusion. You are correct that both phrases must begin with the same letter for it to work.
Too bad I don't still speak German. I could phrase things so much better for you to understand. I was actually born in Bremerhaven to a German/Dutch mother and an American father. My mother spoke Upper and Lower German and Dutch. I spoke only German until age 6 or 7, then I came to America. I just picked up English (kids seem to be able to do that easily) not long after coming to the USA, and soon after that I could remember no German at all. Not one word. I can't remember any transition period the in languages. I can't even remember my life before age 7. Maybe because it was in a different language, I don't know. I see pictures of me on a farm in Germany then, but I don't remember any of it.
Ok, now it will be more easier to make speech commands.
I have my 2 -4 or 5 variables what i can say and then the robot will do his job!
I must say, sometimes i can´t really remember how exactly my speech command was. So it will be good to have more possibilities.
Bremerhaven..... An der Nordseeküste, am plattdeutschen Strand, da sind Fische im Wasser und selten an Land.
(At the northsea coast, at the "flat-german" beach, there are the fishes in the water and only sometimes at the beach.)
Ok in German it sounds much more better!
I know Bremerhaven, when i was also a little child i was there and also visiting the submarine in the port. But it was also long time ago.
In the States i was only one time, also when i was a child. Our family was in the 80ties in L.A. I remember some big Palms on the Street, the house cat from our guest family in L.A. and a big birthday party for me in a icecream store.
I got a Congratulation Certificate from the mayor of L.A. - A Lot of Berlin Visitor got this certificate, because WEST-Berlin was and maybe still is a daughter/ partner city of L.A.
But as you read, i am a born Berlin guy, so chaos everyday is also normal for me and this summer we had 3 weeks allmoust everyday 35 centigrade. So only the Palms are missing ;-)
But it´s cool to meet guys from good old germany!
I got some question about the copy programm for the speech commands, but i will write you another post later.
you tipp with the speech variable solved my problem! Thanx again,
you told you have a program what can copy the speech commands into the speech control?
Copy this program also speech command from a list from as word or excel file?
The program can copy the commands from a Speech Recognition Control in a project to a Script Control, such as SR_Eval.
Yes I could make it copy from a Word file. I'm not sure about copying from an Excel file. It would be easiest to copy from a Windows Notepad file, however.
sorry that our conversations was so abrupt ending
my head was exploding because of the Maker-Faire and the time to finish so much as possible of my Inmoov... but the time where to less so that the inmoov went without arms. But still the Maker-Faire was funny.
I also wanted say thanks to you for you help and support!
In the next days i will make again some programing and sorting the speech reco. So i think i will have some questions to you.
So i whish you a good weekend
and c u later
here are some pictures from the Maker-Faire
and here is also a link for a youtube video with my inmoov (the Main Broacast beginns @ 12 min and 35 seconds)