Quantcast

looping sustain

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

looping sustain

Andrea Valle
Dear,

this should be pretty basic but never did it before, so I thought it would be nice not to reinvent the wheel , or the synthDef.

I have pitched sounds and I need to loop in the sustain part of the envelope for a certain duration, then release them.
Of course, I need to avoid clicks while restarting the loop part (so I guess fade in/out are needed, or zero crossing).

Ideally I should be able to set att, loopDur, release, buffer.

Any suggestion?

Many thanks



-a-


--------------------------------------------------
Andrea Valle
--------------------------------------------------
CIRMA - StudiUm
Università degli Studi di Torino
--> http://www.cirma.unito.it/andrea/
--> http://www.fonurgia.unito.it/andrea/
--> http://www.flickr.com/photos/vanderaalle/sets/
--> http://vimeo.com/vanderaalle
--> [hidden email]
--------------------------------------------------

"This is a very complicated case, Maude. You know, a lotta ins, a lotta outs, a lotta what-have-yous." 
(Jeffrey 'The Dude' Lebowski)

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: looping sustain

daniel-mayer

Am 15.05.2017 um 16:09 schrieb [hidden email]:

> Dear,
>
> this should be pretty basic but never did it before, so I thought it would be nice not to reinvent the wheel , or the synthDef.
>
> I have pitched sounds and I need to loop in the sustain part of the envelope for a certain duration, then release them.
> Of course, I need to avoid clicks while restarting the loop part (so I guess fade in/out are needed, or zero crossing).
>
> Ideally I should be able to set att, loopDur, release, buffer.
>
> Any suggestion?
>
> Many thanks


Hi,

for samples, where you already have the loop points you can take LoopBuf from plugins.
AFAIK Fredrik has written a sampler class. PlayBufCF from wslib might also be useful.

Greetings

Daniel

-----------------------------
www.daniel-mayer.at
-----------------------------
_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.birmingham.ac.uk/facilities/ea-studios/research/supercollider/mailinglist.aspx
archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
search: http://www.listarc.bham.ac.uk/lists/sc-users/search/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: looping sustain

Andrea Valle
Thanks Daniel, I experimented with LoopBuf, and other configurations with BufRd, Phasor, Envgen.
I don’t know, even with a common trigger for e.g. Phasor and an Envelope I’m still getting dephase effects.

I’m finding some difficulties in clearly controlling what’s going on, as I have to mix time in seconds (e.g. Env/EnvGen) and frames (e.g. BufRd via or LoopBuf). I was thinking that conversion may result in some errors.


best

-a-




--------------------------------------------------
Andrea Valle
--------------------------------------------------
CIRMA - StudiUm
Università degli Studi di Torino
--> http://www.cirma.unito.it/andrea/
--> http://www.fonurgia.unito.it/andrea/
--> http://www.flickr.com/photos/vanderaalle/sets/
--> http://vimeo.com/vanderaalle
--> [hidden email]
--------------------------------------------------

"This is a very complicated case, Maude. You know, a lotta ins, a lotta outs, a lotta what-have-yous." 
(Jeffrey 'The Dude' Lebowski)

On 16 May 2017, at 01:18, [hidden email] wrote:


Am 15.05.2017 um 16:09 schrieb [hidden email]:

Dear,

this should be pretty basic but never did it before, so I thought it would be nice not to reinvent the wheel , or the synthDef.

I have pitched sounds and I need to loop in the sustain part of the envelope for a certain duration, then release them.
Of course, I need to avoid clicks while restarting the loop part (so I guess fade in/out are needed, or zero crossing).

Ideally I should be able to set att, loopDur, release, buffer.

Any suggestion?

Many thanks


Hi,

for samples, where you already have the loop points you can take LoopBuf from plugins.
AFAIK Fredrik has written a sampler class. PlayBufCF from wslib might also be useful.

Greetings

Daniel

-----------------------------
www.daniel-mayer.at
-----------------------------
_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.birmingham.ac.uk/facilities/ea-studios/research/supercollider/mailinglist.aspx
archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
search: http://www.listarc.bham.ac.uk/lists/sc-users/search/


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: looping sustain

daniel-mayer

Am 16.05.2017 um 21:33 schrieb [hidden email]:

> Thanks Daniel, I experimented with LoopBuf, and other configurations with BufRd, Phasor, Envgen.
> I don’t know, even with a common trigger for e.g. Phasor and an Envelope I’m still getting dephase effects.
>
> I’m finding some difficulties in clearly controlling what’s going on, as I have to mix time in seconds (e.g. Env/EnvGen) and frames (e.g. BufRd via or LoopBuf). I was thinking that conversion may result in some errors.


That might be due to the fact, that finding "good" loop points for arbitrary samples
is one of those non-trivial problems, sometimes impossible to do sufficiently.

In cases where I tried LoopBuf with given (good) loop points it worked perfectly,
but the condition is the problem ...

There is dedicated software to find such, but I haven't tried a lot in this field,
maybe there are some recommendations ?

Greetings

Daniel

-----------------------------
www.daniel-mayer.at
-----------------------------




_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.birmingham.ac.uk/facilities/ea-studios/research/supercollider/mailinglist.aspx
archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
search: http://www.listarc.bham.ac.uk/lists/sc-users/search/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: looping sustain

ddw_music
In reply to this post by Andrea Valle
Andrea Valle wrote
Thanks Daniel, I experimented with LoopBuf, and other configurations with BufRd, Phasor, Envgen.
I don’t know, even with a common trigger for e.g. Phasor and an Envelope I’m still getting dephase effects.

I’m finding some difficulties in clearly controlling what’s going on, as I have to mix time in seconds (e.g. Env/EnvGen) and frames (e.g. BufRd via or LoopBuf). I was thinking that conversion may result in some errors.
If LoopBuf doesn't crossfade natively, I wouldn't bother with it (unless, as Daniel said, you can find precise loop points).

IEnvGen might bridge the gap between envelope times and buffer frames. Here's a proof of concept. There's one little glitch, early in the sound, that I don't have time to track down, but after that, it loops and crossfades smoothly.

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

(
a = { |lp1 = 44100, lp2 = 66150, i_xfade = 300, rate = 1, bufnum|
        var loopTrig1 = LocalIn.ar(1, 0),
        initTrig = Impulse.ar(0),
        bufRate = rate * BufRateScale.kr(bufnum),
        phase1 = Phasor.ar(loopTrig1, bufRate, 0, 1e30, lp1),
        phase2 = Phasor.ar(phase1 >= lp2, bufRate, -1e30, 1e30, lp1),
        egs = IEnvGen.ar(
                Env([0, 1, 1, 0], [i_xfade, lp2-lp1-i_xfade, i_xfade], \lin), [phase1, phase2] - lp1
        ),
        readers = BufRd.ar(1, bufnum, [phase1, phase2], loop: 0),
        // before we start looping, play the head normally (don't use egs[0])
        didLoop = (PulseCount.ar(loopTrig1) + (phase1 > lp1)) > 1;
        egs[0] = (egs[0] - 1) * didLoop + 1;
        // feedback loop trigger; account for block delay
        LocalOut.ar(phase2 >= (lp2 - BlockSize.ir));
        Mix(readers * egs).dup
}.play(args: [bufnum: b, i_xfade: 2000]);
)

I found it wasn't safe to modulate xfade, so I made it an i_ argument. I didn't test modulating lp1 and lp2 -- that may or may not work.

BTW, if you're running into difficulties, that's because this is harder than it sounds...

hjh
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: looping sustain

Andrea Valle

IEnvGen might bridge the gap between envelope times and buffer frames.
Here's a proof of concept. There's one little glitch, early in the sound,
that I don't have time to track down, but after that, it loops and
crossfades smoothly.

Ah thanks James, never knew about IEnvgen


BTW, if you're running into difficulties, that's because this is harder than
it sounds…

Good to know, I was a bit surprised because it’a s standard technique in samplers, so I was expecting to find implementations in the help files..


Thanks


Best

-a-





hjh





-a-


--------------------------------------------------
Andrea Valle
--------------------------------------------------
CIRMA - StudiUm
Università degli Studi di Torino
--> http://www.cirma.unito.it/andrea/
--> http://www.fonurgia.unito.it/andrea/
--> http://www.flickr.com/photos/vanderaalle/sets/
--> http://vimeo.com/vanderaalle
--> [hidden email]
--------------------------------------------------

"This is a very complicated case, Maude. You know, a lotta ins, a lotta outs, a lotta what-have-yous." 
(Jeffrey 'The Dude' Lebowski)
Loading...