Home

Awesome

npm version license

<!-- START doctoc generated TOC please keep comment here to allow auto update --> <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->

Contents

<!-- END doctoc generated TOC please keep comment here to allow auto update -->

voices — TTS CLI for macOS

[IMPORTANT: PARTIALLY BROKEN AS OF macOS Sonoma (14): many installed voices aren't recognized, and the default voice isn't listed with -l]

voices is a macOS CLI for changing the default TTS (text-to-speech) voice and for printing information about and/or speaking text with multiple voices.

voices complements the standard say utility by:

Caveats:

See the examples below, concise usage information further below, or read the manual.

Additionally, two macOS Services are offered:

Note: If you have Alfred with its Power Pack, consider workflow speak.awf as a superior alternative.

Examples

  # List all active voices; add -a to list all installed ones.
voices -l

  # Print information about the default voice and speak its demo text.
voices -d -k

  # Print information about voice 'Alex'.
voices alex

  # Make 'Alex' the new default voice, print information about it, and
  # speak text that announces the change.
voices -k'The new default voice is Alex.' -d alex

  # List languages for which at least one voice is active.
voices -L

  # List active French voices.
voices -l fr

  # Print information about all active voices and speak
  # their respective demo text.
voices -l -k

  # Print information about all active Spanish voices and speak their
  # respective demo text.
voices -k -l es
  
  # Say "hello", first with voice Alex, then with Jill, suppressing printed
  # output.
voices -k"hello" -q alex jill

Installation

Supported platforms

Verified to work from OS X 10.8 (Mountain Lion) up to macOS 10.12 (Sierra).

The change-the-default-voice feature makes use of undocumented system internals, so its future compatiblity is uncertain. Do let me know if you find the feature broken in a future macOS version.

Installation from the npm registry

<sup>Note: Even if you don't use Node.js, its package manager, npm, works across platforms and is easy to install; try curl -L http://git.io/n-install | bash</sup>

With Node.js installed, install the package as follows:

[sudo] npm install voices -g

Note:

Manual installation

Usage

Find concise usage information below; for complete documentation, read the manual online, or, once installed, run man voices (voices --man if installed manually).

<!-- DO NOT EDIT THE FENCED CODE BLOCK and RETAIN THIS COMMENT: The fenced code block below is updated by `make update-readme/release` with CLI usage information. -->
$ voices --help


Get or set or speak with the DEFAULT VOICE:

    voices [<options>] [-d [<newDefaultVoice>]]

LIST INFORMATION about / speak with voices:

    voices [<options>] <voice>...

List / speak with ALL VOICES, optionally FILTERED BY LANGUAGES:

    voices [<options>] -l [<lang>...]

LIST LANGUAGES among voices:

    voices -L [-a]

MANAGE VOICES in System Preferences:

    voices -m

Shared options (synopsis forms 1-3):

    -a          target all installed voices (default: only active ones)
    -k          speak demo text with all targeted voices
    -k"<text>"  speak specified text
    -k-         speak text provided via stdin
    -b          output format: print voice names only
    -i          output format: print voice internals
    -q          quiet mode: no printed output

Standard options: --help, --man, --version, --home

macOS Service for switching between default voices

This service, which uses an embedded copy of voices, is helpful if you use text-to-speech in two or more languages and want to quickly switch the default voice between multiple designated voices cyclically, in combination with the built-in speak-selected-text service.

Every time the service is invoked, the next designated voice is made the default voice, and the localized name of the new voice's language is spoken to confirm the change (this is configurable).

You can invoke the service from any application's standard Services menu, category General, or assign it a keyboard shortcut via System Preferences > Keyboard > Shortcuts > Services.

Installation

Customization

macOS Service for speaking selected text with a specific voice

This service provides an alternative to switching the default voice: it speaks selected text in the frontmost application with a fixed alternate voice, which allows it to be used alongside the built-in speak-selected-text service, which always uses the default voice (see System Preferences > Dictation & Speech > Text to Speech).

Typically, you would use this service to speak selected text with a voice that speaks a different language.

You can invoke it from the standard Services menu, category Text, whenever text is selected in the frontmost application, or assign it a keyboard shortcut via System Preferences > Keyboard > Shortcuts > Services; e.g., ⌥` (Opt-`) to parallel the default shortcut for the built-in service, ⌥⎋ (Opt-Esc).

Invoking the service again while text from a previous invocation is still being spoken aborts speaking.
Caveat: This only works if text - any text - is selected in the activate applciation at the time the service is invoked again.

If desired, you can duplicate the service so as to be able to speak with one of multiple alternate voices:
Once installed, duplicate ~/Library/Services/Speak With Specific Voice.workflow in Finder, give it a meaningful name, and customize the duplicate as described below.

Installation

Customization

<!-- DO NOT EDIT THE NEXT CHAPTER and RETAIN THIS COMMENT: The next chapter is updated by `make update-readme/release` with the contents of 'LICENSE.md'. ALSO, LEAVE AT LEAST 1 BLANK LINE AFTER THIS COMMENT. -->

License

Copyright (c) 2015-2018 Michael Klement mklement0@gmail.com (http://same2u.net), released under the MIT license.

Acknowledgements

This project gratefully depends on the following open-source components, according to the terms of their respective licenses.

npm dependencies below have optional suffixes denoting the type of dependency; the absence of a suffix denotes a required run-time dependency: (D) denotes a development-time-only dependency, (O) an optional dependency, and (P) a peer dependency.

<!-- DO NOT EDIT THE NEXT CHAPTER and RETAIN THIS COMMENT: The next chapter is updated by `make update-readme/release` with the dependencies from 'package.json'. ALSO, LEAVE AT LEAST 1 BLANK LINE AFTER THIS COMMENT. -->

npm dependencies

<!-- DO NOT EDIT THE NEXT CHAPTER and RETAIN THIS COMMENT: The next chapter is updated by `make update-readme/release` with the contents of 'CHANGELOG.md'. ALSO, LEAVE AT LEAST 1 BLANK LINE AFTER THIS COMMENT. -->

Changelog

Versioning complies with semantic versioning (semver).

<!-- NOTE: An entry template for a new version is automatically added each time `make version` is called. Fill in changes afterwards. -->