Speak text aloud with the system's text-to-speech voices, and send announcements to VoiceOver.
hs.speech.speak() queues speech on a shared speaker, so quick messages are spoken one after
another rather than over each other. Call hs.speech.stop() to silence it and clear the queue.
For independent queues with their own voice and rate, create speakers with hs.speech.create().
Voices, including enhanced and premium ones, are downloaded in
System Settings → Accessibility → Spoken Content → System Voice → Manage Voices.
Personal Voices, which sound like the user, are listed and can be spoken with once
hs.permissions.requestPersonalVoice() has been granted.
Quick start
hs.speech.speak("Hello from Hammerspoon")
// Wait for speech to finish hs.speech.speak("Battery low").then(finished=>console.log("Done: " + finished))
// Interrupt whatever is being said hs.speech.stop() hs.speech.speak("Urgent message")
// If VoiceOver is running, have it speak in the user's VoiceOver voice // (see announce() for the VoiceOver settings this needs) if (hs.speech.isVoiceOverRunning) hs.speech.announce("Build finished")
Speak text aloud with the system's text-to-speech voices, and send announcements to VoiceOver.
hs.speech.speak()queues speech on a shared speaker, so quick messages are spoken one after another rather than over each other. Callhs.speech.stop()to silence it and clear the queue. For independent queues with their own voice and rate, create speakers withhs.speech.create().Voices, including enhanced and premium ones, are downloaded in System Settings → Accessibility → Spoken Content → System Voice → Manage Voices. Personal Voices, which sound like the user, are listed and can be spoken with once
hs.permissions.requestPersonalVoice()has been granted.Quick start