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" <[email protected]>
> À: "[email protected] List" <[email protected]>
> 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" <[email protected]>
> >> À: "[email protected] List" <[email protected]>
> >> 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
> >> _______________________________________________
> >> [email protected] mailing list
> >> UNSUBSCRIBE and account-management ->
> >> http://lists.puredata.info/listinfo/pd-list
> >> 
> > 
> 
> _______________________________________________
> [email protected] mailing list
> UNSUBSCRIBE and account-management ->
> http://lists.puredata.info/listinfo/pd-list
> 
#N canvas 85 136 857 675 10;
#N canvas 0 0 450 300 (subpatch) 0;
#X array \$0_n 176400 float 0;
#X coords 0 1 176399 -1 100 60 1 0 0;
#X restore 11 22 graph;
#N canvas 1074 195 703 488 crossfade 0;
#X obj 28 440 outlet~;
#X obj 411 323 *~ -1;
#X obj 411 298 -~ 1;
#X obj 192 403 *~;
#X obj 28 363 *~;
#X obj 320 28 inlet;
#X obj 29 18 inlet~;
#X obj 495 121 expr 1-$f1;
#X obj 29 288 cyclone/wave~ \$0_n 0 0;
#X obj 193 312 cyclone/wave~ \$0_n 0 0;
#X obj 412 169 cyclone/trapezoid~ 0.2 0.8;
#X obj 192 168 cyclone/pong~ 1 0 1;
#X obj 192 141 +~;
#X floatatom 470 72 5 0 0 0 - - -;
#X obj 318 61 sig~;
#X obj 520 141 sig~;
#X obj 61 386 env~;
#X floatatom 98 389 5 0 0 0 - - -;
#X obj 479 240 Scope~ 130 130 256 3 128 1 10 0 0 0 0 102 255 51 135
135 135 0;
#X msg 592 212 buffsize 1000;
#X msg 591 187 range 1 10;
#X connect 1 0 3 1;
#X connect 2 0 1 0;
#X connect 3 0 0 0;
#X connect 4 0 0 0;
#X connect 5 0 7 0;
#X connect 5 0 13 0;
#X connect 5 0 14 0;
#X connect 6 0 10 0;
#X connect 6 0 12 0;
#X connect 6 0 8 0;
#X connect 7 0 15 0;
#X connect 8 0 4 0;
#X connect 8 0 16 0;
#X connect 9 0 3 0;
#X connect 10 0 2 0;
#X connect 10 0 4 1;
#X connect 10 0 18 0;
#X connect 11 0 9 0;
#X connect 12 0 11 0;
#X connect 14 0 10 1;
#X connect 14 0 12 1;
#X connect 15 0 10 2;
#X connect 16 0 17 0;
#X connect 19 0 18 0;
#X connect 20 0 18 0;
#X restore 82 543 pd crossfade;
#X obj 68 163 dbtorms;
#X obj 68 199 line~;
#X obj 68 181 pack 0 50;
#X obj 68 562 *~;
#X obj 81 289 phasor~ 1;
#X obj 81 255 expr 1/$f1;
#X obj 67 582 hip~ 5;
#X floatatom 242 507 5 0 0 0 - - -;
#X obj 97 501 line~;
#X obj 97 483 pack f 50;
#X obj 82 521 *~;
#X floatatom 97 436 5 0 0 0 - - -;
#X obj 68 92 vsl 15 64 0 127 0 0 empty empty empty 0 -9 0 10 -262144
-1 -1 0 1;
#X obj 412 329 pack 0 \$0;
#X obj 430 251 samplerate~;
#X obj 412 299 *;
#X obj 412 222 t a b;
#X msg 413 359 \; \$2_n resize \$1 \;;
#X obj 413 181 r \$0-buffsize;
#X obj 581 273 soundfiler;
#X obj 581 213 openpanel;
#X obj 581 233 pack s \$0;
#X obj 581 323 /;
#X obj 720 305 * 44100;
#X obj 599 297 s \$0-enpoint;
#X obj 81 233 r \$0-loop-len;
#X obj 66 615 dac~;
#X floatatom 413 202 5 0 100 0 - - -;
#X obj 581 192 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144
-1 -1;
#X obj 410 31 \$0;
#X obj 410 11 loadbang;
#X obj 383 29 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1
-1;
#X obj 151 508 r \$0-fade-len;
#X obj 720 243 r \$0-loop-len;
#X text 512 71 in seconds;
#X text 573 165 opensoundfile;
#X obj 227 312 tabwrite~ \$0_n;
#X obj 217 280 adc~;
#X msg 255 282 start;
#X msg 297 282 stop;
#X obj 264 252 del 1000;
#X obj 309 212 r \$0-looplen;
#X obj 242 193 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144
-1 -1;
#X text 239 168 record;
#X msg 581 253 read -resize \$1 \$2_n;
#X obj 211 65 s \$0-loop-len;
#X floatatom 211 44 5 0 0 0 - - -;
#X obj 212 23 r \$0-loop-len-r;
#X obj 151 526 expr 1/pow($f1 \, 2);
#X msg 410 51 \; \$1-loop-len-r 2 \; \$1-buffsize 4 \; \$1-fade-len
0.5;
#X obj 309 232 * 2000;
#X obj 581 363 s \$0-looptune;
#X obj 97 415 r \$0-looptune;
#X obj 747 284 samplerate~;
#X obj 720 264 t a b;
#X connect 1 0 5 1;
#X connect 2 0 4 0;
#X connect 3 0 5 0;
#X connect 4 0 3 0;
#X connect 5 0 8 0;
#X connect 6 0 12 0;
#X connect 7 0 6 0;
#X connect 8 0 28 0;
#X connect 8 0 28 1;
#X connect 9 0 50 0;
#X connect 10 0 12 1;
#X connect 11 0 10 0;
#X connect 12 0 1 0;
#X connect 13 0 11 0;
#X connect 14 0 2 0;
#X connect 15 0 19 0;
#X connect 16 0 17 1;
#X connect 17 0 15 0;
#X connect 18 0 17 0;
#X connect 18 1 16 0;
#X connect 20 0 29 0;
#X connect 21 0 26 0;
#X connect 21 0 24 0;
#X connect 22 0 23 0;
#X connect 23 0 46 0;
#X connect 24 0 53 0;
#X connect 25 0 24 1;
#X connect 27 0 7 0;
#X connect 29 0 18 0;
#X connect 30 0 22 0;
#X connect 31 0 51 0;
#X connect 32 0 31 0;
#X connect 33 0 31 0;
#X connect 34 0 50 0;
#X connect 35 0 56 0;
#X connect 39 0 38 0;
#X connect 40 0 38 0;
#X connect 41 0 38 0;
#X connect 42 0 41 0;
#X connect 43 0 52 0;
#X connect 44 0 40 0;
#X connect 44 0 42 0;
#X connect 46 0 21 0;
#X connect 48 0 47 0;
#X connect 49 0 48 0;
#X connect 50 0 1 1;
#X connect 52 0 42 1;
#X connect 54 0 13 0;
#X connect 55 0 25 1;
#X connect 56 0 25 0;
#X connect 56 1 55 0;
_______________________________________________
[email protected] mailing list
UNSUBSCRIBE and account-management -> 
http://lists.puredata.info/listinfo/pd-list

Reply via email to