Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
In this movie we'll learn how to use the Mac's text-to-speech functionality from the command line. We can type something and then our Mac will save it for us. Now before we start making our Mac talk, be sure to check your computers volume level make sure it's not set a something too high. The way that we are going to do it is using the Mac only Unix command say, and then after that we'll tell it what we wanted to say, so we're going to have "Unix is awesome". (Computer voice: Unix is awesome.) That's it there is all there is to it. Now the voice that is talking in is the voice that set as the default voice for your Mac. There are also other voices as well.
We go into the Finder hold down Command+Shift+U it will open up the Utilities folder and then right below Terminal you see there something called VoiceOver Utility. If you open that up and you click on the Speech option, you'll see that what the default voice is set out and you can click on this and see list of all the choices for all the voices that you can pick. If you want to use a different voice from the command line you can do it on a per command basis so we could have say hello and then use the -v option to specify the voice, so let's say with Vicki. (Female computer voice: Hello.) Or Fred. (Male computer voice: Hello.) Or Whisper. (Male computer voice whispering: Hello.) Or Zarvox. (Computer voice: Hello.) So you can have fun playing with that, trying all those out.
In addition to saying a single string we also have the ability to pipe in input. So here I'm taking a string from echo. But it could really come out of any command at all. Pipe it in to say and we can have it them say it. (Computer voice: Dumm dee dee dum dee dee dum.) Or you can have a read from a file. I've got a file on here just called shakespeare.txt, just a simple Shakespeare sonnet. I can say that with the -f option, so the shakespeare.txt. (computer voice: Shall I compare thee to a summer's day? Thou art more lovely and more temperate.) And Ctrl+C will exit out, if you want or need to break out of that. Remember that you don't have to listen to the whole thing.
In addition to reading in content from a file, you can also send the text-to-speech output to a sound file by using the -o option. It's not exactly books on tape quality, but for someone who is visually impaired this could be really useful. Another handy technique is to use say as a notification that'll long- running process has completed. Just put it immediately after the command using a semicolon then go to work on something else while your process runs. When it's done you'll get an audio message letting you know that its finished. And then lastly you can have some fun with this.
Wait until someone steps away from their computer then ran a command like the last one to make them think that their computer is talking to them.
Get unlimited access to all courses for just $25/month.Become a member
82 Video lessons · 97204 Viewers
61 Video lessons · 84490 Viewers
71 Video lessons · 68700 Viewers
56 Video lessons · 101178 Viewers
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.
Your file was successfully uploaded.