[PD] Looping samples with tabread4~

Matteo Sisti Sette matteo.sistisette at email.it
Thu May 17 11:21:31 CEST 2007

Frank Barknecht wrote:

>> 4. Simply using a vline~ object and ?loop it? with a different
>> start position the second time onwards.

>I'd simply do 4).

That's ok if you're not gonna change the pitch while playing the sample.

Suppose for a moment that you don't need a sample start point different from 
the loop start point, i.e. the begin and end point don't change from the 
first to the second time.
The phasor solution (which is trivial in this case) allows you to have a 
signal as an input to the phasor, thus allowing to change the pitch of the 
sampler in real time and smoothly. This is not possible (afaics) with the 
vline~ solution.

I would like to find a solution that mantain that possibility but does 
switch to the loop region after reproducing the correct sample portion the 
first time.

Obviously I don't know if Mikael Gunner, who posted the original message, 
wanted this :)

One solution for reproducing a sample with a signal pitch input without 
using a phasor is:

(input pitch ~)
[rpole 1]

(sending a [clear( to the rpole when starting playing)

However, the only way I can think of in order to switch from this to the 
phasor (or to jump to a given point of the sample) at the correct time 
independently of pitch history, is to use a [threshold~]; but that wouldn't 
be accurate because it's block-quantized.

Any other idea?

Hey!!! I just had one. But I would like anybody to suggest a simpler or more 
elegant one.

I may use 2 phasors (or an rpole and a phasor), both fed with the same pitch 

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.

There is a limitation, that is a minimum loop region size: if B is the block 
size (usually 64) and P is the maximum pitch we are willing to allow (where 
a pitch of 1 means original speed, 2 means twice the original speed etc), 
the loop region must be at least B*P..... this formula may be wrong but 
however there is a minimum loop size related to the block size. I guess this 
is rarely an issue.

Any simpler idea?


 Email.it, the professional e-mail, gratis per te: http://www.email.it/f
 La Cronaca del Carnevale di Ivrea 2007 visto su www.localport.it: per conoscere il Carnevale, per rivivere l’edizione 2007. Acquistalo on line
 Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=6430&d=17-5

More information about the Pd-list mailing list