NAME
speech::command
SYNOPSIS
package require TclSpeech ?version?
speech::command ?args?
DESCRIPTION
COMMANDS
speech::continue
speech::pause
speech::speak text ?-key value ...?
speech::speakers
speech::status
speech::stop
speech::voices

NAME

speech::command - Controls the Mac OS Speech Manager for synthetic speech.

SYNOPSIS

package require TclSpeech ?version?
speech::command ?args?

DESCRIPTION

This package gives a high level Tcl interface to the Speech Manager on Mac OS Classic and Mac OS X. It's main purpose is to generate synthetic speech from text. The main command is speech::speak which puts text on a speech queue. The speech queue is a First-In-First-Out stack, and the remaining commands gives the user some control of it.

Important note: This describes version 2.0 of TclSpeech. This version is a complete rewrite of the 1.0 version, and is completely incompatible with any previous versions of TclSpeech.

COMMANDS

speech::continue
If speech has been previously paused using the speech::pause command, speech is continued.

speech::pause
Pauses any ongoing speech. It does not release any resources. Resume speech using the speech::continue command.

speech::speak text ?-key value ...?
Puts the text with associated attributes on the speech queue. If the speech queue is empty, it starts to speak right away. Else, the text is put last in the queue, and is spoken when its turn comes. This command returns immediately, or when the Speech Managers resources have been loaded. It returns an identifier speakinteger which is helpful in callbacks. No UTF translation of the text is performed. A number of options is supported:

-command procName
A Tcl callback procedure that is called when this text starts speaking, and when it has finished. The procedure shall have the following form: procName speechToken what, where what is any of begin or finished. The speechToken is the one returned from this command.

-pitch float
Sets the relative pitch of the voice. It defaults to 1.0.

-rate float
Sets the relative speak rate of the voice. It defaults to 1.0.

-voice voiceName
Sets the name of the voice that shall speak the text. Must be any of the names returned by the speech::speakers command.

-wordcommand procName
A Tcl callback procedure that is called whenever a new word from the text is spoken. The procedure shall have the following form: procName speechToken wordStart wordLength, where wordStart is the character index specifying the words start, and wordLength the number of characters to be spoken. The speechToken is the one returned from this command.

speech::speakers
Returns a list of names of the available voices.

speech::status
Returns any of silent, paused, busy, or speaking describing the status of any speak process. The return value paused is only returned after the command speech::pause has been invoked. Any ongoing speech process returns either busy or speaking.

speech::stop
Stops any ongoing speech, and releases all resources of the complete speech queue.

speech::voices
Returns a list consisting of a list of -key value pairs for each voice on this system. They keys are -age, -comment, -gender, and -name.

Copyright © 2003 Mats Bengtsson