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

Martin . blindmanonacid at gmail.com
Sat Oct 27 16:12:45 PDT 2007


Fredrik, otherMartin,

Yes, that is exactly it! Thanks!

Martin :)

On 10/27/07, Fredrik Olofsson <f at fredrikolofsson.com> wrote:
>
> hi Martin, Martin,
> this is one of the reasons i wrote RedPhasor - to have better control
> of the looping points.  use the trig argument to force a jump to the
> start position.
>
> s.boot
> b = Buffer.read(s,"sounds/a11wlk01.wav");
>
> modified example from below.  detects and trig when startLoop
> changes.  then use that trig to force the phasor to jump.
>
> (
> SynthDef("redLooper",{
>      arg out=0, bufnum=0, rate=1, glide=0, gate=1, loopRel=0,
> startLoop, endLoop, ipol=2;
>      var env, signal, posTrig;
>      rate = Lag.kr(rate, glide);
>      env = EnvGen.ar(Env.adsr(0.1,0.2,1,2), gate, doneAction: 2);
>      posTrig= HPZ2.kr(startLoop);               //trig when startLoop
> changes
>      signal = BufRd.ar(1,bufnum, RedPhasor.ar(posTrig, BufRateScale.kr
> (bufnum) * rate, startLoop, b.numFrames-1, 1, startLoop, endLoop ),
> 0, ipol);
>      Out.ar(out, (signal * env).dup);
> }).send(s);
> )
>
> s.sendMsg("/s_new", "redLooper", 4000, 1, 0, \bufnum, b.bufnum,
> \startLoop, 5000, \endLoop, 15000);
> s.sendMsg("/n_set", 4000, \startLoop, 5000, \endLoop, 9000)  //no
> transmission time
> s.sendMsg("/n_set", 4000, \startLoop, 77000, \endLoop, 90000) //
> should jump now
> s.sendMsg("/n_set", 4000, \startLoop, 5000, \endLoop, 9000)  //no
> transmission time
>
>
> another way to do this would be to have a trigger argument (t_jump)
> and then you can decide if to jump or not.
>
> (
> SynthDef("redLooper2",{
>      arg out=0, bufnum=0, rate=1, glide=0, gate=1, t_jump= 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 = BufRd.ar(1,bufnum, RedPhasor.ar(t_jump, BufRateScale.kr
> (bufnum) * rate, startLoop, b.numFrames-1, 1, startLoop, endLoop ),
> 0, ipol);
>      Out.ar(out, (signal * env).dup);
> }).send(s);
> )
>
> s.sendMsg("/s_new", "redLooper2", 4000, 1, 0, \bufnum, b.bufnum,
> \startLoop, 5000, \endLoop, 15000);
> s.sendMsg("/n_set", 4000, \startLoop, 5000, \endLoop, 9000, \t_jump,
> 1)  //no transmission time
> s.sendMsg("/n_set", 4000, \startLoop, 77000, \endLoop, 90000,
> \t_jump, 1) //make it jump now
> s.sendMsg("/n_set", 4000, \startLoop, 5000, \endLoop, 9000, \t_jump,
> 1)  //no transmission time
> s.sendMsg("/n_set", 4000, \startLoop, 77000, \endLoop, 90000) //with
> transmission time (no trig= no jump)
>
>
> b.free
>
> hope that makes sense,
> /f0
>
>
>
> Am 27.10.2007 um 12:48 schrieb Martin Vognsen:
>
> >
> > The obvious answer is probably that it doesn't loop back to
> > startLoop until current position reaches endLoop. But I don't know
> > if there is a workaround without changing the Ugen....
> >
> > RedPhasor behaves the same, btw:
> >
> > b = Buffer.read(s,"sounds/a11wlk01.wav");
> >
> > (
> > SynthDef("redLooper",{
> >     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 = BufRd.ar(1,bufnum, RedPhasor.ar(1, BufRateScale.kr
> > (bufnum) * rate, startPos, b.numFrames-1, 1, startLoop, endLoop ),
> > 0, ipol);
> >     Out.ar(out, (signal * env).dup);
> > }).send(s);
> > )
> >
> > s.sendMsg("/s_new", "redLooper", 4000, 1, 0, \bufnum, b.bufnum,
> > \startLoop, 5000, \endLoop, 15000);
> > s.sendMsg("/n_set", 4000, \startLoop, 5000, \endLoop, 9000)  //no
> > transmission time
> > s.sendMsg("/n_set", 4000, \startLoop, 77000, \endLoop, 90000) //
> > transmission time
> > s.sendMsg("/n_set", 4000, \startLoop, 5000, \endLoop, 9000)  //no
> > transmission time
> >
> >
> >
> >
> >
> > Den 27/10/2007 kl. 12.24 skrev Martin Vognsen:
> >
> >>
> >> Ah, but now I see what you mean. Sorry, I don't know why BufLoop
> >> behaves like that.
> >>
> >> -Other Martin
> >>
> >> Den 27/10/2007 kl. 11.59 skrev Martin Vognsen:
> >>
> >>> Hi Martin
> >>>
> >>> I'm not totally sure what you mean, but the buffer in your
> >>> example is only 26977 frames. You're setting loop points beyond
> >>> that.
> >>>
> >>> b.numFrames is your clue.
> >>>
> >>> Anyway, thanks for pointing my attention to BufLoop, I've been
> >>> using RedPhasor for simple looping when rate modulation is
> >>> needed, but this saves a bit of typing.
> >>>
> >>> -Another Martin
> >>>
> >>>
> >>>
> >>> Den 25/10/2007 kl. 23.33 skrev Martin .:
> >>>
> >>>> 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
> >>>> _______________________________________________
> >>>> sc-users mailing list
> >>>> sc-users at create.ucsb.edu
> >>>> http://www.create.ucsb.edu/mailman/listinfo/sc-users
> >>>
> >>> _______________________________________________
> >>> sc-users mailing list
> >>> sc-users at create.ucsb.edu
> >>> http://www.create.ucsb.edu/mailman/listinfo/sc-users
> >>
> >> _______________________________________________
> >> sc-users mailing list
> >> sc-users at create.ucsb.edu
> >> http://www.create.ucsb.edu/mailman/listinfo/sc-users
> >
> > _______________________________________________
> > sc-users mailing list
> > sc-users at create.ucsb.edu
> > http://www.create.ucsb.edu/mailman/listinfo/sc-users
> >
>
>
>    #|
>       fredrikolofsson.com     klippav.org     musicalfieldsforever.com
>    |#
>
> _______________________________________________
> sc-users mailing list
> sc-users at create.ucsb.edu
> http://www.create.ucsb.edu/mailman/listinfo/sc-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.create.ucsb.edu/pipermail/sc-users/attachments/20071027/35b80eac/attachment-0001.htm


More information about the sc-users mailing list