2 summary:: Bring signals and floats into the ugenGraph function of a SynthDef.
3 related:: Classes/NamedControl, Classes/LagControl, Classes/TrigControl
4 categories:: UGens>Synth control
8 A Control is a UGen that can be set and routed externally to interact with a running Synth.
9 Typically, Controls are created from the arguments of a SynthDef function.
11 Generally you do not create Controls yourself. (See Arrays example
14 The rate may be either .kr (continous control rate signal) or .ir (a
15 static value, set at the time the synth starts up, and subsequently
16 unchangeable). For .ar, see link::Classes/AudioControl::
18 SynthDef creates these when compiling the ugenGraph function. They are
19 created for you, you use them, and you don't really need to worry about
20 them if you don't want to.
22 For a more concise combination of name, default value and lag, see link::Classes/NamedControl::
37 adds control names to the SynthDef.
44 SynthDef(\help_Control, { | freq = 200 |
46 freq.inspect; // at the time of compiling the def
53 SynthDef(\help_Control, {
55 \freq.kr(200).inspect; // at the time of compiling the def
61 What is passed into the ugenGraph function is an link::Classes/OutputProxy::, and its source is a Control.
63 The main explicit use of Control is to allow Arrays to be sent to running Synths:
65 // a synth def that has 4 partials
67 SynthDef(\help_Control, { arg out=0, i_freq;
68 var klank, harm, amp, ring;
71 harm = Control.names([\harm]).ir(Array.series(4, 1, 1).postln);
73 amp = Control.names([\amp]).ir(Array.fill(4, 0.05));
75 ring = Control.names([\ring]).ir(Array.fill(4, 1));
77 klank = Klank.ar(`[harm, amp, ring], { ClipNoise.ar(0.01) }.dup, i_freq);
83 a = Synth(\help_Control, [\i_freq, 300, \harm, [1, 3.3, 4.5, 7.8]]);
85 a = Synth(\help_Control, [\i_freq, 300, \harm, [2, 3, 4, 5]]);
89 SynthDef(\help_Control_Sines, { arg out=0;
90 var sines, control, numsines;
92 control = Control.names(\array).kr(Array.rand(numsines, 400.0, 1000.0));
93 sines = Mix(SinOsc.ar(control, 0, numsines.reciprocal)) ;
94 Out.ar(out, sines ! 2);
98 b = Synth(\help_Control_Sines);
99 b.setn(\array, Array.rand(20, 200, 1600));
100 b.setn(\array, Array.rand(20, 200, 1600));
105 SynthDef(\help_Control_DynKlank, { arg out=0, freq = 440;
106 var klank, harm, amp, ring;
109 harm = Control.names(\harm).kr(Array.series(4, 1, 1));
111 amp = Control.names(\amp).kr(Array.fill(4, 0.05));
113 ring = Control.names(\ring).kr(Array.fill(4, 1));
114 klank = DynKlank.ar(`[harm, amp, ring], {ClipNoise.ar(0.003)}.dup, freq);
119 a = Synth(\help_Control_DynKlank, [\freq, 300]);
120 b = Synth(\help_Control_DynKlank, [\freq, 400]);
123 a.setn(\harm, Array.rand(4, 1.0, 4.7))
124 a.setn(\amp, Array.rand(4, 0.005, 0.1))
125 a.setn(\ring, Array.rand(4, 0.005, 1.0))
127 b.setn(\harm, Array.rand(4, 1.0, 4.7))
128 b.setn(\amp, Array.rand(4, 0.005, 0.1))
129 b.setn(\ring, Array.rand(4, 0.005, 1.0))
134 Inside SynthDefs and UGen functions, symbols can be used to conventiently specify control inputs of different rates and with lags (see: link::Classes/NamedControl::, and link::Classes/Symbol::)
137 ## code:: \name.kr(val, lag) ::
138 || Return a control rate link::Classes/NamedControl:: input with a default value (val), and if supplied, with a lag. If val is an array, the control will be multichannel.
140 a = { SinOsc.ar(\freq.kr(440, 1.2)) }.play;
143 a = { SinOsc.ar(\freq.kr([440, 460], 1.2)) }.play;
144 a.setn(\freq, [330, 367]);
148 ## code:: \name.ar(val, lag) ::
149 || Return an audio rate link::Classes/NamedControl:: input with a default value (val), and if supplied, with a lag. If val is an array, the control will be multichannel.
151 ## code:: \name.ir(val) ::
152 || Return an intitalization rate link::Classes/NamedControl:: input with a default value (val). If val is an array, the control will be multichannel.
154 ## code:: \name.tr(val) ::
155 || Return a link::Classes/TrigControl:: input with a default value (val). If val is an array, the control will be multichannel.
157 a = { Ringz.ar(T2A.ar(\trig.tr), \freq.kr(500, 1), 0.8) }.play;
158 a.set(\freq, 330, \trig, 1);
159 a.set(\freq, 830, \trig, 1);