linux: shared memory interface - link with librt
[supercollider.git] / HelpSource / Classes / Speech.schelp
blob4cb574b63436de02841f40cdbe0c1c53e670a78d
1 class:: Speech
2 summary:: lets you use the Apple speech synthesizer
3 categories:: OSX
5 description::
7 code::
8 "hi i'm talking with the default voice now, i guess".speak;
9 ::
11 Speech consists of an link::Classes/Array:: of SpeechChannels. By default Speech is initialized with only one channel, but can be set up to use up to 16 by providing an argument to init. Channels may be used through a link::Classes/SpeechChannel:: or by setting the channel in Speech's methods (see examples below).
13 Speech is a function of the operating system and not the server. By consequence, strong::it is not possible to use UGens to filter or record the output directly::. You may be able to patch system output to system input (either by hardware of by software) to rout it to the server.
15 note::
16 Currently only supported on OS X. In SwingOSC there is the equivalent JSpeech.
19 ClassMethods::
21 private::prInitSpeech
23 Examples::
25 code::
26 Speech.init(2);
27 Speech.channels[0].speak("hallo");
28 Speech.channels[0].isActive;
29 Speech.channels[0].voice_(3);
30 Speech.channels[0].speak("hallo");
31 Speech.channels[0].pitch_(60);
32 Speech.channels[0].speak("hallo");
33 Speech.channels[0].volume_(-20.dbamp);
34 Speech.channels[0].pitchMod_(50);
35 Speech.channels[0].speak("hallo");
36 Speech.channels[0].stop(\immediate);
37 Speech.channels[0].stop(\endOfWord);
38 Speech.channels[0].stop(\endOfSentence);
41 Force the voice to speaking something different by setting the second argument of speak to true.
42 code::
43 Speech.channels[0].speak("Force the voice to speaking something different.");
44 Speech.channels[0].speak("Force the voice to speaking something different.".reverse, true);
47 First argument is always the voice channel number, second the value.
48 code::
49 Speech.setSpeechVoice(0,14);
50 Speech.setSpeechPitch(0, 40); //pitch in MIDI Num
51 Speech.setSpeechRate(0, 10);
52 Speech.setSpeechVolume(0,0.1);
53 Speech.setSpeechPitchMod(0, 200);
54 Speech.stop(0, 1);
57 Two actions can be applied:
58 code::
59 Speech.wordAction = {arg voiceNum;
60         //i.postln;
61         // the currently speaking text may not be changed
62         //Speech.setSpeechPitch(voiceNum,[41,60].choose);
63         //Speech.setSpeechRate(voiceNum,[60,80, 10].choose);
65 Speech.doneAction_({arg voiceNum;
66         Speech.setSpeechPitch(voiceNum,[41,48,40,43,30,60].choose);
67 });
70 Pause the speech while speaking: 1=pause, 0= start
71 code::
72 Speech.pause(0,1);
75 Initialization happens automatically, by default with one voice channel.
76 You may explicitly initalize with more channels, up to 16:
77 code::
79 Speech.init(16);
81 Task({
82         16.do ({arg i;
83                 [0.1, 0.18, 0.2].choose.wait;
84                 Speech.setSpeechRate(i,[90, 30, 60].choose);
85                 Speech.setSpeechVolume(i,0.07);
86                 "no this is private. float . boolean me. char[8] ".speak(i);
87         });
88 }).play;
91 //jan@sampleAndHold.org 04/2003
92 //update 10/2007