Submit
Browse
Anonymous
Login
RSS
SuperCollider Code
Fork Code: how to use the SynthDef's default argument in an Event?
name
code content
// This question comes up sometimes. // one way to do it is to define an event type: ( Event.addEventType(\dnote, { |server| var instrument = ~instrument.asDefName; var synthLib = ~synthLib ?? { SynthDescLib.global }; var desc = synthLib.at(instrument); if (desc.notNil) { desc.controls.do { |x| x.defaultValue !? { x.name.asSymbol.envirPut(x.defaultValue) } }; // for efficiency, get this now ~hasGate = desc.hasGate; ~msgFunc = desc.msgFunc; }; ~type = \note; currentEnvironment.play; }); ) ( SynthDef(\test, { |out, freq = 1000| Out.ar(out, Line.ar(0.1, 0, 0.1, doneAction:2) * SinOsc.ar(freq)) }).add ) Pbind(\type, \dnote, \instrument, \test, \dur, 0.3).play;
code description
One answer to the question "how to use the SynthDef's default argument in an Event?"
use markdown for formating
category tags
comma separated, i.g. "wild, siren" (do not enter default SC class names, please)
ancestor(s)
comma separated identificators, i.g. "1-C,1-1,1-4M,1-x"
Private?
the code will be accessible by direct url and not visible in public activity
signup to submit public code without captcha
comment of change