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 higher 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 |
|
Source | extensions/speech/libspeech.m line 249 |
Signature | hs.speech.availableVoices([full]) -> array |
---|---|
Type | Function |
Description | Returns a list of the currently installed voices for speech synthesis. |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/speech/libspeech.m line 219 |
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 |
|
Source | extensions/speech/libspeech.m line 270 |
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 |
|
Source | extensions/speech/libspeech.m line 295 |
Signature | hs.speech.new([voice]) -> synthesizerObject |
---|---|
Type | Constructor |
Description | Creates a new speech synthesizer object for use by Hammerspoon. |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/speech/libspeech.m line 315 |
Signature | hs.speech:continue() -> synthesizerObject |
---|---|
Type | Method |
Description | Resumes a paused speech synthesizer. |
Parameters |
|
Returns |
|
Source | extensions/speech/libspeech.m line 687 |
Signature | hs.speech:isPaused() -> boolean | nil |
---|---|
Type | Method |
Description | Returns whether or not the synthesizer is currently paused. |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/speech/libspeech.m line 777 |
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 |
|
Source | extensions/speech/libspeech.m line 743 |
Signature | hs.speech:modulation([modulation]) -> synthesizerObject | modulation | nil |
---|---|
Type | Method |
Description | Gets or sets the pitch modulation for the synthesizer's voice. |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/speech/libspeech.m line 890 |
Signature | hs.speech:pause([where]) -> synthesizerObject |
---|---|
Type | Method |
Description | Pauses the output of the speech synthesizer. |
Parameters |
|
Returns |
|
Source | extensions/speech/libspeech.m line 611 |
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 |
|
Source | extensions/speech/libspeech.m line 717 |
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 |
|
Source | extensions/speech/libspeech.m line 811 |
Signature | hs.speech:pitch([pitch]) -> synthesizerObject | pitch | nil |
---|---|
Type | Method |
Description | Gets or sets the base pitch for the synthesizer's voice. |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/speech/libspeech.m line 848 |
Signature | hs.speech:rate([rate]) -> synthesizerObject | rate |
---|---|
Type | Method |
Description | Gets or sets the synthesizers speaking rate (words per minute). |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/speech/libspeech.m line 420 |
Signature | hs.speech:reset() -> synthesizerObject | nil |
---|---|
Type | Method |
Description | Reset a synthesizer back to its default state. |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/speech/libspeech.m line 932 |
Signature | hs.speech:setCallback(fn) -> synthesizerObject |
---|---|
Type | Method |
Description | Sets or removes a callback function for the synthesizer. |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/speech/libspeech.m line 498 |
Signature | hs.speech:speak(textToSpeak) -> synthesizerObject |
---|---|
Type | Method |
Description | Starts speaking the provided text through the system's current audio device. |
Parameters |
|
Returns |
|
Source | extensions/speech/libspeech.m line 545 |
Signature | hs.speech:speaking() -> boolean |
---|---|
Type | Method |
Description | Returns whether or not this synthesizer is currently generating speech. |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/speech/libspeech.m line 477 |
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 |
|
Source | extensions/speech/libspeech.m line 575 |
Signature | hs.speech:stop([where]) -> synthesizerObject |
---|---|
Type | Method |
Description | Stops the output of the speech synthesizer. |
Parameters |
|
Returns |
|
Source | extensions/speech/libspeech.m line 647 |
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 |
|
Source | extensions/speech/libspeech.m line 351 |
Signature | hs.speech:voice([full] | [voice]) -> synthesizerObject | voice |
---|---|
Type | Method |
Description | Gets or sets the active voice for a synthesizer. |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/speech/libspeech.m line 377 |
Signature | hs.speech:volume([volume]) -> synthesizerObject | volume |
---|---|
Type | Method |
Description | Gets or sets the synthesizers speaking volume. |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/speech/libspeech.m line 446 |