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

Jean-Marie Adrien jma at jeanmarie-adrien.net
Thu Aug 2 10:32:09 CEST 2012

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= 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 ?

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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20120802/b986048b/attachment.htm>

More information about the Pd-list mailing list