I’m trying to implement “cut groups” with independent patterns. E.g. to simulate open/closed hihats etc. My spontaneous approach was this:
(
t = TempoClock.default;
t.tempo = 30/60;
s.waitForBoot{
~cutGroup = Group.new;
SynthDef(\testPM, {|freq, amp, gate = 1|
var env, sig;
env = EnvGen.kr(Env.asr(), gate, doneAction: 2);
sig = SinOsc.ar(freq, SinOsc.ar(freq*2, 0, 2pi*env)) * amp * env;
Out.ar(0, sig!2);
}).add;
x = Pbind(
\cut, Pfunc({~cutGroup.release(0.001)}),
\instrument, \testPM,
\group, ~cutGroup,
\note, -24,
\amp, 0.1,
\dur, Prand([Rest(0.25), 0.25, 0.25, 0.75, 0.125, 0.25], inf)
).play(quant: 1);
y = Pbind(
\cut, Pfunc({~cutGroup.release(0.001)}),
\instrument, \testPM,
\group, ~cutGroup,
\note, 24,
\amp, 0.05,
\dur, Prand([0.5, 0.5, 0.75, 0.25, 0.125], inf)
).play(quant: 1);
};
)
And it kind of works in some way but gives Node not found messages. I suspect these are from the \gate, 0 messages generated by the events after \dur * \legato when ~cutGroup.release was already sent.
Is there a way to “filter” out the \cut Pfunc from Event.play? I tried different collect functions on the Pbind but couldn’t get it to work. Any ideas?