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. The available voices tend to change with major macOS updates.
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).
Wav files are big endian, as are original AIFF files, iTunes created .AIFF files are
little endian AIFF-C. 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.
Audio Interchange File Format (AIFF) is an audio file format developed by Apple Inc. The audio data in most AIFF files is uncompressed pulse-code modulation (PCM), much the same as a WAV file.
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 Preferences âžž Dictation & Speech.
The options for --bit-rate and --quality will in many cases just upsample the file increasing the file size without improving the sound quality beyond the native sample rate. Many macOS voices are sampled at around 11 KHz. Rates below around 4 Khz are likely to be distorted.
Some voices are not installed by default, selecting them in System Preferences will cause the voice to be downloaded.
Returns 0 if the text was spoken successfully, otherwise non-zero.
Diagnostic messages will be printed to standard error.
say "Hello world" say -v Albert "Hello I'm Albert how are you?" say -v Amélie "Bonjour I'm Amélie how are you?" say -v Daniel "Hello I'm Daniel how are you?" say -v Fred "Hello I'm Fred how are you?" say -v Karen "Hello I'm Karen how are you?" say -v Meijia "Hello I'm Meijia how are you?" say -v Melina "Hello I'm Melina how are you?" say -v Moira "Hello I'm Moira how are you?" say -v Nora "Hello I'm Nora how are you?" say -v Samantha "Hello I'm Samantha how are you?" say -v Sinji "Hello I'm Sinji how are you?" say -v Tessa "Hello I'm Tessa how are you?" say -v Trinoids "Hello I'm Trinoids how are you?" say -v Vani "Hello I'm Vani how are you?" say -v Xander "Hello I'm Xander how are you?" say -v Yelda "Hello I'm Yelda how are you?" say -v Yuna "Hello I'm Yuna how are you?"
# List all voices: say -v ? # List English-speaking voices: say --voice='?' |grep "en[_-]" say -v Samantha "i like running"
say -v Moira -o run.aiff "i like running"
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.WAV -f input.txt --data-format=LEF32@22050 --progress
$ say -o outputint8.aiff -f input.txt --data-format=BEI8 --progress
“We're nothing but the stories we tell ourselves” ~ Michael Montoure
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