Say:
Filter:
say (extension) | Speech Synthesis

Say
ExtensionExtension

speak text with OSX system voices

Description

Say replaces the deprecated OSX speech synthesis used in SuperCollider, Speech. Because the underlying commandline program 'say' is quite different, Say does not work as a straight replacement, but instead allows access to the options of the 'say' program.

'say' is a commandline program in macOS, and thus does not generate sound on the server. Nonetheless, there are two ways to get say-based sound into SC servers:

1. Patching e.g. the system audio output to an audio input (by hardware of by software) and thus routing Say-produced (mono) sound into the server for processing.

2. Using the SayBuf class to render text as spoken soundfiles, and play those with buffers as full audio sources in SC.

macOS provides a wide variety of voices for many languages that you are free to install and use, see System Preferences/Accessibility/Speech.

Example files:

Which voices?

Basic text reading methods

NEW Features in Say : (compared to Speech/speak)

1. .say any object:

2. use events and patterns to create strings to be spoken :

3. find and access voices by languages

4. find voices by name of language:

5. render spoken text to buffers, to use them as sound sources in SC:

Class Methods

.voices

the list of the available normal voices

.voiceNames

the list of names of the available normal voices

.allVoices

the list of all available voices

.allVoiceNames

the list of names of all available voices

.fxVoices

the list of the available fxVoices (the "funny" older voices provided by Apple.)

.fxVoiceNames

the list of names of all fxVoices

.allLangs

the list of all short lang name symbols

.allLangNames

the list of all long langName strings

.voicesByLang

return all voices found for the given lang name in optional argVoices (or voices or allVoices). Say.voicesByLang(\en)

.getDefaultVoice

get the current system voice name from macOS defaults (or nil if not set)

.defaultVoiceName

get the system default voice name (cached from last call to .getDefaultVoice)

.findVoice

find voice for given name. When default is true and vocie not found, replace with defaultVoice

.sayVoiceName

say given voice name and its language symbol

.sayVoiceNames

find and say all voice names for a language

.at

return the voice dict at <name>.

.isValidVoice

check whether a symbol is a valid voice name.

.isValidLang

check whether a symbol is a valid language name.

Safety methods

NOTE: The Say program can choke when too many say commands are requested at the same time, making a system restart (or at least user logout/login) necessary. The maxPIDs variable protects against this: additional say commands will be ignored (and posted).

.maxPIDs

get and set the maximum number of say commands that will be processed at the same time. The default value of 10 is quite cautious; on a 2018 MacBook Pro, 32 still works fine. You can tune this for your system,

.pendingPIDs

the current number of say commands in process, used to check safety.

NOTE: The say program handles rate commands a bit clumsily: rates outside the accepted range do not clip at the maximum, but fall back to normal rate! The methods clipRate, minRate, maxRate address this.

.clipRate

get and set flag whether rate values will be clipped.

Say.maxRate

.minRate

.maxRate

get and set current maximum say rates (in syllables per second). Default normal rate for current systems (10.11 .. 10.14) voices is 180, minRate is 90, maxRate is 720.

Examples