Hi guys,
I’m working on a new project after a while where I have to deal with bars and beat syncronization.
I start with the following question: why these sounds appear to me not to be syncronized at all?
Here’s the steps I followed:
I create a brand new clock on which I schedule some sine beep to be played (metronome sort of)
(
t = TempoClock.new(78/60);
// start counting just after the clock creation
t.sched(0, {
"bar: %\tbeat:%\t(tot beats:%)\n".postf( t.bar, t.beatInBar, t.beats);
{Out.ar(0, EnvGen.ar(Env.perc(0.0, 0.1), doneAction:2) * SinOsc.ar(1000) * 0.125)}.play;
1;
});
)
Then I instantiate a pattern, which is working on the newly created clock.
(
Pbindef(\test,
\instrument, \default,
\octave, 5,
\scale, Scale.major,
\root, 0,
\degree, Pseq([0,2,4,7],inf),
\dur, 1
).play(t, quant:Quant(4,0,0));
)
I would have expected the pattern sounds to be perfectly synchronised with those from the TimeClock, but why are they out of sync? Specifically, in my case, the pattern sounds seem to lag behind those generated by the TimeClock’s scheduling.
Is this a problem caused by my PC’s latency? Is there something I’m not taking into account?
Because, in fact, after evaluating the command Pbindef(\test).stop.clear; I make this change and re-evaluate
(
Pbindef(\test,
\instrument, \default,
\octave, 5,
\scale, Scale.major,
\root, 0,
\degree, Pseq([0,2,4,7],inf),
\dur, 1
).play(t, quant:Quant(4,-0.3,0));
)
The pattern seems to be perfectly in sync to me, as if, by adjusting the phase, the sounds have finally fallen into line.
Is this normal behaviour?
And why exactly is the correct phase for offsetting the pattern relative to the TimeClock set to 0.3 (if I’ve understood correctly, that’s a 300ms advance relative to the bar/beat lines of the TimeClock, is that right?)?
Is this something that could change all the time? Perhaps every time the PC/SuperCollider is restarted?Is this something that can be predicted in advance?
Do you suggest some other methods?
Thank you very much for your support