macOS text/speech FAQ: What do you know about Mac OS X text to speech voice capabilities, including using AppleScript to convert text to speech?
I’m goofing around currently, using the very cool Mac text to speech capability. Okay, really, what I’m doing is writing an AppleScript iTunes alarm clock program to wake me up in the morning, and in the process I started digging into this Mac text to speech stuff, using AppleScript.
Mac OS X text to speech using AppleScript
As I started digging into the Mac text to speech capability I learned that there are a number of voices built into Mac OS/X, which is very cool. If you ever want to use this text-to-speech functionality, here's a list of the voices built into the system:
# new on Mac OS X 10.6 (Snow Leopard) Alex # all these voices are available on Mac OS X 10.5 # good female voices Agnes Kathy Princess Vicki Victoria # good male voices Bruce Fred Junior Ralph # other voices Albert Bad News Bahh Bells Boing Bubbles Cellos Deranged Good News Hysterical Pipe Organ Trinoids Whisper Zarvox
You can experiment with these voices on your Mac OS X system by choosing System Preferences, Speech, then clicking the "Text to Speech" tab. Now choose a value for the System Voice, and then press the Play button. You can keep changing the System Voice and clicking the Play button to here samples of what each voice sounds like.
Mac text to speech AppleScript example
As part of my AppleScript alarm clock programming effort, I'm starting my "wake up" effort with some computer voices. Here's what the first part of my AppleScript program looks like:
say "Good morning Al." using "Whisper" delay 2 say "Al, it's time to rise and shine." using "Fred" delay 1 say "The current time is" using "Vicky" say (time string of (current date)) using "Vicky" delay 2 say "Wake up sleepy head" using "Trinoids" delay 2 say "You asked us to wake you up at this time." using "Victoria" delay 2 say "It's time to wake up, it's time to wake up!" using "cellos"
If you want to run this on your Mac, just go to your Applications folder, open the AppleScript folder, then start the Script Editor. Copy and paste the text above into your Script Editor, then press the Run button. You should hear each of the phrases above spoken by your computer.
(What I'm actually getting around to is starting off with initial text like this, and then launching iTunes at whatever time I specify in the morning ... but I'll save that for another blog entry.)