Fred Drake | c817e27 | 1998-08-10 18:40:22 +0000 | [diff] [blame] | 1 | \section{\module{macspeech} --- |
Fred Drake | f6863c1 | 1999-03-02 16:37:17 +0000 | [diff] [blame] | 2 | Interface to the Macintosh Speech Manager} |
| 3 | |
Fred Drake | fe7f3bc | 1998-07-23 17:55:31 +0000 | [diff] [blame] | 4 | \declaremodule{builtin}{macspeech} |
Fred Drake | f6863c1 | 1999-03-02 16:37:17 +0000 | [diff] [blame] | 5 | \platform{Mac} |
Fred Drake | fe7f3bc | 1998-07-23 17:55:31 +0000 | [diff] [blame] | 6 | \modulesynopsis{Interface to the Macintosh Speech Manager.} |
| 7 | |
Jack Jansen | e4be9be | 1995-02-28 15:46:09 +0000 | [diff] [blame] | 8 | |
Jack Jansen | e4be9be | 1995-02-28 15:46:09 +0000 | [diff] [blame] | 9 | This module provides an interface to the Macintosh Speech Manager, |
Fred Drake | 41788db | 1998-04-04 06:23:02 +0000 | [diff] [blame] | 10 | \index{Macintosh Speech Manager} |
| 11 | \index{Speech Manager, Macintosh} |
Guido van Rossum | 6bb1adc | 1995-03-13 10:03:32 +0000 | [diff] [blame] | 12 | allowing you to let the Macintosh utter phrases. You need a version of |
Fred Drake | 41788db | 1998-04-04 06:23:02 +0000 | [diff] [blame] | 13 | the Speech Manager extension (version 1 and 2 have been tested) in |
| 14 | your \file{Extensions} folder for this to work. The module does not |
Guido van Rossum | 96628a9 | 1995-04-10 11:34:00 +0000 | [diff] [blame] | 15 | provide full access to all features of the Speech Manager yet. It may |
| 16 | not be available in all Mac Python versions. |
Jack Jansen | e4be9be | 1995-02-28 15:46:09 +0000 | [diff] [blame] | 17 | |
| 18 | \begin{funcdesc}{Available}{} |
| 19 | Test availability of the Speech Manager extension (and, on the |
Fred Drake | 41788db | 1998-04-04 06:23:02 +0000 | [diff] [blame] | 20 | PowerPC, the Speech Manager shared library). Return \code{0} or |
| 21 | \code{1}. |
Jack Jansen | e4be9be | 1995-02-28 15:46:09 +0000 | [diff] [blame] | 22 | \end{funcdesc} |
| 23 | |
| 24 | \begin{funcdesc}{Version}{} |
Guido van Rossum | 6bb1adc | 1995-03-13 10:03:32 +0000 | [diff] [blame] | 25 | Return the (integer) version number of the Speech Manager. |
Jack Jansen | e4be9be | 1995-02-28 15:46:09 +0000 | [diff] [blame] | 26 | \end{funcdesc} |
| 27 | |
| 28 | \begin{funcdesc}{SpeakString}{str} |
| 29 | Utter the string \var{str} using the default voice, |
| 30 | asynchronously. This aborts any speech that may still be active from |
Fred Drake | 41788db | 1998-04-04 06:23:02 +0000 | [diff] [blame] | 31 | prior \function{SpeakString()} invocations. |
Jack Jansen | e4be9be | 1995-02-28 15:46:09 +0000 | [diff] [blame] | 32 | \end{funcdesc} |
| 33 | |
| 34 | \begin{funcdesc}{Busy}{} |
| 35 | Return the number of speech channels busy, system-wide. |
| 36 | \end{funcdesc} |
| 37 | |
| 38 | \begin{funcdesc}{CountVoices}{} |
| 39 | Return the number of different voices available. |
| 40 | \end{funcdesc} |
| 41 | |
| 42 | \begin{funcdesc}{GetIndVoice}{num} |
Fred Drake | 41788db | 1998-04-04 06:23:02 +0000 | [diff] [blame] | 43 | Return a \pytype{Voice} object for voice number \var{num}. |
Jack Jansen | e4be9be | 1995-02-28 15:46:09 +0000 | [diff] [blame] | 44 | \end{funcdesc} |
| 45 | |
Fred Drake | 41788db | 1998-04-04 06:23:02 +0000 | [diff] [blame] | 46 | \subsection{Voice Objects} |
| 47 | \label{voice-objects} |
| 48 | |
Jack Jansen | e4be9be | 1995-02-28 15:46:09 +0000 | [diff] [blame] | 49 | Voice objects contain the description of a voice. It is currently not |
| 50 | yet possible to access the parameters of a voice. |
| 51 | |
Fred Drake | 1947991 | 1998-02-13 06:58:54 +0000 | [diff] [blame] | 52 | \setindexsubitem{(voice object method)} |
Jack Jansen | e4be9be | 1995-02-28 15:46:09 +0000 | [diff] [blame] | 53 | |
Fred Drake | 41788db | 1998-04-04 06:23:02 +0000 | [diff] [blame] | 54 | \begin{methoddesc}[Voice]{GetGender}{} |
| 55 | Return the gender of the voice: \code{0} for male, \code{1} for female |
| 56 | and \code{-1} for neuter. |
| 57 | \end{methoddesc} |
Jack Jansen | e4be9be | 1995-02-28 15:46:09 +0000 | [diff] [blame] | 58 | |
Fred Drake | 41788db | 1998-04-04 06:23:02 +0000 | [diff] [blame] | 59 | \begin{methoddesc}[Voice]{NewChannel}{} |
| 60 | Return a new Speech Channel object using this voice. |
| 61 | \end{methoddesc} |
Jack Jansen | e4be9be | 1995-02-28 15:46:09 +0000 | [diff] [blame] | 62 | |
Fred Drake | 41788db | 1998-04-04 06:23:02 +0000 | [diff] [blame] | 63 | \subsection{Speech Channel Objects} |
| 64 | \label{speech-channel-objects} |
| 65 | |
| 66 | A Speech Channel object allows you to speak strings with slightly more |
| 67 | control than \function{SpeakString()}, and allows you to use multiple |
Jack Jansen | e4be9be | 1995-02-28 15:46:09 +0000 | [diff] [blame] | 68 | speakers at the same time. Please note that channel pitch and rate are |
Guido van Rossum | 6bb1adc | 1995-03-13 10:03:32 +0000 | [diff] [blame] | 69 | interrelated in some way, so that to make your Macintosh sing you will |
Jack Jansen | e4be9be | 1995-02-28 15:46:09 +0000 | [diff] [blame] | 70 | have to adjust both. |
| 71 | |
Fred Drake | 41788db | 1998-04-04 06:23:02 +0000 | [diff] [blame] | 72 | \begin{methoddesc}[Speech Channel]{SpeakText}{str} |
Jack Jansen | e4be9be | 1995-02-28 15:46:09 +0000 | [diff] [blame] | 73 | Start uttering the given string. |
Fred Drake | 41788db | 1998-04-04 06:23:02 +0000 | [diff] [blame] | 74 | \end{methoddesc} |
Jack Jansen | e4be9be | 1995-02-28 15:46:09 +0000 | [diff] [blame] | 75 | |
Fred Drake | 41788db | 1998-04-04 06:23:02 +0000 | [diff] [blame] | 76 | \begin{methoddesc}[Speech Channel]{Stop}{} |
Jack Jansen | e4be9be | 1995-02-28 15:46:09 +0000 | [diff] [blame] | 77 | Stop babbling. |
Fred Drake | 41788db | 1998-04-04 06:23:02 +0000 | [diff] [blame] | 78 | \end{methoddesc} |
Jack Jansen | e4be9be | 1995-02-28 15:46:09 +0000 | [diff] [blame] | 79 | |
Fred Drake | 41788db | 1998-04-04 06:23:02 +0000 | [diff] [blame] | 80 | \begin{methoddesc}[Speech Channel]{GetPitch}{} |
Guido van Rossum | 6bb1adc | 1995-03-13 10:03:32 +0000 | [diff] [blame] | 81 | Return the current pitch of the channel, as a floating-point number. |
Fred Drake | 41788db | 1998-04-04 06:23:02 +0000 | [diff] [blame] | 82 | \end{methoddesc} |
Jack Jansen | e4be9be | 1995-02-28 15:46:09 +0000 | [diff] [blame] | 83 | |
Fred Drake | 41788db | 1998-04-04 06:23:02 +0000 | [diff] [blame] | 84 | \begin{methoddesc}[Speech Channel]{SetPitch}{pitch} |
Jack Jansen | e4be9be | 1995-02-28 15:46:09 +0000 | [diff] [blame] | 85 | Set the pitch of the channel. |
Fred Drake | 41788db | 1998-04-04 06:23:02 +0000 | [diff] [blame] | 86 | \end{methoddesc} |
Jack Jansen | e4be9be | 1995-02-28 15:46:09 +0000 | [diff] [blame] | 87 | |
Fred Drake | 41788db | 1998-04-04 06:23:02 +0000 | [diff] [blame] | 88 | \begin{methoddesc}[Speech Channel]{GetRate}{} |
Jack Jansen | e4be9be | 1995-02-28 15:46:09 +0000 | [diff] [blame] | 89 | Get the speech rate (utterances per minute) of the channel as a |
| 90 | floating point number. |
Fred Drake | 41788db | 1998-04-04 06:23:02 +0000 | [diff] [blame] | 91 | \end{methoddesc} |
Jack Jansen | e4be9be | 1995-02-28 15:46:09 +0000 | [diff] [blame] | 92 | |
Fred Drake | 41788db | 1998-04-04 06:23:02 +0000 | [diff] [blame] | 93 | \begin{methoddesc}[Speech Channel]{SetRate}{rate} |
Jack Jansen | e4be9be | 1995-02-28 15:46:09 +0000 | [diff] [blame] | 94 | Set the speech rate of the channel. |
Fred Drake | 41788db | 1998-04-04 06:23:02 +0000 | [diff] [blame] | 95 | \end{methoddesc} |
Jack Jansen | e4be9be | 1995-02-28 15:46:09 +0000 | [diff] [blame] | 96 | |