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.

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

   -a ID, --audio-device=ID
   -a name, --audio-device=name
                 Specify, by ID or name prefix, an audio device to be used to play the audio.
                 To obtain a list of audio output devices, specify '?' as the device name.

   -i, --interactive, --interactive=markup
           Print the text line by line during synthesis, highlighting words as they are spoken.
           Markup can be one of:

           •   A terminfo capability as described in terminfo(5), e.g. bold, smul, setaf 1.
           •   A colour name, one of black, red, green, yellow, blue, magenta, cyan, or white.
           •   A foreground and background colour from the above list, separated by a slash, e.g. green/black.
               If the foreground colour is omitted, only the background colour is set.

       If markup is not specified, it defaults to smso, i.e. reverse video.

       If the input is a TTY, text is spoken line by line, and the output file, if specified, will only
       contain audio for the last line of the input.  Otherwise, text is spoken all at once.
       
   --progress    Display progress during synthesis: % done, elapsed time & bytes.

   --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.

   --channels=channels
                 The number of channels. This will generally be of limited use, as most synthesizers
                 produce mono audio only, so selecting 2 channels will save the same data to each channel
                 doubling the output file size.

   --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.

   --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: --file-format='?'

   --data-format=format
            The format of the audio data to be stored. default=linear PCM.
            Formats other than linear PCM are specified by giving their format identifiers (aac, alac).
            Linear PCM formats are specified as a sequence of:

           Endianness (optional)
               One of BE (big endian) or LE (little endian). Default is native endianness.

           Data type
               One of F (float), I (integer), or, rarely, UI (unsigned integer).
               The default setting are; sample size: 16 bit integer,  sample rate: 22KHz.

           Sample size,
               One of 8, 16, 24, 32, 64. Valid float bitdepths are 32 and 64

           Most available file formats only support a subset of these sample formats.

           To obtain a list of audio data formats, specify --data-format=''

           The format identifier optionally can be followed by @samplerate and /hexflags for the format.

   --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).

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.

Both Apple silicon and Intel-based Mac computers use little-endian format.[×] This has no effect on the files used by applications, AIFF files are most often big-endian. Since OS10.4.9, some Apple apps changed the byte order of their aiff files from big endian to little endian, actually AIFF-C. WAVE or .WAV formats are always big-endian.

On modern hardware, say can produce around 2 hours of audio in around 1 minute.

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.

Errorlevels

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

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"

$ say -o output.aiff -f input.txt --progress

$ say -o output.wave -f input.txt --progress

$ say -o outputfloat32.aiff -f input.txt --data-format=BEF32 --progress

$ say -o outputfloat32.aiff -f input.txt --data-format=BEF32@32000 --progress

$ say -o outputint8.aiff -f input.txt --data-format=BEI8 --progress

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

Related macOS commands

Local man page: say - Command line help page on your local machine.
echo - Display message on screen.
pr - Convert text files for printing.
textutil - Manipulate text files in various formats.
hear - Speech to text utility (transcribe) from Sveinbjorn Thordarson.
macOS VoiceOver - Apple.com accessibility page.
wall - Write a message to users.
Windows PowerShell: Add-Type System.Speech


 
Copyright © 1999-2025 windevcluster.com
Some rights reserved