Jump to content
mklement0

[OBSOLETE] Say - Speak Text - using multiple voices in sequence, filter by language, set default voice, ...

Recommended Posts

[OBSOLETE - superseded by speak.awf]

 

Uses OS X’s TTS (text-to-speech) feature to speak text aloud.

 

It is especially useful if you handle many voices, possibly in multiple languages - note that OS X allows on-demand download of voices in other languages.

 

Examples

 

say                                   # Speak the default voice's demo text.
say I speak, therefore I am.          # Speak the specified text with the default voice.
 

  Selection by voice name

say @                                 # Show list of active voices on typing @; submit to speak demo text in all voices.

say @alex                             # Press Opt-Return to make Alex the default voice.

say @alex I'm Alex                    # Speak "I'm Alex" with voice Alex.

sayalex I'm Alex.                     # ditto

say I'm Alex @alex                    # ditto

say First Alex, then Jill. @alex,jill # Speak first as Alex, then as Jill.

 

  Selection by language

say #es                               # Show list of Spanish voices, regardless of regional accent; i.e., both 'es_ES' (Spain) and 'es_MX' (Mexico)

say y ahora en español #es            # Speak text with Spanish voices.

say Pottery #enie,enza                # Speak text with Irish and South African English voices.

 

Download

 

Features

 

Aside from speaking text with the default voice, offers the following features:

  • Voice selection, optionally with voice-name and target-language filtering.
  • Ability to speak text in sequence with multiple voices.
  • Rich, dynamic feedback (name of default voice, voice languages, demo text).
  • Have selected voices speak their demo text.
  • Makes Alfred redisplay with the same query for interactive experimentation.
  • Make a new voice the default voice directly from Alfred.
  • Option to open System Preferences to manage voices and TTS options.
  • Option to use a hotkey to speak the selected text in any application using the default voice (while OS X has such a feature built in, using Alfred is preferable in that it also works with non-native applications).

Dependencies

  • Developed and tested on OS X 10.8.3; possibly works on 10.7 and 10.6, too.

Usage

 

Note: The workflow uses the set of active voices, as defined in System Preferences.

Active voices are those selected for active use, and are typically a subset of the installed voices. Thus, if you want to make an installed voice available to the workflow, make sure it is checked when you go to System Preferences > Dictation & Speech, anchor Text to Speech, list System voice:, and select list item Customize....

 

Omitting text always speaks the demo text for each voice.

 

The workflow uses a single keyword, say:

 

Speak text with default voice

 

Simply specify the text to speak; e.g.

  say I speak, therefore I am.

  • To speed things up, no voices are offered by default; type @ or # before or after the text to speak to show the list of active voices (see below).
  • Using single and double quotes, even unbalanced, is supported.
  • After submitting a command, Alfred redisplays with the same query to facilitate experimentation.

Speak text with voice selection / filtering

  • Type @ or # before or after the text to speak to see the list of active voices.
  • Type @{voiceNameOrPrefix} to filter the list of active voices by name; e.g.:
    @alex
    Optionally, you can append the name directly to the keyword (no space); e.g.:
    sayAlex
    Matching is case-sensitive; omit spaces for voice names with embedded spaces.
  • Type #{langIdOrPrefix} to filter the list of active voices by language ID; e.g.:
    #en
    If you just type #, you’ll see the language identifier of each voice in parentheses.
    Matching is case-sensitive; you can omit the _ character, e.g., enus to match en_US.
  • You can even use multiple, ,-separated specifiers; e.g.:
    @alex,jill

You only need to type as much of a name or language as is necessary to filter the list down to the desired result. You can also auto-complete based on the selected result, but this only works for single-token specifiers.

 

Whenever more than one voice matches, the first result item offers to speak the specified (or demo) with all matching voices, in sequence.

 

 

 

Make a voice the default voice

 

Whenever a specific voice is selected in the result list, simply hold down Option while pressing Return to make that voice the default voice.

A notification will indicate success.

 

Configuration

 

Typing just say, with no arguments, shows an additional command:

 

Manage Voices

 

Opens the System Preferences application’s Dictation & Speech pane where the set of active voices - including on-demand download of additional voices - and other TTS options can be managed.

 

Bonus track: CLI voice

 

The workflow folder contains a command-line utility named voice, which can be used stand-alone to provide much of the functionality the workflow offers, notably the ability to change the default voice and to speak text using multiple voices.
Invoke it with -h for help.

 

Changelog

  • 0.1 (20 May 2013): initial release
Edited by mklement0

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...