Use the Macintosh speech synthesizer to speak a message.
speak (or say) “the message to speak”
- voice “optional, name of a voice to use ie: moira”
- rate (optional, words per minute ie: 200)
- volume (optional, number between 0 and 1 ie: 0.5)
- pitch (optional, number between 30 and 45 for male, 55 to 65 for female)
- intonation (optional, 0 for monotone, 150 would be silly over exaggerated, not all voices support changing this).
- output name (optional, to send the speech over a sound output other than the default. ie: “generic USB audio output” see the “list available sound outputs” verb to get a list of available sound output names that can be used.)
- output id (optional, like the output name verb but taking the unique ID number of the sound output.)
- without waiting (optional. Normally the next speech phrase will not begin speaking until all previous speech from any application is complete. If you’re sending the output down several different audio outputs and don’t wish to wait for one to finish before starting the next you can add “without waiting” and the next speech will begin as soon as the verb is processed speaking down several outputs at once.)
- callback script (optional, text) the name of a global script to run when the speech is complete.
- callback handler (optional, text) if you’d rather call a specific handler in the callback script rather than just run it include the name of that handler in this parameter. If this parameter is not specified then the global script named will be run normally.
Both verbs also allow adding the optional in (number, seconds to schedule the speech for) parameter.
say “this is delayed fast quiet speech in an Irish accent.” voice “moira” rate “220” volume 0.5 in 5
speech is asynchronous, the script continues immediately and the speech continues in the background. If many phrases to speak overlap they are queued up and spoken one after another. If you accidentally queue up a large number of phrases you can use the Stop Speaking verb to clear the queue.
There is a bug in OSX 10.11 (El Capitan) that keeps airplay sound outputs form showing up or being used as outputs for sound or speech in any application. If you wish to send sound down airplay outputs have a look at scripting “airfoil” to control which outputs it goes down. This bug remains in OSX as of 10.11.4 and has not been fixed by Apple.