The speech library provides functions for speech synthesize on macOS, iOS and Android devices.
To include the library in your standalones, include the
Speech Library
in the Inclusions pane of the standalone settings
stack.
Before starting to use the library it must be initalized. For example:
on preOpenStack
speechInitializeLibrary
end preOpenStack
on speechLibraryInitialized pSuccess
if pSuccess then
speechSpeakUtterance "Ready"
end if
end speechLibraryInitialized
Once initialized the library functions may be used to alter the voice used by the library to speak utterances:
speechSetRate
command can increase or reduce the speed the voice
speaks.speechSetPitch
command can raise or lower the overall pitch of the
voice.speechSetVoice
command can be ued to select a voice other than the
system default. Use the array returned by speechGetVoices
to find an
appropriate voice for the locale.The speechSpeakUtterance
command can be used to synthesize text using the
current voice properties. For example:
local sTimeoutMsg
on openCard
send "hurryUp" to me in 10 seconds
put the result into sTimeoutMsg
end openCard
on mouseUp
cancel sTimeoutMsg
end mouseUp
on hurryUp
speechSpeakUtterance "Hurry up and click the button"
end hurryUp