2 var < channel, <pitch, <volume, <pitchMod, <voice, <rate;
3 var < wordDoneAction, < doneAction;
4 var < paused = false, isActive;
8 ^super.newCopyArgs(chan);
11 wordDoneAction_{|action|
12 Speech.wordDoneActions.put(channel, action)
16 Speech.doneActions.put(channel, action)
21 Speech.setSpeechPitch(channel, pitch);
26 Speech.setSpeechVolume(channel, volume);
31 Speech.setSpeechPitchMod(channel, pitchMod);
36 Speech.setSpeechRate(channel, rate);
41 Speech.setSpeechVoice(channel, voice);
45 if(when.isNumber.not){
46 when = Speech.stopMethods[when];
48 Speech.stop(channel, when);
53 Speech.pause(channel, bool.binaryValue);
57 ^this.prIsActive(channel);
61 speak{|string, force=false|
63 this.prSpeak(channel, string);
69 this.prSpeak(channel, string);
73 prSpeak{|channel, txt|
78 _SpeechVoiceIsSpeaking
84 classvar <>wordActions, <>doneActions, <>wordAction, <>doneAction, <channels;
85 classvar <>initialized = false, <stopMethods;
87 *setSpeechVoice { arg chan,voice;
90 *setSpeechRate { arg chan,rate;
93 *setSpeechPitch { arg chan,pitch;
96 *setSpeechPitchMod { arg chan,pitchMod;
99 *setSpeechVolume { arg chan,volume;
102 *pause { arg chan, paused=0;
106 //when: 0 kImmediate, 1 kEndOfWord, 2 kEndOfSentence
107 *stop { arg chan, when=0;
113 channels = Array.new(num);
114 wordActions = Array.newClear(num);
115 doneActions = Array.newClear(num);
117 channels.add(SpeechChannel(i))
119 stopMethods = (immediate: 0, endOfWord: 1, endOfSentence: 2);
122 *prInitSpeech { arg num=16;
125 *doWordAction { arg chan;
126 wordAction.value(chan); //backward compatibility
127 wordActions[chan].value(channels[chan]);
129 *doSpeechDoneAction { arg chan;
130 doneAction.value(chan);
131 doneActions[chan].value(channels[chan]);
135 //speech by jan trutzschler