--- layout: page category-title: Basic commands category-page: basic tags: say author: Gianmarco De Vita title: say previous-page: pages/cmd/basic/man.html ---
You can convert text into audible speech just by writing the command
say
followed by a string.
This is possible thanks to the Speech Synthesis manager on Mac OS.
say stringNaturally, the wide presence of flags for this command allows you to use this command for many different tasks. Notice that using more flag simultaneously, you will be able to solve more complex operations.
-f
and, instead
of the string, by the path of a text file, you will get as output a voice
reading the content of that file.
say -f path/text.txt
-v
followed by a person name and a string, you
can decide which voice should read the string.
say -v name stringOf course, you're not expected to know every possible voice, so, by writing a string (eg: "Hello world") as argument of the command (including also the flag -v), you will get a list of all the available voices.
say -v "Hello world"
-r
followed by a rate and then by a
string, you can decide the reading speed in words per minute.
ay -r rate string
-o
followed
by the path/name of the output file and then the string that has to be read.
say -o path/audiofile.*format stringAs said above, you can use more flags in the same command, once you know well them. See the examples below and try to guess the output. You can copy these commands into your terminal to verify your answers. Naturally, you have to create the text files if they don't exist (with some text inside), to make the work.
say -v Alex -f hello_world.txt
say -o hi.aac -f hello_world.txt