All Tutorials / Steve G / Speech recognition tutorial

Speech recognition tutorial

Step 7. Pausing and Unpausing Speech Recognition.

As well as the "Disable Speech" phrase and commands, there is a manual pause check box found on the speech recognition control window, which when ticked, pauses the control. The computer will still hear unconfident phrases (if selected), but no confident phrases or scripts will be heard or run.

User-inserted image

Some users have encountered a problem when the control is unpaused, for example, using the "Enable Phrase" option. The issue these members faced, was when the control is permanently unpaused, the computer or robot talks, but it tends to hear itself speak and activates commands depending on confidence levels. This can sometimes be quite amusing seeing a robot take on a mind of it's own, but sometimes it can be a pain. So how do you stop this from happening?

A.) Adjust the confidence levels in the speech recognition configuration menu, although this may not always have the desired effect.

B.) A much more reliable way of doing this, is to pause the control while the computer/robot speaks. If you have a speech script like the following...

Code:

Say("Hello. I am a robot, and I am having a good day.")



you can add a Cheat Sheet command to pause the control while the computer/robot speaks, and then unpauses the control when it finishes speaking.

Code:

ControlCommand("Speech Recognition", PauseOn)

SayWait("Hello. I am a robot, and I am having a good day.")

ControlCommand("Speech Recognition", PauseOff)



1.) To do this, simply open the speech recognition configuration menu,

2.) Click on the "pencil" icon for the phrase/command that needs to be changed,

3.) In the script editor, right click your mouse/trackpad and click on the "Speech Recognition" Cheat Sheet command to expand it.

4.) Select "ControlCommand("Speech Recognition", PauseOn)", and make this the first line of the script,

User-inserted image


5.) Then right click again, select "ControlCommand("Speech Recognition", PauseOff), and make this on the last line of the script.

User-inserted image


6.) The final change is to change your "Say("")" or "SayEZB("")" commands to "SayWait("")" or "SayEZBWait("")". This will allow the computer or robot to say the entire sentence, then unpause the recognition.

7.) Save these changes, and now your computer or your robot will no longer hear itself say this phrase.

Other Cheat Sheet options for pausing and unpausing the control, is ControlCommand("Speech Recognition", PauseMS, PauseMS [ms]) where you can set an amount of time to pause the control before it unpauses itself...

Code:

#This pauses the control for 5 seconds.
ControlCommand("Speech Recognition", PauseMS, 5000)



And the Cheat Sheet command ControlCommand("Speech Recognition", PauseToggle) switches the pause control between On and Off when this command is run.

Don't forget, you don't have to right click to find the Cheat Sheet commands, you can also find them under the "Cheat Sheet" tab in the script editor.

User-inserted image