Voice.speak()
Overview
Uses the engine to speak a sentence or group of words to a user.
Added in version 1.2.104
Use Cases
You want the device to speak to the user.
Format
Voice.speak("{command} phrase");
Parameter | Description | Type | Required |
---|---|---|---|
phrase | A word or group of words to read to the task worker. | String | Required |
command | Instructions for how to read the word or words. | String | Optional |
Commands
These commands are not the same as the commands that can be used for keypresses. They can only be used with the Voice.speak function.
Command | Description |
---|---|
{readmode:sentence} | Reads the string as words and sums. For example it would read the following phrase as words: "Hello world". Numbers are read: "one thousand two hundred thirty four". |
{readmode:character} | Reads the string as individual letters and numbers. For example, it would spell out the following phrase: "H-E-L-L-O-W-O-R-L-D". Numbers are read: "one two three four". |
{cadence:50%} | Increases or slows down the rate of speech. The default value is 100%. |
{cadence:75%} | |
{cadence:100%} | |
{cadence:150%} | |
{cadence:200%} | |
{pause:short} | Injects a short pause between words or letters. The duration of this command is 250 milliseconds, or 0.25 second. |
{pause:medium} | Injects a short pause between words or letters. The duration of this command is 500 milliseconds, or 0.5 second. |
{pause:long} | Injects a short pause between words or letters. The duration of this command is 1000 milliseconds, or 1 second. |
{reset} | Resets the speech settings to the default values. |
Example 1
Copy
/* Speaking text from the screen back to the task worker.
*/
var text = "{readmode:character}" + Screen.getText(12, 5, 20);
Voice.speak(text);
Example 2
Copy
/* Speaking text from the device back to the task worker.
*/
Voice.speak('{cadence:75%}Hello World');