Sure. I’ve been referring to that gist, but this is my first foray into SC. It works as expected on my computer:
Engine_Sampler : CroneEngine {
var <synth;
*new { arg context, doneCallback;
^super.new(context, doneCallback);
}
alloc{
~samples = Array.new;
~folder = PathName.new("/home/we/dust/audio/samples");
~folder.entries.do({
arg path;
~samples = ~samples.add(context.server.Buffer.read(context.server, path.fullPath));
});
SynthDef(\sampler, {
arg buf, vel=64, gate=0, rate=1;
var sig, env, amp;
env = EnvGen.kr(Env.asr(), gate, doneAction:2);
sig = PlayBuf.ar(2, buf, rate*BufRateScale.ir( buf ));
amp = LinExp.kr(vel, 1, 127, 0.01, 1);
sig = sig * env * amp;
Out.ar(0, sig);
}).add;
context.server.sync;
synth = Synth.new(\sampler, [
\inL, context.in_b[0].index,
\inR, context.in_b[1].index,
\out, context.out_b.index,
\amp, 0],
context.xg);
}
free {
synth.free;
}
}