say

Convert text to audible speech.
This tool uses the Speech Synthesis manager to convert input text to audible speech and either play it through the sound output device chosen in System Preferences or save it to an AIFF file.

Syntax
      say [-v voice] [-o out.aiff | -n name:port ] [-f file.in | string ...]

Key

   string   The text to speak on the command line.
            This can consist of multiple arguments, which are
            considered to be separated by spaces.

   --input-file=file
   -f file  A file to be spoken.
            If file is - or neither this parameter nor a message
            is specified, read from standard input.

   --file-format=format
            The format of the file to write (AIFF, caff, m4af, WAVE).
            Generally, it’s easier to specify a suitable file extension
            for the output file. To obtain a list of writable file formats,
            specify '?' as the format name.

   --data-format=format
            The format of the audio data to be stored. default=linear PCM.

   --progress    Display a progress meter during synthesis.

   --rate=rate
   -r rate       Speech rate to be used, in words per minute.

   --voice=voice
   -v voice      The voice to be used: English language = Alex, Daniel, Fiona, Fred, Samantha or Victoria
                 Default is the voice selected in System Preferences | Speech
                 Other voices are available for foreign languages.
   --voice=?     List all available voices.

   --output-file=fileout.aiff
   -o fileout.aiff
                 An AIFF file to be written, some voices support other file formats.

   --channels=channels   The number of channels. Most synthesizers produce mono audio only.
   --bit-rate=rate       The bit rate for formats, default=AAC.specify '?' as the rate.
   --quality=quality     The audio converter quality level between 0 (lowest) and 127 (highest).

   --network-send=name
   -n name

   --network-send=name:port
-n name:port --network-send=:port
-n :port --network-send=:
-n : Specify a service name (default "AUNetSend") and/or IP port to be used for redirecting the speech output through AUNetSend. specify '?' as the device name to obtain a list of audio output devices.

If the input is a TTY, or if no text is specified, the typed input text will be spoken line by line, and the output file, if specified, will only contain audio for the last line of the input. Press Ctrl-C to cancel. Otherwise, text is spoken all at once.

Returns 0 if the text was spoken successfully, otherwise non-zero.
Diagnostic messages will be printed to standard error.

The default voice (and speaking rate) can be set in System PreferencesDictation & Speech.

Some voices are not installed by default, selecting them in System Preferences will cause the voice to be downloaded.

Examples

 say "Hello world"
 say -v Agnes "Isn’t it nice to have a computer that will talk to you?"
 say -v Albert "I have a frog in my throat. No, I mean a real frog!"
 say -v Alex "Most people recognize me by my voice."
 say -v Bad News "The light you see at the end of the tunnel is the headlamp of a fast approaching train."
 say -v Bahh "Do not pull the wool over my eyes."
 say -v Bells "Time flies when you are having fun."
 say -v Boing "Spring has sprung, fall has fell, winter’s here and it’s colder than usual."
 say -v Bruce "I sure like being inside this fancy computer"
 say -v Bubbles "Pull the plug! I'm drowning!"
 say -v Cellos "Doo da doo da dum dee dee doodly doo dum dum dum doo da doo da doo da doo da doo da doo da doo"
 say -v Deranged "I need to go on a really long vacation."
 say -v Fred "I sure like being inside this fancy computer"
 say -v Good News "Congratulations you just won the sweepstakes and you don’t have to pay income tax again."
 say -v Hysterical "Please stop tickling me!"
 say -v Junior "My favorite food is pizza."
 say -v Kathy "Isn’t it nice to have a computer that will talk to you?"
 say -v Pipe Organ "We must rejoice in this morbid voice."
 say -v Princess "When I grow up I’m going to be a scientist."
 say -v Ralph "The sum of the squares of the legs of a right triangle is equal to the square of the hypotenuse."
 say -v Trinoids "We cannot communicate with these carbon units."
 say -v Vicki "Isn’t it nice to have a computer that will talk to you?"
 say -v Victoria "Isn’t it nice to have a computer that will talk to you?"
 say -v Whisper "Pssssst, hey you, Yeah you, Who do ya think I’m talking to, the mouse? "
 say -v Zarvox "That looks like a peaceful planet."
 # List all voices:
 say -v ?

 # List English-speaking voices:
 say --voice='?' |grep "en[_-]"

 say -v Moira "i like whisky"
 say -v Moira -o whisky.aiff "i like whisky"

 say -f myfile.txt
or
 cat myfile.txt | say

 cat myfile.txt | say -o MyAudioFile.aiff

$ ./long-running-script ; say "Your Script has finished running"

“We're nothing but the stories we tell ourselves” ~ Michael Montoure

Related macOS commands

echo - Display message on screen.
pr - Convert text files for printing.
textutil - Manipulate text files in various formats.
macOS VoiceOver - Apple.com accessibility page.
wall - Write a message to users.
Windows PowerShell: Add-Type System.Speech


 
Copyright © 1999-2024 SS64.com
Some rights reserved