Synth Defintion File Cons

hello all, I apologize if this is a dumb question but I cant file a solution online nor in my italian super collider bbok

in the SynthDefinitionFile we have

  • int32 - number of constants (K)
  • [float32] * K - constant values

what are the constants and what are their values, for example in this SynthDef:
d = SynthDef(\demo, { |out = 0, freq = 340, amp = 0.1, gate = 1 |, ( * amp ).dup);


which are the constants?

  • I need this info for my Pharo Smalltalk backend. thanks for your help

They’re just the constant values in the graph, so 0, 340, 0.1, 1.


(in SuperCollider)


(in Smalltalk)

so why if evaluate on my SynthDef from above

the reply is
Dictionary[ (0.0 → 0) ] ?

I dont understand

Ah, apologies, arguments are controls… See below for more constants… Also all values are floats so 0 and 0.0 are the same…

d = SynthDef(\demo, {
  var out = 0, freq = 340, amp = 0.1, gate = 1;, ( * amp ).dup)
1 Like

apologies again! gate isn’t referenced, so 1 disappears, that’s why there are three numbers and not four, i misread…

.inspect is great it will answer a few of my future questions too

but still, I don’t understand what those constants are

They are constant values used as an input to a UGen.

The “constants” in your example are Control defaults, which are encoded into the SynthDef’s list of controls.

The expression, ( * amp).dup) happens to use no constants at all! All of the UGen inputs here are expressions.

Oh wait… except one input! SinOsc has a phase input, which isn’t specified, so it reverts to the default = 0… and the constants collection does include a 0.

If you add, for instance, an EnvGen, the Env definition is extremely likely to include at least constants 0 (initial and final level) and 1 (peak level), perhaps others. Then you’ll have more constants to look at.


but still, I don’t understand what those constants are

see the “input-spec” definition for how they’re used?

an input-spec is :
int32 - index of unit generator or -1 for a constant
if (unit generator index == -1) : int32 - index of constant else : int32 - index of unit generator output

ps. there’s a synthdef disassembler and pretty printer in haskell supercollider, you can get a cli binary from:

it might help if you’re getting stuck?