say

From RaySoft

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.[1]

Documentation

Syntax

 say [PARAMETER ...] [-f FILE|STRING ...]

Parameters

--data-format=FORMAT
The FORMAT of the audio data to be stored. 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).
Sample size
One of 8, 16, 24, 32, 64.
Most available file formats only support a subset of these sample formats.
To obtain a list of audio data formats for a file format specified explicitly or by file name, specify ? as the format name.
The format identifier optionally can be followed by @SAMPLERATE and /HEXFLAGS for the format.
-f FILE, --input-file=FILE
Specify a FILE to be spoken. If file is - or neither this parameter nor a message is specified, read from standard input.
-o FILE, --output-file=FILE
Specify the path for an audio file to be written. AIFF is the default and should be supported for most voices, but some voices support many more file formats.
--progress
Display a progress meter during synthesis.
-v VOICE, --voice=VOICE
Specify the VOICE to be used. Default is the voice selected in System Preferences. To obtain a list of voices installed in the system, specify ? as the voice name.

Examples

Get Alex's voice
say --voice='Alex' 'Hello World!'
Create a WAVE output file
say --voice='Alex' --output-file="${HOME}/tmp/alex.wav" \
   --data-format='LEF32@8000' 'Hello World!'

References

  1. man 1 'say'