I've made a demo patch that will store some arbitrary lists (although I've only 
tested 

it with note-on note-off pairs) with the ability to undo the last list entered. 
I went back 

to vanilla [textfile] as [coll] and [msgfile] didn't really provide an 
advantage (that I 

could patch! Not saying much).


The patch works as a kind of MIDI loop recorder using the Z key as a kind of 
drum 

pad to play a kick drum. The C key performs an undo on the last note recorded 
and 

the X key performs a kind of MPC style note erase function (erase notes at the 

current time).

Thanks to Joe White for the idea of using an index to keep track of the number 
of 

lists being held.

Would love to hear of any improvements if anyone has the time to look!?


The main mechanism of the patch is rather ugly. It relies on constantly 
flushing the 

entire textfile contents and searching for a match each time.

Thanks in advance,
John.
#N canvas 212 115 875 505 10;
#X obj 482 387 noteout;
#X obj 70 21 key;
#X obj 220 21 keyup;
#X msg 70 94 36 127;
#X msg 170 94 36 0;
#X msg 484 181 0;
#X msg 484 161 stop;
#X text 500 142 play;
#X obj 484 143 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144
-1 -1;
#X floatatom 467 280 5 0 0 0 - - -;
#X text 511 181 rewind;
#X obj 452 213 metro 1;
#X obj 563 431 s_drumelectro;
#X obj 574 371 stripnote;
#X obj 452 255 mod 2500;
#X msg 563 402 bd 500;
#X obj 192 260 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 1
1;
#X obj 452 234 f;
#X obj 486 234 + 1;
#X msg 192 280 record \$1;
#N canvas 210 102 926 626 store-lists-with-undo 0;
#X obj 25 8 inlet;
#X text 71 9 lists in;
#X obj 187 8 inlet;
#X obj 25 119 list prepend;
#X obj 25 274 value \$0-amount-of-lists;
#X obj 25 330 list append;
#X obj 25 172 spigot;
#X obj 258 514 list split 1;
#X obj 356 544 route;
#X obj 356 576 outlet;
#X obj 152 394 r \$0-clear-lists;
#X obj 64 509 s \$0-lists-out;
#X obj 134 347 r \$0-bang-lists;
#X obj 624 434 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
1;
#X obj 585 451 spigot;
#X obj 475 412 r \$0-lists-out;
#X obj 585 473 t f;
#X obj 649 426 s \$0-bang-lists;
#X obj 564 381 t b b b b;
#X obj 566 526 value \$0-amount-of-lists;
#X obj 564 342 loadbang;
#X floatatom 292 291 5 0 0 0 - - -;
#X obj 514 359 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144
-1 -1;
#X obj 25 221 t b a b;
#X obj 246 245 + 1;
#X obj 71 245 value \$0-amount-of-lists;
#X obj 566 501 f -1;
#X text 646 357 Get amount of lists on load;
#X text 233 8 times in & other messages;
#X obj 121 144 > 0;
#X msg 152 415 clear;
#X msg 113 368 dump;
#X text 355 514 trim off list index;
#X text 445 43 else times in;
#X obj 180 446 r \$0-lists-in;
#X obj 405 102 s \$0-times-in;
#X obj 345 72 t b f f f;
#X msg 32 412 print;
#X obj 187 41 route record erase-last erase-time;
#N canvas 0 0 661 430 erase-last-function-guts 0;
#X obj 208 15 inlet;
#X obj 208 129 t b b b b b b b;
#X obj 77 181 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
1;
#X obj 38 198 spigot;
#X text 351 196 clear buffer;
#X obj 281 266 s \$0-clear-lists;
#X obj 214 366 value \$0-amount-of-lists;
#X obj 390 366 - 2;
#X obj 38 145 r \$0-lists-out;
#X obj 44 302 <=;
#X obj 21 223 t a f b;
#X obj 67 247 value \$0-amount-of-lists;
#X obj 67 269 - 2;
#X text 98 268 <-this will need \; a creation argument;
#X obj 21 328 spigot;
#X obj 295 241 s \$0-bang-lists;
#X obj 208 47 t b b;
#X obj 240 67 value \$0-amount-of-lists;
#X obj 240 87 >= 0;
#X obj 208 108 spigot;
#X text 424 366 <-this will need \; a creation argument;
#X msg 304 196 clear;
#X obj 251 301 jf/data/textfiler;
#X msg 247 279 dump;
#X obj 251 323 s \$0-lists-in;
#X text 454 87 erase-last function \; \; Erases the list entered \;
most recently.;
#X connect 0 0 16 0;
#X connect 1 0 2 0;
#X connect 1 1 6 0;
#X connect 1 2 23 0;
#X connect 1 3 5 0;
#X connect 1 4 15 0;
#X connect 1 5 21 0;
#X connect 1 6 2 0;
#X connect 2 0 3 1;
#X connect 3 0 10 0;
#X connect 6 0 7 0;
#X connect 7 0 6 0;
#X connect 8 0 3 0;
#X connect 9 0 14 1;
#X connect 10 0 14 0;
#X connect 10 1 9 0;
#X connect 10 2 11 0;
#X connect 11 0 12 0;
#X connect 12 0 9 1;
#X connect 14 0 22 1;
#X connect 16 0 19 0;
#X connect 16 1 17 0;
#X connect 17 0 18 0;
#X connect 18 0 19 1;
#X connect 19 0 1 0;
#X connect 21 0 22 0;
#X connect 22 0 24 0;
#X connect 23 0 22 0;
#X restore 420 206 pd erase-last-function-guts;
#N canvas 591 54 616 672 erase-time-function-guts 0;
#X obj 77 281 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
1;
#X obj 38 298 spigot;
#X text 421 293 clear buffer;
#X obj 351 363 s \$0-clear-lists;
#X obj 80 598 value \$0-amount-of-lists;
#X obj 38 245 r \$0-lists-out;
#X obj 365 338 s \$0-bang-lists;
#X obj 240 132 value \$0-amount-of-lists;
#X obj 240 152 >= 0;
#X obj 208 173 spigot;
#X msg 374 293 clear;
#X obj 321 498 jf/data/textfiler;
#X msg 311 374 dump;
#X obj 321 520 s \$0-lists-in;
#X text 56 53 Erase function;
#X obj 243 30 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
1;
#X obj 380 9 r \$0-times-in;
#X obj 208 73 spigot;
#X msg 452 64 1189;
#X obj 208 112 t f b;
#X obj 21 467 spigot;
#X obj 91 429 !=;
#X obj 208 229 t b b b b b b f b;
#X obj 44 364 list split 1;
#X obj 21 323 t a a b;
#X obj 84 384 t f;
#X obj 80 578 sel 0;
#X obj 256 598 - 1;
#X text 288 598 decrement if one erased;
#X text 137 373 get time only;
#X text 119 422 test for note at \; that time;
#X obj 215 28 > 0;
#X obj 215 8 inlet;
#X text 482 9 at this time;
#X text 258 9 erase notes y/n;
#X connect 0 0 1 1;
#X connect 1 0 24 0;
#X connect 4 0 27 0;
#X connect 5 0 1 0;
#X connect 7 0 8 0;
#X connect 8 0 9 1;
#X connect 9 0 22 0;
#X connect 10 0 11 0;
#X connect 11 0 13 0;
#X connect 12 0 11 0;
#X connect 15 0 17 1;
#X connect 16 0 17 0;
#X connect 17 0 19 0;
#X connect 18 0 19 0;
#X connect 19 0 9 0;
#X connect 19 1 7 0;
#X connect 20 0 11 1;
#X connect 21 0 20 1;
#X connect 21 0 26 0;
#X connect 22 0 0 0;
#X connect 22 2 12 0;
#X connect 22 3 3 0;
#X connect 22 4 6 0;
#X connect 22 5 10 0;
#X connect 22 6 21 1;
#X connect 22 7 0 0;
#X connect 23 1 25 0;
#X connect 24 0 20 0;
#X connect 24 1 23 0;
#X connect 25 0 21 0;
#X connect 26 0 4 0;
#X connect 27 0 4 0;
#X connect 31 0 17 1;
#X connect 32 0 31 0;
#X restore 420 177 pd erase-time-function-guts;
#N canvas 1 80 450 300 textfiler 0;
#X obj 50 180 textfile;
#X obj 181 115 list prepend add;
#X obj 181 134 list trim;
#X obj 18 142 until;
#X msg 78 128 rewind;
#X obj 18 100 t b b;
#X obj 18 17 inlet;
#X obj 181 16 inlet;
#X obj 50 250 outlet;
#X obj 103 250 outlet;
#X obj 18 68 route dump;
#X connect 0 0 8 0;
#X connect 0 1 3 1;
#X connect 0 1 9 0;
#X connect 1 0 2 0;
#X connect 2 0 0 0;
#X connect 3 0 0 0;
#X connect 4 0 0 0;
#X connect 5 0 3 0;
#X connect 5 1 4 0;
#X connect 6 0 10 0;
#X connect 7 0 1 0;
#X connect 10 0 5 0;
#X connect 10 1 0 0;
#X restore 64 474 pd textfiler;
#X connect 0 0 3 0;
#X connect 2 0 38 0;
#X connect 3 0 6 0;
#X connect 4 0 21 0;
#X connect 4 0 5 0;
#X connect 5 0 41 1;
#X connect 6 0 23 0;
#X connect 7 1 8 0;
#X connect 8 0 9 0;
#X connect 10 0 30 0;
#X connect 12 0 31 0;
#X connect 13 0 14 1;
#X connect 14 0 16 0;
#X connect 15 0 14 0;
#X connect 16 0 26 1;
#X connect 18 0 13 0;
#X connect 18 1 26 0;
#X connect 18 2 17 0;
#X connect 18 3 13 0;
#X connect 20 0 18 0;
#X connect 22 0 18 0;
#X connect 23 0 4 0;
#X connect 23 1 5 1;
#X connect 23 2 25 0;
#X connect 24 0 25 0;
#X connect 25 0 24 0;
#X connect 26 0 19 0;
#X connect 29 0 6 1;
#X connect 30 0 41 0;
#X connect 31 0 41 0;
#X connect 34 0 41 1;
#X connect 36 0 31 0;
#X connect 36 1 8 1;
#X connect 36 2 3 1;
#X connect 36 3 35 0;
#X connect 37 0 41 0;
#X connect 38 0 29 0;
#X connect 38 1 39 0;
#X connect 38 2 40 0;
#X connect 38 3 36 0;
#X connect 41 0 11 0;
#X connect 41 0 7 0;
#X restore 31 326 pd store-lists-with-undo;
#X obj 125 196 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
1;
#X msg 107 64 1;
#X msg 257 64 0;
#X msg 125 216 erase-time \$1;
#X msg 153 239 erase-last;
#X obj 176 116 s direct-z-off;
#X obj 561 345 r direct-z-off;
#X obj 76 116 s direct-z-on;
#X obj 535 326 r direct-z-on;
#X obj 84 429 print;
#X obj 553 469 dac~;
#X text 260 260 <-1. Enable record;
#X obj 70 43 sel 122 120 99;
#X obj 220 43 sel 122 120;
#X text 651 433 <-only needed to hear kick drums;
#X obj 463 341 print;
#X text 563 160 <-2. Press play to start loop running;
#X text 174 424 3 Play 'Z' key to record some notes \; 4 Hit 'C' key
to undo the last note recorded \; 5 Hold 'X' key to erase notes at
that time;
#X connect 1 0 33 0;
#X connect 2 0 34 0;
#X connect 3 0 20 0;
#X connect 3 0 28 0;
#X connect 4 0 20 0;
#X connect 4 0 26 0;
#X connect 5 0 17 0;
#X connect 6 0 11 0;
#X connect 8 0 11 0;
#X connect 11 0 17 0;
#X connect 12 0 31 0;
#X connect 12 0 31 1;
#X connect 13 0 15 0;
#X connect 14 0 9 0;
#X connect 14 0 20 1;
#X connect 15 0 12 0;
#X connect 16 0 19 0;
#X connect 17 0 18 0;
#X connect 17 0 14 0;
#X connect 18 0 17 1;
#X connect 19 0 20 1;
#X connect 20 0 0 0;
#X connect 20 0 13 0;
#X connect 20 0 30 0;
#X connect 21 0 24 0;
#X connect 22 0 21 0;
#X connect 23 0 21 0;
#X connect 24 0 20 1;
#X connect 25 0 20 1;
#X connect 27 0 0 0;
#X connect 27 0 36 0;
#X connect 29 0 15 0;
#X connect 29 0 0 0;
#X connect 29 0 36 0;
#X connect 33 0 3 0;
#X connect 33 1 22 0;
#X connect 33 2 25 0;
#X connect 34 0 4 0;
#X connect 34 1 23 0;
_______________________________________________
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management -> 
http://lists.puredata.info/listinfo/pd-list

Reply via email to