Hello all
Something I find myself doing often when using my synthdefs is looking up all arguments and then copy/pasting them into pbinds to test them out with their default values so I wrote this silly function that takes a synthdef name as input and then spits out a pbind for it in the post window so I can easily copy-paste from there and have something to work from.
(
(
~postPatFor = {|synthDef=\default|
var controls = SynthDescLib.global.synthDescs.at(synthDef).controls;
"Pbind(%instrument, %%,".format("\\", "\\", synthDef.asSymbol).postln;
controls.do{|control|
var name = control.name;
var val = control.defaultValue;
// Check that synth doesn't have a duration of 0 by default (making sc explode)
val = if(name == \dur && val == 0.0, { 1.0 }, { val });
"\t%%, %,".format("\\", name, val).postln
};
").play".postln;
};
~postPatFor.value(\default)
)
)
For the default synth this spits out:
Pbind(\instrument, \default,
\t_gate, 1.0,
\dur, 1.0,
\attack, 0.0010000000474975,
\release, 0.99000000953674,
\out, 0.0,
\freq, 442.0,
\cutoff, 2500.0,
\rq, 0.20999999344349,
\pan, 0.0,
\amp, 0.5,
).play
That you can then copy-paste to a document and play immediately.