Dear SC people,
my friends that run MAX (and I won’t attempt to evangelize them :- ) have a button that resets their clock to the ONE whenever they press it, and that’s a simple but effective way to synch our setups by hand - good enough if the BPM tempi are set to the same values.
Trying to implement this functionality in SC, I found that we can set the .beats of a TempoClock to whatever value. Setting it to 0 is not gonna work as it effectively stops all the playing Tasks. Setting it to the next bar, however, does what I want, but with an unwanted side effenct, that I wonder if it can be worked around: corresponding to what the TempoClock help says in the “.beats = beats” section, it “immediately performs all tasks scheduled until the new time”. So we get a whole lot of notes playing at once. And some hanging notes as well for sustained Synths (which is not a problem in my use case, as currently all the notes I’m playing are self ending).
Does anyone of you have a better solution for this, or else, a way to temporarily suppress the execution of all the server commands the client sends in the instant just after executing the reset function?
(
SynthDef(\ping, {|freq, pan, amp=0.3|
var e, z;
e= EnvGen.ar(Env.perc(0, 0.2, amp), doneAction:2);
z= SinOsc.ar(freq, 0, 0.2);
OffsetOut.ar(0, Pan2.ar(z*e, pan));
}).add;
);
t = TempoClock.default.tempo_(0.66);
(
Pdef(\a,
Pbind(
\instrument, \ping,
\degree, Pseq((0..7), inf) + 7,
\dur, 0.125, \pan, -0.8, \amp, 0.75
)
).play(t);
);
f = { t.beats = t.nextBar };
f.(); // jumps to the ONE on the beginning of the next bar. But plays all the in-between notes AT ONCE as well. How to supress this?
(
Pdef(\b,
Pbind(
\degree, Pseq((0..7).reverse, inf) ,
\dur, 0.125, \pan, 0.8, \amp, 0.1, \legato, 0.2
)
).play(t);
);
Pdef(\a).stop;
f.(); // even worse: will leave hanging notes at some points (try several times to hear)