[sc-users] buffer sync question...
Travis Weller
travis at newmusiccoop.org
Fri Aug 18 11:05:10 PDT 2006
All,
I might be missing something, but I think I've scoured help files and
mailing list archives long enough. I'm still getting the hang of SC.
I have a SynthDef that loops sections of a buffer (the boundaries of
which are selected and manipulated via a GUI). That much works great.
I'm using Lance Putnam's LoopBuf because some of the stuff I'm doing
with the buffer is difficult to accomplish with PlayBuf.
My problem comes in when I want to overdub in that buffer in
realtime. So far, I'm been able to record into the section of the
buffer that I'm playing back, but the recording point is often
different from the playback point which makes it difficult to predict
the results of overdubbing. Below, you will find the SynthDef and
some messages extracted from the classes I'm writing. I can send both
classes, but they are long and I figured this would get the point
across.
Please note that in some cases the playback from LoopBuf is jumping
around quite a bit. In those cases, there is no need for record and
playback to be in sync, and the SynthDef below works fine for those
situations. However, in other cases, I would like to emulate the old
"tape loop" effect (read: Echoplex Digital Pro) where record and
playback happen at the same point in the buffer with variable
regeneration. It would work fine to maintain this state on the lang
side (ie. switching in and out of 'sync' mode). I'm not quite sure
how to get there using this setup.
Any ideas?
Thanks in advance,
Travis
--
SynthDef(\tcwloopBuf,{
arg buffer,
rate = 1,
glide = 0,
gate = 1,
t_loopGate = 1,
startPos = 0,
startLoop,
endLoop,
ipol = 4,
envlen = 0.01,
rec = 0,
regenLevel = 1,
amp = 1.0;
var env, signal, phase;
rate = Lag.kr(rate, glide);
env = EnvGen.ar(Env.asr(envlen, 1, envlen), gate, doneAction: 2);
signal = LoopBuf.ar(1,buffer, BufRateScale.kr(buffer) * rate,
(1 - t_loopGate), startPos, startLoop, endLoop, ipol);
phase = Phasor.ar(buffer, BufRateScale.kr(buffer), startLoop, endLoop);
BufWr.ar((AudioIn.ar(1) * rec) + ((BufRd.ar(1, buffer, phase)
* regenLevel)),
buffer, phase);
Out.ar(0, ((signal * env) * amp).dup);
}).send(server);
// ...and some out-of-context examples of messages...
server.sendMsg("/s_new", \tcwloopBuf, this.nodeID, 0, 0,
\buffer, bufnum,
\startPos, startArg,
\startLoop, startArg,
\endLoop, endArg,
\t_loopGate, 1,
\envlen, 2
server.sendMsg("/n_set", this.nodeID,
\startPos, resetPos,
\t_loopGate, 1
server.sendMsg("/n_set", this.nodeID,
\startPos, mySelectionStart,
\startLoop, mySelectionStart,
\endLoop, (mySelectionStart + mySelectionSize),
\t_loopGate, 1
server.sendMsg("/n_set", this.nodeID, \rec, 1, \regenLevel, 0.5);
server.sendMsg("/n_set", this.nodeID, \rec, 0, \regenLevel, 1);
server.sendMsg("/n_set", this.nodeID,
\startPos, resetPos,
\t_loopGate, 1
server.sendMsg("/n_set", this.nodeID, \gate, -1);
More information about the sc-users
mailing list