macOS: Text to Speech Command - say examples


If you want to covert text to speech on your macOS Terminal you can make use of say command,

Syntax:
say [-v voice] [-f file | string ...]


Example 1: Text to speech using string
% say "Hello therehow are you?"


Example 2: Text to speech using string and a female voice Alice
% say -v Alice "Hello, my name is Alice!"


Example 3: Text to speech using text from file and a female voice Alice
% say -v Alice -f my-speech-text.txt
bash-3.2$ echo "This message has been read from an external file" > my-speech-text.txt
bash-3.2$ say -v Alice -f my-speech-text.txt
bash-3.2$ 
macOS Terminal read text to speech from external file
Advertisements
Try Out Code2care Dev Tools:

Advertisements

Advertisements
Code2care is an initiative to publish and share varied knowledge in programming and technical areas gathered during day-to-day learnings and development activities.

Students and software developers can leverage this portal to find solutions to their various queries without re-inventing the wheel by referring to our easy to understand posts. Technical posts might include learnings, tutorials, trouble-shooting steps, video tutorials, code snippets, how-to, blogs, articles, etc.

🎉 We are celebrating the 10th years of Code2care! Thank you for all your support!

We strongly support Gender Equality & Diversity.