Skip to content

Instantly share code, notes, and snippets.

@quellhorst
Created September 10, 2015 11:42
Show Gist options
  • Save quellhorst/6a01091f27e00bf6f884 to your computer and use it in GitHub Desktop.
Save quellhorst/6a01091f27e00bf6f884 to your computer and use it in GitHub Desktop.
Test all the OSX Voices
#!/bin/sh
for voice in Agnes Kathy Princess Vicki Victoria Alex Bruce Fred Junior Ralph Albert Bad\ News Bahh Bells Boing Bubbles Cellos Deranged Good\ News Hysterical Pipe\ Organ Trinoids Whisper Zarvox;
do say "Hello, I'm ${voice}" -v ${voice};
done
@quellhorst
Copy link
Author

Some Documentation
https://developer.apple.com/library/mac/documentation/UserExperience/Conceptual/SpeechSynthesisProgrammingGuide/Introduction/Introduction.html

SAY(1) Speech Synthesis Manager SAY(1)

NAME
say - Convert text to audible speech

SYNOPSIS
say [-v voice] [-r rate] [-o outfile [audio format options] | -n name:port | -a device] [-f file | string ...]

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

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

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

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

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

   -o out.aiff, --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.

   -n name, --network-send=name
   -n name:port, --network-send=name:port
   -n :port, --network-send=:port
   -n :, --network-send=:
       Specify a service name (default "AUNetSend") and/or IP port to be used for redirecting the speech output through AUNetSend.

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

   --progress
       Display a progress meter during synthesis.

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

       o   A terminfo capability as described in terminfo(5), e.g. bold, smul, setaf 1.

       o   A color name, one of black, red, green, yellow, blue, magenta, cyan, or white.

       o   A foreground and background color from the above list, separated by a slash, e.g. green/black. If the foreground color is omitted, only the background color 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.

AUDIO FORMATS
Starting in MacOS X 10.6, file formats other than AIFF may be specified, although not all third party synthesizers may initially support them. In simple cases, the file format can be inferred from the extension, although generally some
of the options below are required for finer grained control:

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

   --channels=channels
       The number of channels. This will generally be of limited use, as most speech synthesizers produce mono audio only.

   --bit-rate=rate
       The bit rate for formats like AAC. To obtain a list of valid bit rates, specify '?' as the rate. In practice, not all of these bit rates will be available for a given format.

   --quality=quality
       The audio converter quality level between 0 (lowest) and 127 (highest).

ERRORS
say 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 Alex -o hi -f hello_world.txt
say --interactive=/green spending each day the color of the leaves
say -o hi.aac 'Hello, [[slnc 200]] World'
say -o hi.m4a --data-format=alac Hello, World.
say -o hi.caf --data-format=LEF32@8000 Hello, World

      say -v '?'
      say --file-format=?
      say --file-format=caff --data-format=?
      say -o hi.m4a --bit-rate=?

SEE ALSO
"Speech Synthesis Programming Guide"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment