Name

say — text-to-speech

Description

Performs text-to-speech, either speaking text or saving the synthesized speech as a sound file. Can also be used in conjunction with speech recognition to determine what text appears below the microphone window.

Example

tell application "SpeechRecognitionServer"
        set s to listen for {"yes", "no"} with prompt "Would you like me to beep?" ¬
                giving up after 10
end tell
if s is "yes" then
        say "Okay, I will beep now." displaying "Okay."
        beep
else
        say "Okay, then I won't." displaying "Okay."
end if

Get AppleScript: The Definitive Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.