File: Speech.schelp

package info (click to toggle)
supercollider 1%3A3.6.6~repack-2-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 23,792 kB
  • ctags: 25,269
  • sloc: cpp: 177,129; lisp: 63,421; ansic: 11,297; python: 1,787; perl: 766; yacc: 311; sh: 286; lex: 181; ruby: 173; makefile: 168; xml: 13
file content (93 lines) | stat: -rw-r--r-- 2,759 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
class:: Speech
summary:: lets you use the Apple speech synthesizer
categories:: Platform>OSX

description::

code::
"hi i'm talking with the default voice now, i guess".speak;
::

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 SpeechChannel object or by setting the channel in Speech's methods (see examples below).

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.

note::
Currently only supported on OS X. In SwingOSC there is the equivalent JSpeech.
::

ClassMethods::

private::prInitSpeech

Examples::

code::
Speech.init(2);
Speech.channels[0].speak("hallo");
Speech.channels[0].isActive;
Speech.channels[0].voice_(3);
Speech.channels[0].speak("hallo");
Speech.channels[0].pitch_(60);
Speech.channels[0].speak("hallo");
Speech.channels[0].volume_(-20.dbamp);
Speech.channels[0].pitchMod_(50);
Speech.channels[0].speak("hallo");
Speech.channels[0].stop(\immediate);
Speech.channels[0].stop(\endOfWord);
Speech.channels[0].stop(\endOfSentence);
::

Force the voice to speaking something different by setting the second argument of speak to true.
code::
Speech.channels[0].speak("Force the voice to speaking something different.");
Speech.channels[0].speak("Force the voice to speaking something different.".reverse, true);
::

First argument is always the voice channel number, second the value.
code::
Speech.setSpeechVoice(0,14);
Speech.setSpeechPitch(0, 40); //pitch in MIDI Num
Speech.setSpeechRate(0, 10);
Speech.setSpeechVolume(0,0.1);
Speech.setSpeechPitchMod(0, 200);
Speech.stop(0, 1);
::

Two actions can be applied:
code::
Speech.wordAction = {arg voiceNum;
	//i.postln;
	// the currently speaking text may not be changed
	//Speech.setSpeechPitch(voiceNum,[41,60].choose);
	//Speech.setSpeechRate(voiceNum,[60,80, 10].choose);
};
Speech.doneAction_({arg voiceNum;
	Speech.setSpeechPitch(voiceNum,[41,48,40,43,30,60].choose);
});
::

Pause the speech while speaking: 1=pause, 0= start
code::
Speech.pause(0,1);
::

Initialization happens automatically, by default with one voice channel.
You may explicitly initalize with more channels, up to 16:
code::
(
Speech.init(16);

Task({
	16.do ({arg i;
		[0.1, 0.18, 0.2].choose.wait;
		Speech.setSpeechRate(i,[90, 30, 60].choose);
		Speech.setSpeechVolume(i,0.07);
		"no this is private. float . boolean me. char[8] ".speak(i);
	});
}).play;
)

//jan@sampleAndHold.org 04/2003
//update 10/2007
::