[PD] Seamless playback, now with demo patch

Florian Hollerweger flo at mur.at
Sat Jan 17 17:56:05 CET 2009


Hi again,

This little demo patch illustrates seamless recording as well as the 
suggested [z~]-hack for seamless playback:

best,
flo.H



#N canvas 0 0 918 623 10;
#X obj 132 338 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144
-1 -1;
#X obj 76 464 readsf~;
#X obj 132 518 readsf~;
#X msg 36 410 1;
#X msg 122 491 1;
#X obj 67 582 dac~;
#X msg 76 410 open test1.wav;
#X obj 355 67 loadbang;
#X msg 49 170 stop;
#X obj 110 180 osc~ 220;
#X msg 215 170 stop;
#X obj 26 217 writesf~;
#X obj 192 217 writesf~;
#X obj 145 71 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1
-1;
#X msg 26 143 open test1.wav \, start;
#X msg 192 143 open test2.wav \, start;
#X obj 145 106 del 2000;
#X obj 215 106 del 4000;
#X obj 67 503 *~ 0.2;
#X obj 132 545 *~ 0.2;
#X obj 36 373 del 500;
#X obj 132 582 writesf~;
#X msg 355 94 \; pd dsp 1;
#X msg 336 518 start;
#X msg 195 545 stop;
#X msg 132 437 open test2.wav;
#X msg 205 518 open merged.wav;
#X text 94 374 Give soundfile time to load;
#X text 13 16 (A) Seamless recording of two (16 bit) files works fine
(which one can see and hear when merging test1.wav and test2.wav e.g.
with 'sox test1.wav test2.wav merged.wav'):;
#X text 8 269 (B) But seamless playback does not work: recording the
result to a file 'merged.wav' and inspecting it in an audio editor
yields a gap of exactly one audio block at the transition point (64
samples if Pd's standard blocksize is used):;
#X obj 633 112 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144
-1 -1;
#X obj 577 238 readsf~;
#X obj 633 292 readsf~;
#X msg 537 184 1;
#X msg 623 265 1;
#X obj 508 356 dac~;
#X msg 577 184 open test1.wav;
#X obj 509 280 *~ 0.2;
#X obj 633 319 *~ 0.2;
#X obj 537 147 del 500;
#X obj 633 356 writesf~;
#X msg 837 292 start;
#X msg 706 319 stop;
#X msg 633 211 open test2.wav;
#X obj 509 253 z~ 64;
#X obj 509 226 readsf~;
#X text 476 32 C) A seamless playback hack with zexy's [z~]: At the
cost of an additional [readsf~] object \, we delay playback of the
first file by 64 samples using zexy's [z~] \, and use the original
(undelayed) [readsf~] only for the 'playback done' bang at its right
outlet. This allows for seamless playback.;
#X msg 706 292 open merged.wav;
#X connect 0 0 6 0;
#X connect 0 0 25 0;
#X connect 0 0 20 0;
#X connect 0 0 26 0;
#X connect 1 0 18 0;
#X connect 1 1 4 0;
#X connect 2 0 19 0;
#X connect 2 1 24 0;
#X connect 3 0 1 0;
#X connect 4 0 2 0;
#X connect 6 0 1 0;
#X connect 7 0 22 0;
#X connect 8 0 11 0;
#X connect 9 0 11 0;
#X connect 9 0 12 0;
#X connect 10 0 12 0;
#X connect 13 0 14 0;
#X connect 13 0 16 0;
#X connect 13 0 17 0;
#X connect 14 0 11 0;
#X connect 15 0 12 0;
#X connect 16 0 8 0;
#X connect 16 0 15 0;
#X connect 17 0 10 0;
#X connect 18 0 5 0;
#X connect 18 0 5 1;
#X connect 18 0 21 0;
#X connect 19 0 5 0;
#X connect 19 0 5 1;
#X connect 19 0 21 0;
#X connect 20 0 3 0;
#X connect 20 0 23 0;
#X connect 23 0 21 0;
#X connect 24 0 21 0;
#X connect 25 0 2 0;
#X connect 26 0 21 0;
#X connect 30 0 36 0;
#X connect 30 0 43 0;
#X connect 30 0 39 0;
#X connect 30 0 47 0;
#X connect 31 1 34 0;
#X connect 32 0 38 0;
#X connect 32 1 42 0;
#X connect 33 0 31 0;
#X connect 33 0 45 0;
#X connect 34 0 32 0;
#X connect 36 0 31 0;
#X connect 36 0 45 0;
#X connect 37 0 35 0;
#X connect 37 0 35 1;
#X connect 37 0 40 0;
#X connect 38 0 35 0;
#X connect 38 0 35 1;
#X connect 38 0 40 0;
#X connect 39 0 33 0;
#X connect 39 0 41 0;
#X connect 41 0 40 0;
#X connect 42 0 40 0;
#X connect 43 0 32 0;
#X connect 44 0 37 0;
#X connect 45 0 44 0;
#X connect 47 0 40 0;




More information about the Pd-list mailing list