This module provides access to the Speech Synthesizer component of OS X.
The speech synthesizer functions and methods provide access to OS X's Text-To-Speech capabilities and facilitates generating speech output both to the currently active audio device and to an AIFF file.
A discussion concerning the embedding of commands into the text to be spoken can be found at https://developer.apple.com/library/mac/documentation/UserExperience/Conceptual/SpeechSynthesisProgrammingGuide/FineTuning/FineTuning.html#//apple_ref/doc/uid/TP40004365-CH5-SW6. It is somewhat dated and specific to the older MacinTalk style voices, but still contains some information relevant to the more modern higer quality voices as well in its discussion about embedded commands.
Signature | hs.speech.attributesForVoice(voice) -> table |
---|---|
Type | Function |
Description | Returns a table containing a variety of properties describing and defining the specified voice. Parameters:
Returns:
Notes:
|
Signature | hs.speech.availableVoices([full]) -> array |
---|---|
Type | Function |
Description | Returns a list of the currently installed voices for speech synthesis. Parameters:
Returns:
Notes:
|
Signature | hs.speech.defaultVoice([full]) -> string |
---|---|
Type | Function |
Description | Returns the name of the currently selected default voice for the user. This voice is the voice selected in the System Preferences for Dictation & Speech as the System Voice. Parameters:
Returns:
Notes:
|
Signature | hs.speech.isAnyApplicationSpeaking() -> boolean |
---|---|
Type | Function |
Description | Returns whether or not the system is currently using a speech synthesizer in any application to generate speech. Parameters:
Returns:
Notes:
|
Signature | hs.speech.new([voice]) -> synthesizerObject |
---|---|
Type | Constructor |
Description | Creates a new speech synthesizer object for use by Hammerspoon. Parameters:
Returns:
Notes:
|
Signature | hs.speech:continue() -> synthesizerObject |
---|---|
Type | Method |
Description | Resumes a paused speech synthesizer. Parameters:
Returns:
|
Signature | hs.speech:isPaused() -> boolean | nil |
---|---|
Type | Method |
Description | Returns whether or not the synthesizer is currently paused. Parameters:
Returns:
Notes:
|
Signature | hs.speech:isSpeaking() -> boolean | nil |
---|---|
Type | Method |
Description | Returns whether or not the synthesizer is currently speaking, either to an audio device or to a file. Parameters:
Returns:
Notes:
|
Signature | hs.speech:modulation([modulation]) -> synthsizerObject | modulation | nil |
---|---|
Type | Method |
Description | Gets or sets the pitch modulation for the synthesizer's voice. Parameters:
Returns:
Notes:
|
Signature | hs.speech:pause([where]) -> synthesizerObject |
---|---|
Type | Method |
Description | Pauses the output of the speech synthesizer. Parameters:
Returns:
|
Signature | hs.speech:phonemes(text) -> string |
---|---|
Type | Method |
Description | Returns the phonemes which would be spoken if the text were to be synthesized. Parameters:
Returns:
Notes:
|
Signature | hs.speech:phoneticSymbols() -> array | nil |
---|---|
Type | Method |
Description | Returns an array of the phonetic symbols recognized by the synthesizer for the current voice. Parameters:
Returns:
Notes:
|
Signature | hs.speech:pitch([pitch]) -> synthsizerObject | pitch | nil |
---|---|
Type | Method |
Description | Gets or sets the base pitch for the synthesizer's voice. Parameters:
Returns:
Notes:
|
Signature | hs.speech:rate([rate]) -> synthesizerObject | rate |
---|---|
Type | Method |
Description | Gets or sets the synthesizers speaking rate (words per minute). Parameters:
Returns:
Notes:
|
Signature | hs.speech:reset() -> synthsizerObject | nil |
---|---|
Type | Method |
Description | Reset a synthesizer back to its default state. Parameters:
Returns:
Notes:
|
Signature | hs.speech:setCallback(fn | nil) -> synthesizerObject |
---|---|
Type | Method |
Description | Sets or removes a callback function for the synthesizer. Parameters:
Returns:
Notes:
|
Signature | hs.speech:speak(textToSpeak) -> synthesizerObject |
---|---|
Type | Method |
Description | Starts speaking the provided text through the system's current audio device. Parameters:
Returns:
|
Signature | hs.speech:speaking() -> boolean |
---|---|
Type | Method |
Description | Returns whether or not this synthesizer is currently generating speech. Parameters:
Returns:
Notes:
|
Signature | hs.speech:speakToFile(textToSpeak, destination) -> synthesizerObject |
---|---|
Type | Method |
Description | Starts speaking the provided text and saves the audio as an AIFF file. Parameters:
Returns:
|
Signature | hs.speech:stop([where]) -> synthesizerObject |
---|---|
Type | Method |
Description | Stops the output of the speech synthesizer. Parameters:
Returns:
|
Signature | hs.speech:usesFeedbackWindow([flag]) -> synthesizerObject | boolean |
---|---|
Type | Method |
Description | Gets or sets whether or not the synthesizer uses the speech feedback window. Parameters:
Returns:
Notes:
|
Signature | hs.speech:voice([full] | [voice]) -> synthesizerObject | voice |
---|---|
Type | Method |
Description | Gets or sets the active voice for a synthesizer. Parameters:
Returns:
Notes:
|
Signature | hs.speech:volume([volume]) -> synthesizerObject | volume |
---|---|
Type | Method |
Description | Gets or sets the synthesizers speaking volume. Parameters:
Returns:
Notes:
|