{
   "code" : "// This question comes up sometimes.\r\n// one way to do it is to define an event type:\r\n\r\n\r\n(\r\nEvent.addEventType(\\dnote, { |server|\r\n\t\r\n\tvar instrument = ~instrument.asDefName;\r\n\tvar synthLib = ~synthLib ?? { SynthDescLib.global };\r\n\tvar desc = synthLib.at(instrument);\r\n\t\r\n\t\r\n\tif (desc.notNil) {\r\n\t\tdesc.controls.do { |x|\r\n\t\t\tx.defaultValue !? { x.name.asSymbol.envirPut(x.defaultValue) }\r\n\t\t};\r\n\t\t// for efficiency, get this now\r\n\t\t~hasGate = desc.hasGate;\r\n\t\t~msgFunc = desc.msgFunc;\r\n\t};\r\n\t~type = \\note;\r\n\t\r\n\tcurrentEnvironment.play;\r\n});\r\n)\r\n\r\n(\r\nSynthDef(\\test, { |out, freq = 1000| \r\n\tOut.ar(out, Line.ar(0.1, 0, 0.1, doneAction:2) * SinOsc.ar(freq)) \r\n}).add\r\n)\r\n\r\nPbind(\\type, \\dnote, \\instrument, \\test, \\dur, 0.3).play;",
   "is_private" : null,
   "id" : "1-57P",
   "labels" : [
      "pattern",
      "event",
      "help",
      "eventtype"
   ],
   "ancestor_list" : [],
   "description" : "One answer to the question \"how to use the SynthDef's default argument in an Event?\"",
   "author" : "julian.rohrhuber",
   "name" : "how to use the SynthDef's default argument in an Event?"
}
