Welcome to Synthiam!

Program robots using technologies created from industry experts. ARC is our free-to-use robot programming software that makes features like vision recognition, navigation and artificial intelligence easy.

Get Started
United Kingdom
Asked — Edited

Waitforspeech Question

I have a problem using WaitForSpeech - I wonder if you could please advise DJ?

On my Win7 computer it does not work at all - there is no timeout the seconds variable gets ignored and the WaitForSpeech just runs through without a wait? I do see the timeout box very briefly. General SR works on this Win7 computer but I can only use it on US and not GB.

On my Win10 computer the same script works perfectly and the timeout window stays on the screen and counts down, so there is no problem here?

On the Win7 computer I then updated to the latest release (in case it was a previous bug) but this has made no difference.

Here is the script in question (which I borrowed from Rich)

Code:


:start
SayWait("What is 4 times 4")
$response = WaitForSpeech(10, "10", "12", "14", "16")
If($response = "16")
SayWait("Corect")
Goto(nextquestion)
Else
SayWait("sorry that is incorrect, please try again")
Goto(start)
EndIf
:nextquestion

Here is screendump of bottom of the Win7 screen.

User-inserted image


Thanks for your help

Tony

AI Support Bot
Related Content
Synthiam
United Kingdom
#3  
Thanks DJ for responding, no there is only one control. I started a complete new project on the Win7 computer and added the script and still get the some problem. This computer will just not accept the WaitForSpeech function? Strange thing is, the SR is working for general things like "Robot enable speech" etc this all works? The bit that is failing is the timeout which seems to always default to zero seconds no matter what value it has been given. I am at a loss at what to try next?

Tony
PRO
Synthiam
#4  
I'm at a loss as well. I tried on a win7 computer today without any issues as well. That is a popular command for both RoboScratch and blockly, which are used heavily in the classrooms with no issues.

Is this in a script manager control or a script control?
United Kingdom
#5  
It a script control. Could there be a clue in the "waitforspeechcommand Error" shown on the bottom line of the screendump that I posted? "System.invalidoperationExecption" then indicates that grammar does not match.

Tony
#6  
Tony, just thinking out loud here, are you thinking the exception error is a mismatch between EN-US and GB speech recognition language setting of the control? In the control you say you have it set to EN-US (because that was the only way it worked on the Win7 computer)?

Or is it possible the error is pointing towards the list array, perhaps because on the Win7 it is less forgiving (my guess, apologies if it is bad/wrong guess) that the WaitForSpeech array has a mix of string variables and integers since the first 10 does not have quotes around it.
PRO
Synthiam
#7  
Justin, that error about theist collection is actually unrelated to the wait for speech. If that error is related to the script containing the wait for speech, I'm surprised it even runs at all.

This is because that error is related to compiling the ezscript after it has been edited. It's an internal error that should never ever ever happen. Hence why it also reads "strange,..." because the exception handler knows it's weird error.

I'm going to put a new ARC online today that has additional debug information about this scenario. however, I don't have a solution to suggest yet because I can't understand it.

My first instinct was that there were two controls running. My second is wondering if the script is a script manager.

Other than that, the error and situation, I beleive, is actually unrelated to wait for speech and instead is related to the pre-compile after edit.

@Tony, can you also verify that the script is not running via a ControlCommand() WHILE it is being edited in the edit window?
#8  
Thanks DJ for the explanation. I just loaded the latest ARC on a Win7 computer and ran Tony's script with no errors (language in EN-US of course). I did have to upgrade my .NET Framework to 4.62 because whatever it had was older and ARC provided the warning message that .NET needed updated before I could install.

Tony, just wondering, what version of .NET framework is on your Win7 system?

BTW Tony, I like your script sample, I've never seen that 10 second count down used that way before in WaitForSpeech, that's nifty! :)
PRO
Synthiam
#9  
@tony, append this request to my previous question. Can you also post the project on here that is giving the trouble? The project can be posted using the ATTACH FILE feature to the right of the edit area.

Please send the project file from the windows 7 machine. Do not send a duplicate copy of the file from another computer.

thanks
PRO
Synthiam
#10  
@tony, one last request (totaling three). It appears the copy of ARC on that machine is a few months old. Can you update it?

please respond to each of the three requests - thanks!
#11  
I don't know if this will help or is even related. I got that "Strange " while compiling error a number of times a few days ago when I was rewriting scripts. I assumed it was just my poor scripting skills but when I couldn't find any issues and I haven't seen it pop up again after those few times.
PRO
Synthiam
#12  
That error can appear if there's a missing GOTO, missing LABEL, missing IF, missing ENDIF, missing ELSEIF, missing ELSE, missing ENDREPEAT, etc..

But, in that specific case, it will actually say the reason - which would be something like "MISSING ENDIF". Such as in your case.

So far, @tony is the person to have created an error that i cannot trace. Mostly due to the fact the ARC instance is a few months old. Once @tony upgrades to the recent version, then i will be able to begin tracing the origin.
United Kingdom
#14  
Thanks again DJ for this ongoing help.

I use 3 computers here using ARC, the Win7 PC that exhibits this problem has Version 2017.02.05.00 so it was the latest until this release. I have now updated to your latest debug version and the issue is still there.

I cannot find the ATTACH FILE feature that you mentioned, is it the .rtf file that you are looking for?

I can confirm that the script is not running via a controlcommand

Tony
#15  
DJ was referring to the attach file in the forum. It will allow you to upload the file from your computer.
#16  
@Tony... DJ is referring to uploading your ARC project to the forum here (using a post) just like you would when you "attach" and upload pictures... It's below the UBB Code editor to the right of the reply box... Attach File
United Kingdom
#17  
Thanks guys for pointing this out, its so obvious now - I must have my dense head on today! I think its old age.

Attached is the simple project from the Win7 computer that gives/shows the WaitForSpeech issue. The issue does not occur on my Win10 computers with the same project.

Tony

speech.EZB
United Kingdom
#18  
Tony,
I get the same issue running your project on my Win7 laptop, haven't yet try it on Win10.

Chris.
PRO
USA
#19  
I just tested in a windows 10 and i can reproduce the same issue.

Quick feedback (work call in 5 minutes)... i can't help debugging the ARC/SAPI calls.

SAPI API is not good with optional parameters... or guessing. I believe is a combination of how ARC initializes the SAPI recognizer and windows user settings.

@Tony
If you have TeamViewer i can try later or tomorrow pls drop me an email.
PRO
Synthiam
#20  
Try the latest Release 2017.02.09.00
PRO
USA
#21  
@DJ,

I tried Tony's project with a Windows 10 and is working now.

PS:
Tony's away until next week.
PRO
Synthiam
#22  
Thanks a bunch @ptp. It may have been one of two things. The wait for speech window was many years old of code - so there may have been a cross thread exception with the timer counting down. tbe speech recognition engine didn't inherit the selected culture from the speech recognition module either, but I can't see that having an affect with the timer countdown. Leaning toward the possible cross threading exception. A label update wasn't invoked. Silly rookie mistake:)

It only popped its head under certain circumstances. Perhaps with certain cpus or architecture. Who knows how the Action factory in windows works behind the scene