UGens usually have inputs, generally given as arguments to ar
, kr
or ir
methods. These inputs and their sources need to be communicated to the server in the binary format. This is the input-spec.
UGens usually have outputs. The server needs to know the rate of each output.
Maybe the most straightforward way to talk about it is to annotate a very simple def’s binary representation:
(
d = SynthDef(\io, {
var freq = NamedControl.kr(\freq);
Out.ar(0, SinOsc.ar(freq));
});
)
d.dumpUGens
[ 0_Control, control, nil ]
[ 1_SinOsc, audio, [ 0_Control[0], 0.0 ] ]
[ 2_Out, audio, [ 0, 1_SinOsc ] ]
d.asBytes // annotated below
83, 67, 103, 102, "SCgf"
0, 0, 0, 2, version
0, 1, 1 def
2, 105, 111, "io" defname
0, 0, 0, 1, number of constants
0, 0, 0, 0, only constant is 0 -- it's used twice below
0, 0, 0, 1, num params
0, 0, 0, 0, param init value (1st and only one)
0, 0, 0, 1, num param names
4, 102, 114, 101, 113, param name (1st, only) = "freq"
0, 0, 0, 0, param index
0, 0, 0, 3, num UGens
7, 67, 111, 110, 116, 114, 111, 108, UGen name (Control)
1, kr
0, 0, 0, 0, 0 inputs
0, 0, 0, 1, 1 output
0, 0, "special index"
input specs are skipped because num = 0
1, output is kr
6, 83, 105, 110, 79, 115, 99, UGen name SinOsc
2, ar
0, 0, 0, 2, 2 inputs
0, 0, 0, 1, 1 output
0, 0, special index
0, 0, 0, 0, 1st input, index of UGen --> Control
0, 0, 0, 0, 1st input -- index of Control's output = 0 (1st, only Control output)
-1, -1, -1, -1, 2nd input (SinOsc phase) = 0xFFFFFFFF = -1 --> constant
0, 0, 0, 0, use the first constant
2, output = ar
3, 79, 117, 116, Out
2, ar
0, 0, 0, 2, 2 inputs
0, 0, 0, 0, no outputs
0, 0, special index
-1, -1, -1, -1, 1st input = constant
0, 0, 0, 0, constant index 0
0, 0, 0, 1, 2nd input comes from UGen 1 = SinOsc
0, 0, 0, 0, 1st output from SinOsc
0, 0 num variants = 0
hjh