I am trying to measure the roundtrip time of:
‘message to server - getting message back from server’.
So first question, is this a meaningful way of measuring the roundtrip?
(
s.waitForBoot{
SynthDef(\test, { SendReply.kr(\trig.tr(0)) }).add;
s.sync;
~synth = Synth(\test);
~osc.free;
~osc = OSCFunc({ ("roundtrip in ms: " + (Main.elapsedTime - ~time * 1000)).postln }, '/reply');
}
)
( // Run several times. On my macBook M1 I get everything from 0.5 - 10 ms)
~time = Main.elapsedTime;
~synth.set(\trig, 1)
)
// cleanup
(
~synth.free;
~osc.free;
)
And assuming this is a valid way of meassuring, why are the response times so inconsistent (0.5 - 10 ms on osx, M1)?
What I am really interested in is the oneway trip sclang - server. How long does it take to trigger a sound with 0 attack and how jittery is the timing? I can’t think of any way of measuring the oneway trip.