[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[sc-users] LoopBuf: playing loop points instantly?



Hi,

Anyone know of a way to make LoopBuf play from the loop points instantly when changing them? It does when the \startLoop value is decreasing from the former value, but when it increases LoopBuf plays the distance between the former and the new start position as well.

Ex:

(
b = Buffer.read(s,"sounds/a11wlk01.wav");

SynthDef("help-LoopBuf",{
    arg out=0, bufnum=0, rate=1, glide=0, gate=1, loopRel=0, startPos=0, startLoop, endLoop, ipol=2;
    var env, signal;
    rate = Lag.kr(rate, glide);
    env = EnvGen.ar(Env.adsr(0.1,0.2,1,2), gate, doneAction: 2);
    signal = LoopBuf.ar(1,bufnum, BufRateScale.kr(bufnum) * rate, gate+loopRel, startPos, startLoop, endLoop, ipol);
    Out.ar(out, (signal * env).dup);
}).send(s);
)

s.sendMsg("/s_new", "help-LoopBuf", 3000, 1, 0, \bufnum, b.bufnum, \startLoop, 5000, \endLoop, 15000);
s.sendMsg("/n_set", 3000, \startLoop, 7000, \endLoop, 9000)  //no transmission time
s.sendMsg("/n_set", 3000, \startLoop, 77000, \endLoop, 90000) //transmission time
s.sendMsg("/n_set", 3000, \startLoop, 7000, \endLoop, 9000)  //no transmission time

cheers,
Martin