I'm trying to follow some examples in the superdirt hacks folder, but running into what seem like basic problems adding a superdirt synth.
Here's the example from /hacks/function-hacks.scd:
SynthDef(\plick, { |out, freq = 220, amp = 0.1, sustain = 1|
var sig, env;
env = EnvGen.ar(Env([0, amp, 0], [0.001, sustain]), doneAction:2);
sig = SinOsc.ar(freq, LFNoise2.ar(XLine.kr(39, 300, sustain), Line.kr(15, 0, sustain)));
Out.ar(out, sig * env);
}).add;
~dirt.soundLibrary.addSynth(\plack,
(playInside: { |e|
// make sure that you play it in the ~synthGroup and to the out
(instrument: \plick, out: ~out, freq: ~freq, amp: ~amp, group: ~synthGroup).play
})
)
When I run this and then try to play the sound via d1 $ s "plack"
I get an error:
module 'sound': instrument not found: plack
So it seams I failed to add the synth, although there were no errors in SC when I evaluated the code above.
Generally I'm finding it pretty tough to grok the addSynth api, either via play
or playInside
. I can't seem to find a spec for dirt events that get passed around.
I recently followed the upgrade instructions so everything should be up to date.