How to Use Text-to-Speech from Terminal on macOS

macOS has a feature-rich set of accessibility tools built into its operating system, and one such feature is Text-to-Speech. Most users might interact with it through Siri or Accessibility options in System Settings. However, did you know you can also use this feature directly from the Terminal?

In this blog post, we’ll delve into how you can utilize Text-to-Speech capabilities from Terminal, allowing you to add another tool to your macOS mastery.

Text-to-Speech: A Brief Overview

Text-to-Speech (TTS) technology converts written text into spoken words. It’s a valuable tool for accessibility, learning, multitasking, and many more applications. On macOS, the TTS feature is powered by the inbuilt “say” command.

The ‘say’ Command in Terminal

The Terminal application in macOS allows you to control your Mac using command-line interface. One of the commands it recognizes is “say.” This command uses the macOS Text-to-Speech capabilities to read out loud the text you input.

To use the “say” command:

  1. Open Terminal. You can find it in the Utilities folder within Applications, or search for it using Spotlight (Command + Space).
  2. In the Terminal window, type say followed by your text enclosed in quotation marks. For example, say "Hello, how are you?"
  3. Press enter, and your Mac will read out the text.
macos text to speech command line

Customizing the ‘say’ Command

The “say” command comes with options that let you modify the speech’s voice and speed, and even allow you to save the speech output as an audio file.

Change the Voice

macOS comes with a variety of voices. To change the voice for the “say” command, you use the -v option followed by the name of the voice. For example, say -v Daniel "Hello, how are you?"

Change the Speech Rate

To adjust the speed of the speech, use the -r option followed by the rate (words per minute). For example, say -r 200 "Hello, how are you?"

Save Speech as an Audio File

To save the speech output as an audio file, use the -o option followed by the file path and name. For example, say -o ~/Desktop/test.aiff "Hello, how are you?"

Practical Applications of Terminal Text-to-Speech

While using Text-to-Speech from Terminal might seem like a novelty, it has some practical applications:

  • Reading Long Texts: You can use Terminal Text-to-Speech to read out long texts, allowing you to multitask or rest your eyes.
  • Learning Pronunciations: The “say” command can help you learn how to pronounce words or phrases.
  • Coding & Scripting: For programmers, incorporating the “say” command in scripts can provide audio feedback or notifications.

Conclusion

The Terminal on your Mac is a powerful tool, offering a wealth of commands and features often overlooked by average users. Among these is the “say” command, a hidden gem that opens up the robust Text-to-Speech capabilities of macOS right from the command line.

Whether you’re a power user looking to optimize your workflow or someone interested in exploring the capabilities of your Mac, the “say” command is a fun and useful tool to know.

Similar Posts

Leave a Reply