I was recording a track into Supercollider and found that the timing is slightly off.
For example I record a track into Reaper just playing a Kick with 60 bpm (example below). The tempo in Reaper is set to 60 of course. After aligning the kick at the beginning with the grid it slightly drifts off the the grid over time. After two minutes the drift is ca. half of the kick duration.
This also happens when recording directly from Supercollider and importing the wav into Reaper.
What could be the reason for this behaviour? I’m using Ubuntu 24.04 with Pipewire, but when recording from SC that should not matter, I guess.
TempoClock.default.tempo = 60/60;
SynthDef(\kick, {
arg mainOut = 0, stemOut = 2, amp = 0.5, pan = 0, atk = 0.001, dec = 0.22, upfq = 110;
var pitchEnv, bodyEnv, body, click, clickEnv, sig;
pitchEnv = EnvGen.kr(Env([upfq, 55], [0.08], -2));
bodyEnv = EnvGen.kr(
Env.perc(atk, dec, 1, -4),
doneAction: 2
);
body = SinOsc.ar(pitchEnv) * bodyEnv;
clickEnv = EnvGen.kr(
Env.perc(0.0005, 0.01, 1, -8)
);
click = BPF.ar(WhiteNoise.ar(1), 2500, 0.8) * clickEnv * 0.25;
sig = body + click;
sig = (sig * 4).tanh * 0.4;
sig = Pan2.ar(sig * amp, pan);
Out.ar(mainOut, sig);
Out.ar(stemOut, sig);
}).add;
Pdef(\gridtest,
Pbind(
\instrument, \kick,
\dur, 1,
\dec, 0.05,
\amp, 0.1,
\upfq, 120
)
).play;
Edit: No Issue when using:
(
SynthDef(\serverClick, { |out=0, amp=0.15|
var trig, sig;
trig = Impulse.ar(1); // 1 Hz = 60 BPM quarter notes
sig = Decay2.ar(trig, 0.0005, 0.02) * WhiteNoise.ar(amp);
sig = HPF.ar(sig, 3000);
Out.ar(out, sig ! 2);
}).add;
)
x = Synth(\serverClick, [\out, 0]);
I this drift from language scheduling as suggested by ChatGPT?