news
About Elegant Chaos
info
About me and my friends
people
Software from Elegant Chaos
software
Other stuff...
stuff

Say

Gives access to the speech synthesis facilities provided by Apple's new Speech Manager.

Say XCMD. Version 1.0d7, by Sam Deane. Copyright ©1994 ULTRALAB. Compiled 16:52:53, 28/04/94. Debugging code included.


[last exit to hypercard] [externals index] [download Say]

Description

This XCMD implements a number of commands which provide access to the Appleš Speech Manager.

The XCMD includes commands to create and dispose speech channels, choose voices and settings for them, and to speak text in to them.

In general the syntax is:

   Say "some text..." 
   Say <command> {,<channel> { other params... }}  

The simplest form of the Say command, shown first above, takes a single piece of text , which must be no longer than 255 characters. This text is spoken using the default voice.

To access the more sophisticated and powerful features of the Speech Manager, the second syntax form must be used.

Most Speech Manager commands operate on a sound channel. To make things easy, the XCMD allows you to give each channel that you create a name. When a command needs to refer to a particular channel, you simply pass the channel name in the <channel> parameter. If this parameter is left empty, a default channel is used.

Example script

on mouseUp
  Say text,"test",bg field "text"
end mouseUp


Commands

text

This command speaks a piece of text over a speech channel. The syntax is:

    Say text,<channel>,<text>

The <channel> parameter should contain the name of a speech channel previously created with the new command.

The <text> parameter should contain the text to be spoken, which can be of any length (memory permitting).

Example script for text

on mouseUp
  Say text,"test",bg field "text"
end mouseUp

new

This command creates a new speech channel. The syntax is:

    Say new,<channel> {,<voice>}

The <channel> parameter should contain the name by which the new channel will be identified. If a channel of this name already exists the command will fail.

If the optional <voice> parameter is used, it should contain the name of the voice to use (for example "Alexander" is the standard male voice supplied with GalaTŽa). If no name is supplied, or the voice given is not installed, the default system voice will be used instead.

dispose

This command is used to dispose the memory associated with a speech channel. The syntax is:

    Say dispose,<channel>

This command must be called when you are finished with a speech channel (for example in your closeStack script), otherwise nasty things are likely to happen!

It is safe to dispose a channel at any time - any speech in progress on the channel will be halted at once. If you dispose a channel more than once by accident, the XCMD will return an error message, but nothing fatal will happen.

busy

This command can be used to find out whether any channels are currently speaking (and if so, how many). The syntax is:

    Say busy {,<channel>}

If the <channel> parameter is used, the command will return a boolean value in the result - true if the channel is speaking, false if it is not.

If the <channel> parameter is not used, the command returns an integer number in the result which indicates how many channels are currently speaking.

Example script for busy

on mouseUp
  answer "Specific channel, or all?" with "Specific" or "All"
  if it is "All" then
    Say busy
    put the result
  else
    Say busy,"test"
    put the result
  end if
end mouseUp

voices

This command returns (in the result) a return-delimited list containing the names of the currently installed voices. The syntax is:

    Say voices

Example script for voices

on mouseUp
  Say voices
  answer the result
end mouseUp

short

This command speaks a short peice of text. The syntax is:

    Say short,"some text..."

The text is spoken in the default system voice, and cannot be more than 255 characters in length.

To speak a more useful length of text, and to use the other features of the speech manager, you need first to create a speech channel. See the new and text commands.

stop

This command allows you to stop the speech in a channel. The syntax is:

    Say stop,<channel>,<when>

The <when> parameter determines exactly when the channel is stopped. A value of "word" will stop the speech after is has completed the current word. A value of "sentence" will stop the speech after the current sentence. A value of "now" will stop it immeadietly.

Example script for stop

on mouseUp
  ask "When?" with "word"
  Say stop,"test",it
end mouseUp

pause

This command allows you to pause the speech in a channel. The syntax is:

    Say pause,<channel>,<text>

The <when> parameter determines exactly when the channel is paused. A value of "word" will pause the speech after is has completed the current word. A value of "sentence" will pause the speech after the current sentence. A value of "now" will pause it immeadietly.

If a channel has been paused, the continue command will restart it.

Example script for pause

on mouseUp
  ask "When?" with "word"
  Say pause,"test",it
end mouseUp

continue

This command allows you to continue the speech in a paused channel. The syntax is:

    Say continue,<channel>

Example script for continue

on mouseUp
  Say continue,"test"
end mouseUp

rate

pitch


[last exit to hypercard] [externals index] [download Say]

This page was created automatically, on 25/03/1999 from version 3.0d4 of Last Exit To Hypercard.