ARC Pro

Upgrade to ARC Pro

Become a Synthiam ARC Pro subscriber to unleash the power of easy and powerful robot programming

waitForSpeechRange

Audio.waitForSpeechRange(timeout, start, end, [increment])

Parameters

timeout Time to wait in seconds before stopping waiting for speech.
start numeric start value of the range
end numeric end value of the range
increment the increment of the range (optional)

Returns

The value within the range as a number or the word "timeout" if timeout is reached.

Description

Suspends execution of the script until one of the numbers within the range (start, end) is detected in the microphone, or a timeout occurs after timeout seconds. If a timeout occurs, the method will return "timeout".

If the number of options within the range is less than 10, each option will be displayed. For example, if the start is 10, and the end is 20, that means there will be 10 options so each option will be displayed.


If there are more than 10 options, the range will be displayed. 


*Note: the returned value is a number (i.e. 23, 10, 5) and not a string (i.e. twenty three, ten, five)

Example

// Get a number from the user within the range between 10 and 20
response = Audio.waitForSpeechRange(10, 10, 20);
Audio.say("You selected " + response);

// Get a number from the user within the range between 10 and 20 incremented by 2 (every even number)
response = Audio.waitForSpeechRange(10, 10, 20, 2);
Audio.say("You selected " + response);