Imperfection of language-based timing

Okay thanks! Good to understand that there is a difference between SC blocksize and hardware blocksize.

I can currently only use and test my laptops onboard Realtek audio device. And I cannot find which buffersize it uses.

I’m not sure if it is true that the hardwareBlocksize determines the poor synchronous read performance. The following simple test shows that I am able to read synchronous at 64 samples resolution, which coincides with SC blocksize, and perhaps, but probably not with hardware blocksize.

t = TempoCLock; // LinkClock.new gives comparable results
o = Bus.control;
(
SynthDef("test",{
	var out;
	out = Sweep.kr();
	Out.kr(o,out);
}).play
)

~old = 0;

(// see if there is a whole number of blocksize between last two synchronous reads, for different assumed buffersizes
var new, ar;
new = o.getSynchronous;
ar = [(new - ~old)/(64/s.sampleRate),(new - ~old)/(128/s.sampleRate),(new - ~old)/(256/s.sampleRate),(new - ~old)/(512/s.sampleRate)];
~old = new;
ar;
)
-> [584.99908447266, 292.49954223633, 146.24977111816, 73.124885559082]
-> [473.00720214844, 236.50360107422, 118.25180053711, 59.125900268555]
-> [1536.9873046875, 768.49365234375, 384.24682617188, 192.12341308594]
-> [1125.0, 562.5, 281.25, 140.625]
-> [750.0, 375.0, 187.5, 93.75]
-> [2040.0009155273, 1020.0004577637, 510.00022888184, 255.00011444092]
-> [674.99542236328, 337.49771118164, 168.74885559082, 84.37442779541]
-> [765.0146484375, 382.50732421875, 191.25366210938, 95.626831054688]
-> [1898.0026245117, 949.00131225586, 474.50065612793, 237.25032806396]
-> [540.00091552734, 270.00045776367, 135.00022888184, 67.500114440918]
-> [666.98455810547, 333.49227905273, 166.74613952637, 83.373069763184]

So the poor timing quality of getSynchronous is not due to it only having access once every 512 samples, it has access every 64 samples.

I am still curious what mechanism then is responsible for the results.

But, I get your advice of using OSC messages with timestamps. I moved away from that because I found it rather hard/annoying, but I can manage that… But also since it introduces a big latency; and I would like to use it with live midi input.
It seems as if I need to chose between accuracy and latency. Are there anyways in Supercollider to get a nice compromise? i.e. latency in the order of 10ms and accuracy in the order of 1ms?

1 Like