Servo Script icon Servo Script — Bind scripts to servo moves (V1-V99); triggers on position/speed/accel changes and provides ports, positions and speeds arrays for custom control. Try it →
 

Waitforanynumberspeech

Audio.waitForAnyNumberSpeech(timeout, prompt)

Parameters

timeout Time to wait in seconds before stopping waiting for speech.
prompt The text prompt to display to the user while listening for speech

Returns

The number heard if the timeout did not occur in a lowercase string.

Description

Suspends execution of the script until any number is detected in the microphone or a timeout occurs after timeout seconds. If a timeout occurs, the method will return "timeout" in lowercase. The number can include a minus sign and a decimal point. 


Example

// Listen for any response from the user
response = Audio.waitForAnyNumberSpeech(30, "Give me a number");

print("Heard: " + response);