How do you synchronise triggers to a clock or other source on the server side?
I’ve been using the following snippet to align triggers from my modular and elsewhere to clocks and create euclidean(esque) patterns, but wonder if there’s a neater way?
(
~clockSync = { |trig clock|
Trig1.ar(1 - SetResetFF.ar(trig, clock), SampleDur.ir)
max: (trig min: clock)
};
)
This works well for all sorts:
// align Dust output to Impulse pulses
a.free; a = { ~clockSync.(Dust.ar(5), Impulse.ar(8)) }.play;
// make a Euclideanesque pattern
a.free; a = { ~clockSync.(Impulse.ar(5), Impulse.ar(8)) }.play;
// quantise to a swung clock
(
a.free; a = {
c = Impulse.ar(4) + Impulse.ar(4, 0.3);
~clockSync.(Impulse.ar(5), c);
}.play;
)
I created a plugin that does exactly this. See TArmFire on GitHub.
Once installed, you can do:
a.free; a = { TArmFire.ar(Dust.ar(5), Impulse.ar(8)) }.play;
I’d imagine these “Arm & Fire” semantics are useful in plenty of other places. I’m surprised I couldn’t find them in another UGen. I do not enjoy the aesthetics/complexity of my current solution. What have I not spotted?
Is this a possible candidate for adding to the Library?