I went on to test the server time stamps and found the same oddity as when testing the language clock in my first example: If latency is non-nil, the server time stamps are sample locked, but when latency is set to nil, the same 4 seconds periodicity appear in the server time stamps and is also seen when inspecting audio produced by quantized patterns - values are off by pretty much the same amount in a 4 seconds cycle. I would assume latency = nil would result in more randomized offset from the quantized value, but values are very consistent.
So then I thought I could use this information to offset the delta times in a pattern with Prout (like the swingify Prout from the help files) to get better timing with latency = nil. The code I am working on force me to work with latency set to nil, since the extra added latency from ie. latency = 0.05 (which has been the smallest I can go in the past without getting late messages) breaks the ‘real time - feel’.
For this idea to work for eg. a pattern quantized to 16th notes, the deviation between server time stamp and quantized value for any given 16th note in the current 4 second cycle should be the same of very close to that of the previous 4 second cycle.
Below is the test, which on my setup shows that the majority (something like 95%) of 16th notes has the same deviation as in the previous cycle.
The test was done on a first gen. M1, SC 3.13.0, OSX 13.6.4, Apollo Solo interface, sr = 48000. I would be very curious to know if other SC users get similar results.
There are some odd cases where ‘this offset’ significantly differs from ‘previous offset’ (see post window). I don’t really know what to make of these cases.
(
s.latency = nil;
Pdef.removeAll;
~beats = 4;
~tatum = 1/~beats;
l = Array.newFrom(0!(~beats * 4));
t = TempoClock(1);
x = Synth(\time);
Pdef(\analyze,
Pbind(
\type, \set,
\id, x,
\args, #[\trig],
\trig, 1,
\dur, Pseq([0.25], inf),
)).play(t, quant: 1);
OSCdef(\o, {|msg|
// feedback starts after 4 seconds of play
var i = (t.beats.round(~tatum) * ~beats).asInteger%(~beats * 4);
var val = msg[3] - msg[3].round(~tatum);
if (t.beats >= 4)
{
var dev = (val - l[i]);
dev.debug('Deviation from previous cyle');
if (dev.abs > 0.001)
{
val.debug('This offset');
l[i].debug('Previous offset');
i.debug('i of 16th note in 4-bar-loop')
}
};
l[i] = msg[3] - msg[3].round(~tatum);
}, '/time');
)