Hi guys,
another question about syncronization (which is some way realeted to this i think).
Let’s assume I have some audio material in the form of a stereo audio file (
), produced in the usual way in my DAW, and that this musical material is in 4/4 time and has a constant tempo of 78 bpm.
Now I would like to use SC to play back the audio file and, at the same time, a pattern (Pbind or Pbindef), synchronised to the same BPM and the same bar lines, so as to add further sound material to the pre-produced track.
The playback of the two tracks should begin as soon as possible upon receipt of an OSC message from another application.
Leaving aside the OSC and interfacing with the external application for now, I am having some difficulty synchronising the playback of the two tracks. This is most likely due to my lack of familiarity with the TempoClock class or with server latency.
I have tried to envisage a scenario such as the following.
// 0. boot the server
s.boot;
// 1. load audiofile (find it attached in this post)
~audiofile = Buffer.read(s, "path/to/attached/audiofile/Fra_Martino_short_78bpm.wav");
// 2. define the synth that will be in charge of playing it
(
SynthDef(\test, {
|out=0, buf, rate=1.0, trigger=0, amp=1.0, pan=0.0|
var sig = PlayBuf.ar(2, buf, BufRateScale.ir(buf)*rate, trigger);
sig = sig * amp;
Out.ar(out, sig);
}).add;
)
// 3. define the pattern
(
p = Pbind(
\instrument, \default,
\amp, 1.0,
\octave, 5,
\scale, Scale.major,
\degree, Pseq([0,2,4,7], inf),
\dur, 1
).asEventStreamPlayer;
)
When ready
- define the new clock (maybe not mandatory?);
and start both playback of:
- pattern;
- audio file;
(
t = TempoClock.new(78/60);
x = Synth(\test, [\buf, ~audiofile, \amp, 0.5]);
p.reset.play(t, quant:Quant(1,0,0));
)
This approach doesn’t work. The audio file and patterns are out of synch.
I’ve also tried this approach:
(
t = TempoClock.new(78/60);
t.play({
x = Synth(\test, [\buf, ~audiofile, \amp, 0.5]);
}, quant:1);
p.reset.play(t, quant:Quant(1,0,0));
)
Which is also not working.
Is there a way of achieving what I want?
I’ve read the documentation about the method .bind of the server and also the makeBundle and also the Scheduling and Server timing | SuperCollider 3.14.0 Help but I’m not capable of figuring out how to apply these concepts in my particula scenario.
Thank you so much for your help