[PD] Rép : looping at the end of sample / SOLVED

Jean-Marie Adrien jma at jeanmarie-adrien.net
Thu Aug 9 16:47:28 CEST 2012


Thanks Patrice !
I was trying though to stick two loops without any amplitude ramp, just by being precise with the indexes on a single tabread4~
With some help, I solved the problem with a single loop~ object, plus samplehold~ to trigger window change : simple indeed.
Could not manage synchronizing two phasors~ along many cycles with enough precision, due to 32bit computation of initial phase maybe.
JM

Le 2 août 2012 à 19:53, Patrice Colet a écrit :

> Allright, it seems you are looking for a crossfade loop implementation,
> that is quite usefull for looping audio in realtime, without getting clicks at loop point...
> 
> I might have something to start with, it's attached.
> 
> This patch uses cyclone objects because it has been originaly developped by a student using maxmsp native objects.
> 
> [trapezoid~] and [pong~] for crossfading with one phasor~ signal, and [wave~] for reading the wavefile.
> 
> I'm not sure about how to set the fading time, originaly expr was designed like this:
> 
> [expr 1./pow(2. \,$f1)]
> 
> 
> The minimum table lenght is equal to loopsize + fadetime/2. [trapezoid~] makes the amplitude ramps, and [pong~] decays the ramps for reading both loopstart, and after loopend.
> 
> 
> I'm still looking for pd-vanilla native implementation of this patch...
> 
> 
> Colet Patrice
> 
> ----- Mail original -----
>> De: "Jean-Marie Adrien" <jma at jeanmarie-adrien.net>
>> À: "pd-list at iem.at List" <pd-list at iem.at>
>> Envoyé: Jeudi 2 Août 2012 10:32:09
>> Objet: [PD] Rép :  looping at the end of sample
>> 
>> Hi
>> sorry, the correct word is probably sustain part, the
>> post-attack-stable part of sound that you may be able to loop
>> easily, for instance the quasi-steady state of a piano tone after
>> the attack during the quasi-flat decay.
>> Something found in archives presents very clearly the problem, and a
>> possible implementation :
>> 
>> 
>> Let's suppose this is the sample:
>> |-----SS-----LB-----LE------|
>> where:
>> SS= sample start (where we want the sample to start playing the first
>> time)
>> LB= loop begin
>> LE= loop end
>> 
>> With appropriate calculations, the two phasors can be adjusted so
>> that:
>> 1) Phasor A reproduces the sample the first time from SS to LE in its
>> first
>> cycle. In subsequent cycles it would do the same but it will be muted
>> so we
>> don't mind.
>> 2) Phasor B reproduces the loop region; its initial phase is
>> calculated in
>> such a way that at the beginning, when it is muted, it will be
>> producing
>> garbage, but when phasor A will reach point LB for the first time,
>> phasor B
>> will also be on LB, so that, during ONE cycle of phasor B, the two
>> phasors
>> will be reproducing *exactly* the same portion LB-LE synchronously.
>> 
>> So, at any moment of that cycle, we can (and we must) safely switch
>> from the
>> output of phasor A to that of phasor B; we don't need to do a
>> crossfade
>> because the two outputs are perfectly identical.
>> 
>> So, for detecting when to switch, we can use a [threshold~] on LB on
>> the
>> output of phasor A, even if threshold is block quantized. No matter
>> if the
>> actual switching occurs with a delay of almost one block, it will
>> still be
>> safe to switch.
>> 
>> ... which seems brilliant ! (sorry i do not remember this
>> contribution's author)
>> Has this solution been implemented ?
>> Is there an abstraction in a library addressing the same basic need ?
>> 
>> JM
>> 
>> Le 1 août 2012 à 18:54, Patrice Colet a écrit :
>> 
>>> hello,
>>> 
>>> what is 'resonance part'?
>>> 
>>> in principle you compute the loop size in ms and send the result to
>>> [phasor~] or [vline~] for driving [tabread4~]
>>> 
>>> Colet Patrice
>>> 
>>> ----- Mail original -----
>>>> De: "Jean-Marie Adrien" <jma at jeanmarie-adrien.net>
>>>> À: "pd-list at iem.at List" <pd-list at iem.at>
>>>> Envoyé: Mercredi 1 Août 2012 10:10:31
>>>> Objet: [PD] looping at the end of sample
>>>> 
>>>> Hi list
>>>> have looked at the archives threads concerning  managing the
>>>> tabread4~'s index  for reading an audio sample from the beginning
>>>> and then loop on a chunk at the end (in the resonance part).
>>>> Many things during the last years, but nothing very clear to me...
>>>> Any patch around for playing sample from start and loop at the end
>>>> ?
>>>> Jm
>>>> _______________________________________________
>>>> Pd-list at iem.at mailing list
>>>> UNSUBSCRIBE and account-management ->
>>>> http://lists.puredata.info/listinfo/pd-list
>>>> 
>>> 
>> 
>> _______________________________________________
>> Pd-list at iem.at mailing list
>> UNSUBSCRIBE and account-management ->
>> http://lists.puredata.info/listinfo/pd-list
>> 
> <crossfadeLoop.pd>




More information about the Pd-list mailing list