blob: 14a9c61082dedf27d0d38994d791f7435d79801f [file] [log] [blame]
Fred Drake41788db1998-04-04 06:23:02 +00001\section{Built-in Module \module{macspeech}}
Guido van Rossume47da0a1997-07-17 16:34:52 +00002\label{module-macspeech}
Jack Jansene4be9be1995-02-28 15:46:09 +00003\bimodindex{macspeech}
4
Guido van Rossum86751151995-02-28 17:14:32 +00005
Jack Jansene4be9be1995-02-28 15:46:09 +00006This module provides an interface to the Macintosh Speech Manager,
Fred Drake41788db1998-04-04 06:23:02 +00007\index{Macintosh Speech Manager}
8\index{Speech Manager, Macintosh}
Guido van Rossum6bb1adc1995-03-13 10:03:32 +00009allowing you to let the Macintosh utter phrases. You need a version of
Fred Drake41788db1998-04-04 06:23:02 +000010the Speech Manager extension (version 1 and 2 have been tested) in
11your \file{Extensions} folder for this to work. The module does not
Guido van Rossum96628a91995-04-10 11:34:00 +000012provide full access to all features of the Speech Manager yet. It may
13not be available in all Mac Python versions.
Jack Jansene4be9be1995-02-28 15:46:09 +000014
15\begin{funcdesc}{Available}{}
16Test availability of the Speech Manager extension (and, on the
Fred Drake41788db1998-04-04 06:23:02 +000017PowerPC, the Speech Manager shared library). Return \code{0} or
18\code{1}.
Jack Jansene4be9be1995-02-28 15:46:09 +000019\end{funcdesc}
20
21\begin{funcdesc}{Version}{}
Guido van Rossum6bb1adc1995-03-13 10:03:32 +000022Return the (integer) version number of the Speech Manager.
Jack Jansene4be9be1995-02-28 15:46:09 +000023\end{funcdesc}
24
25\begin{funcdesc}{SpeakString}{str}
26Utter the string \var{str} using the default voice,
27asynchronously. This aborts any speech that may still be active from
Fred Drake41788db1998-04-04 06:23:02 +000028prior \function{SpeakString()} invocations.
Jack Jansene4be9be1995-02-28 15:46:09 +000029\end{funcdesc}
30
31\begin{funcdesc}{Busy}{}
32Return the number of speech channels busy, system-wide.
33\end{funcdesc}
34
35\begin{funcdesc}{CountVoices}{}
36Return the number of different voices available.
37\end{funcdesc}
38
39\begin{funcdesc}{GetIndVoice}{num}
Fred Drake41788db1998-04-04 06:23:02 +000040Return a \pytype{Voice} object for voice number \var{num}.
Jack Jansene4be9be1995-02-28 15:46:09 +000041\end{funcdesc}
42
Fred Drake41788db1998-04-04 06:23:02 +000043\subsection{Voice Objects}
44\label{voice-objects}
45
Jack Jansene4be9be1995-02-28 15:46:09 +000046Voice objects contain the description of a voice. It is currently not
47yet possible to access the parameters of a voice.
48
Fred Drake19479911998-02-13 06:58:54 +000049\setindexsubitem{(voice object method)}
Jack Jansene4be9be1995-02-28 15:46:09 +000050
Fred Drake41788db1998-04-04 06:23:02 +000051\begin{methoddesc}[Voice]{GetGender}{}
52Return the gender of the voice: \code{0} for male, \code{1} for female
53and \code{-1} for neuter.
54\end{methoddesc}
Jack Jansene4be9be1995-02-28 15:46:09 +000055
Fred Drake41788db1998-04-04 06:23:02 +000056\begin{methoddesc}[Voice]{NewChannel}{}
57Return a new Speech Channel object using this voice.
58\end{methoddesc}
Jack Jansene4be9be1995-02-28 15:46:09 +000059
Fred Drake41788db1998-04-04 06:23:02 +000060\subsection{Speech Channel Objects}
61\label{speech-channel-objects}
62
63A Speech Channel object allows you to speak strings with slightly more
64control than \function{SpeakString()}, and allows you to use multiple
Jack Jansene4be9be1995-02-28 15:46:09 +000065speakers at the same time. Please note that channel pitch and rate are
Guido van Rossum6bb1adc1995-03-13 10:03:32 +000066interrelated in some way, so that to make your Macintosh sing you will
Jack Jansene4be9be1995-02-28 15:46:09 +000067have to adjust both.
68
Fred Drake41788db1998-04-04 06:23:02 +000069\begin{methoddesc}[Speech Channel]{SpeakText}{str}
Jack Jansene4be9be1995-02-28 15:46:09 +000070Start uttering the given string.
Fred Drake41788db1998-04-04 06:23:02 +000071\end{methoddesc}
Jack Jansene4be9be1995-02-28 15:46:09 +000072
Fred Drake41788db1998-04-04 06:23:02 +000073\begin{methoddesc}[Speech Channel]{Stop}{}
Jack Jansene4be9be1995-02-28 15:46:09 +000074Stop babbling.
Fred Drake41788db1998-04-04 06:23:02 +000075\end{methoddesc}
Jack Jansene4be9be1995-02-28 15:46:09 +000076
Fred Drake41788db1998-04-04 06:23:02 +000077\begin{methoddesc}[Speech Channel]{GetPitch}{}
Guido van Rossum6bb1adc1995-03-13 10:03:32 +000078Return the current pitch of the channel, as a floating-point number.
Fred Drake41788db1998-04-04 06:23:02 +000079\end{methoddesc}
Jack Jansene4be9be1995-02-28 15:46:09 +000080
Fred Drake41788db1998-04-04 06:23:02 +000081\begin{methoddesc}[Speech Channel]{SetPitch}{pitch}
Jack Jansene4be9be1995-02-28 15:46:09 +000082Set the pitch of the channel.
Fred Drake41788db1998-04-04 06:23:02 +000083\end{methoddesc}
Jack Jansene4be9be1995-02-28 15:46:09 +000084
Fred Drake41788db1998-04-04 06:23:02 +000085\begin{methoddesc}[Speech Channel]{GetRate}{}
Jack Jansene4be9be1995-02-28 15:46:09 +000086Get the speech rate (utterances per minute) of the channel as a
87floating point number.
Fred Drake41788db1998-04-04 06:23:02 +000088\end{methoddesc}
Jack Jansene4be9be1995-02-28 15:46:09 +000089
Fred Drake41788db1998-04-04 06:23:02 +000090\begin{methoddesc}[Speech Channel]{SetRate}{rate}
Jack Jansene4be9be1995-02-28 15:46:09 +000091Set the speech rate of the channel.
Fred Drake41788db1998-04-04 06:23:02 +000092\end{methoddesc}
Jack Jansene4be9be1995-02-28 15:46:09 +000093