blob: 2d90d34396348ff9347987a86ba94a8e00c966bc [file] [log] [blame]
Fred Drake41788db1998-04-04 06:23:02 +00001\section{Built-in Module \module{macspeech}}
Fred Drakefe7f3bc1998-07-23 17:55:31 +00002\declaremodule{builtin}{macspeech}
3
4\modulesynopsis{Interface to the Macintosh Speech Manager.}
5
Jack Jansene4be9be1995-02-28 15:46:09 +00006
Guido van Rossum86751151995-02-28 17:14:32 +00007
Jack Jansene4be9be1995-02-28 15:46:09 +00008This module provides an interface to the Macintosh Speech Manager,
Fred Drake41788db1998-04-04 06:23:02 +00009\index{Macintosh Speech Manager}
10\index{Speech Manager, Macintosh}
Guido van Rossum6bb1adc1995-03-13 10:03:32 +000011allowing you to let the Macintosh utter phrases. You need a version of
Fred Drake41788db1998-04-04 06:23:02 +000012the Speech Manager extension (version 1 and 2 have been tested) in
13your \file{Extensions} folder for this to work. The module does not
Guido van Rossum96628a91995-04-10 11:34:00 +000014provide full access to all features of the Speech Manager yet. It may
15not be available in all Mac Python versions.
Jack Jansene4be9be1995-02-28 15:46:09 +000016
17\begin{funcdesc}{Available}{}
18Test availability of the Speech Manager extension (and, on the
Fred Drake41788db1998-04-04 06:23:02 +000019PowerPC, the Speech Manager shared library). Return \code{0} or
20\code{1}.
Jack Jansene4be9be1995-02-28 15:46:09 +000021\end{funcdesc}
22
23\begin{funcdesc}{Version}{}
Guido van Rossum6bb1adc1995-03-13 10:03:32 +000024Return the (integer) version number of the Speech Manager.
Jack Jansene4be9be1995-02-28 15:46:09 +000025\end{funcdesc}
26
27\begin{funcdesc}{SpeakString}{str}
28Utter the string \var{str} using the default voice,
29asynchronously. This aborts any speech that may still be active from
Fred Drake41788db1998-04-04 06:23:02 +000030prior \function{SpeakString()} invocations.
Jack Jansene4be9be1995-02-28 15:46:09 +000031\end{funcdesc}
32
33\begin{funcdesc}{Busy}{}
34Return the number of speech channels busy, system-wide.
35\end{funcdesc}
36
37\begin{funcdesc}{CountVoices}{}
38Return the number of different voices available.
39\end{funcdesc}
40
41\begin{funcdesc}{GetIndVoice}{num}
Fred Drake41788db1998-04-04 06:23:02 +000042Return a \pytype{Voice} object for voice number \var{num}.
Jack Jansene4be9be1995-02-28 15:46:09 +000043\end{funcdesc}
44
Fred Drake41788db1998-04-04 06:23:02 +000045\subsection{Voice Objects}
46\label{voice-objects}
47
Jack Jansene4be9be1995-02-28 15:46:09 +000048Voice objects contain the description of a voice. It is currently not
49yet possible to access the parameters of a voice.
50
Fred Drake19479911998-02-13 06:58:54 +000051\setindexsubitem{(voice object method)}
Jack Jansene4be9be1995-02-28 15:46:09 +000052
Fred Drake41788db1998-04-04 06:23:02 +000053\begin{methoddesc}[Voice]{GetGender}{}
54Return the gender of the voice: \code{0} for male, \code{1} for female
55and \code{-1} for neuter.
56\end{methoddesc}
Jack Jansene4be9be1995-02-28 15:46:09 +000057
Fred Drake41788db1998-04-04 06:23:02 +000058\begin{methoddesc}[Voice]{NewChannel}{}
59Return a new Speech Channel object using this voice.
60\end{methoddesc}
Jack Jansene4be9be1995-02-28 15:46:09 +000061
Fred Drake41788db1998-04-04 06:23:02 +000062\subsection{Speech Channel Objects}
63\label{speech-channel-objects}
64
65A Speech Channel object allows you to speak strings with slightly more
66control than \function{SpeakString()}, and allows you to use multiple
Jack Jansene4be9be1995-02-28 15:46:09 +000067speakers at the same time. Please note that channel pitch and rate are
Guido van Rossum6bb1adc1995-03-13 10:03:32 +000068interrelated in some way, so that to make your Macintosh sing you will
Jack Jansene4be9be1995-02-28 15:46:09 +000069have to adjust both.
70
Fred Drake41788db1998-04-04 06:23:02 +000071\begin{methoddesc}[Speech Channel]{SpeakText}{str}
Jack Jansene4be9be1995-02-28 15:46:09 +000072Start uttering the given string.
Fred Drake41788db1998-04-04 06:23:02 +000073\end{methoddesc}
Jack Jansene4be9be1995-02-28 15:46:09 +000074
Fred Drake41788db1998-04-04 06:23:02 +000075\begin{methoddesc}[Speech Channel]{Stop}{}
Jack Jansene4be9be1995-02-28 15:46:09 +000076Stop babbling.
Fred Drake41788db1998-04-04 06:23:02 +000077\end{methoddesc}
Jack Jansene4be9be1995-02-28 15:46:09 +000078
Fred Drake41788db1998-04-04 06:23:02 +000079\begin{methoddesc}[Speech Channel]{GetPitch}{}
Guido van Rossum6bb1adc1995-03-13 10:03:32 +000080Return the current pitch of the channel, as a floating-point number.
Fred Drake41788db1998-04-04 06:23:02 +000081\end{methoddesc}
Jack Jansene4be9be1995-02-28 15:46:09 +000082
Fred Drake41788db1998-04-04 06:23:02 +000083\begin{methoddesc}[Speech Channel]{SetPitch}{pitch}
Jack Jansene4be9be1995-02-28 15:46:09 +000084Set the pitch of the channel.
Fred Drake41788db1998-04-04 06:23:02 +000085\end{methoddesc}
Jack Jansene4be9be1995-02-28 15:46:09 +000086
Fred Drake41788db1998-04-04 06:23:02 +000087\begin{methoddesc}[Speech Channel]{GetRate}{}
Jack Jansene4be9be1995-02-28 15:46:09 +000088Get the speech rate (utterances per minute) of the channel as a
89floating point number.
Fred Drake41788db1998-04-04 06:23:02 +000090\end{methoddesc}
Jack Jansene4be9be1995-02-28 15:46:09 +000091
Fred Drake41788db1998-04-04 06:23:02 +000092\begin{methoddesc}[Speech Channel]{SetRate}{rate}
Jack Jansene4be9be1995-02-28 15:46:09 +000093Set the speech rate of the channel.
Fred Drake41788db1998-04-04 06:23:02 +000094\end{methoddesc}
Jack Jansene4be9be1995-02-28 15:46:09 +000095