#N canvas 298 23 870 513 12;
#X declare -stdpath ./;
#N canvas 0 0 450 300 (subpatch) 0;
#X array sample 155944 float 2;
#X coords 0 1 155944 -1 250 100 1 0 0;
#X restore 557 212 graph;
#X text 148 139 "set" message permits you to switch between arrays;
#X text 174 291 creation argument initializes array name;
#X obj 105 475 tabwrite~;
#X obj 55 18 tabplay~;
#X obj 574 143 soundfiler;
#X obj 177 475 soundfiler;
#X obj 325 475 tabread4~;
#X msg 90 214 0 44100;
#X msg 84 189 44100;
#X text 101 164 "bang" or 0 plays whole sample;
#X text 131 188 play starting at 44100th sample;
#X text 148 212 play starting at beginning for 44100 samples;
#X msg 95 239 44100 1000;
#X text 173 238 play from 44100 through 45099 (1000 samples);
#X text 647 476 updated for Pd version 0.43;
#X msg 102 264 stop;
#X text 138 265 stop playing (outputs zeros when stopped);
#X obj 187 336 bng 23 250 50 0 empty empty empty 17 7 0 10 #dfdfdf #000000 #000000;
#X obj 63 291 tabplay~ sample;
#X msg 63 139 set sample;
#X text 26 475 see also:;
#X obj 63 336 output~;
#X obj 48 417 declare -stdpath ./;
#X text 641 84 load table;
#X obj 574 84 loadbang;
#N canvas 642 190 593 443 Dealing_with_"\$0" 0;
#X obj 316 280 array define \$0-x;
#X obj 227 300 f \$0;
#X obj 62 290 output~;
#X msg 100 205 set \$1;
#X obj 100 179 symbol \$0-x;
#X text 227 197 You can also load '\$0' in a float object and send it to a message that works like a send to send messages to an array., f 40;
#X text 123 152 click to set name;
#X obj 227 361 soundfiler;
#X floatatom 227 387 7 0 0 0 - - - 0;
#X msg 227 329 read -resize ../sound/bell.aiff \$1-x;
#X obj 227 274 loadbang;
#X obj 62 240 tabplay~;
#X text 36 86 You can use "\$0" in an array name and if you need to set the array name you can load it in a symbol object \, since "\$0" doesn't work in messages., f 70;
#X obj 62 189 bng 19 250 50 0 empty empty empty 17 7 0 10 #dfdfdf #000000 #000000;
#X obj 100 152 bng 19 250 50 0 empty empty empty 17 7 0 10 #dfdfdf #000000 #000000;
#X text 448 281 <- array with local name, f 13;
#X text 36 33 '\$0' - the patch ID number used to force locality in Pd - is widely used in send/receive names as well as array names. This is especially useful in abstractions so each copy has local names instead of global., f 70;
#X connect 1 0 9 0;
#X connect 3 0 11 0;
#X connect 4 0 3 0;
#X connect 7 0 8 0;
#X connect 9 0 7 0;
#X connect 10 0 1 0;
#X connect 11 0 2 0;
#X connect 13 0 11 0;
#X connect 14 0 4 0;
#X restore 359 383 pd Dealing_with_"\$0";
#X text 197 374 open subpatch to see how to deal with '\$0', f 21;
#X obj 399 474 array;
#N canvas 677 98 580 357 reference 0;
#X obj 18 51 cnv 5 550 5 empty empty INLETS: 8 18 0 13 #202020 #000000 0;
#X obj 18 185 cnv 2 550 2 empty empty OUTLETS: 8 12 0 13 #202020 #000000 0;
#X obj 18 292 cnv 2 550 2 empty empty ARGUMENT: 8 12 0 13 #202020 #000000 0;
#X obj 17 337 cnv 5 550 5 empty empty empty 8 18 0 13 #202020 #000000 0;
#X obj 18 247 cnv 1 550 1 empty empty 2nd: 8 12 0 13 #7c7c7c #000000 0;
#X obj 18 208 cnv 1 550 1 empty empty 1st: 8 12 0 13 #7c7c7c #000000 0;
#X text 125 84 bang -;
#X text 118 65 float -;
#X text 125 102 list -;
#X text 174 102 1st element sets starting sample and 2nd element sets duration in samples.;
#X text 125 138 stop -;
#X text 174 138 stop playing (outputs zeros when stopped)., f 53;
#X obj 50 19 tabplay~;
#X text 120 20 - play back from tables (non-transposing).;
#X text 174 65 sets starting sample and starts playing.;
#X text 174 84 plays the whole table(s) - same as '0'.;
#X text 83 159 set <list> -;
#X text 90 216 signal(s) - one or more channel with audio from tables.;
#X text 125 257 bang - bang when finished playing the tables., f 54;
#X text 147 305 1) list - sets tables with audio to play.;
#X text 174 159 sets tables with audio to play., f 53;
#X restore 659 18 pd reference;
#X text 757 17 <= click;
#X obj 8 52 cnv 1 850 1 empty empty empty 8 12 0 13 #000000 #000000 0;
#X obj 8 452 cnv 1 850 1 empty empty empty 8 12 0 13 #000000 #000000 0;
#N canvas 643 412 384 186 array-examples 0;
#N canvas 491 316 457 285 open 0;
#X obj 120 23 inlet;
#X obj 173 121 pdcontrol;
#X msg 173 94 dir;
#X obj 120 181 pack s s;
#X obj 173 64 loadbang;
#X msg 120 212 \; pd open \$1 \$2;
#X obj 173 151 makefilename %s/../2.control.examples;
#X connect 0 0 3 0;
#X connect 1 0 6 0;
#X connect 2 0 1 0;
#X connect 3 0 5 0;
#X connect 4 0 2 0;
#X connect 6 0 3 1;
#X restore 52 131 pd open;
#X msg 52 76 15.array.pd;
#X msg 62 102 16.more.arrays.pd;
#X text 144 77 <-- click to open examples.;
#X text 47 22 See also and the "array" examples from the section 2 of Pd's tutorial:, f 39;
#X connect 1 0 0 0;
#X connect 2 0 0 0;
#X restore 507 475 pd array-examples;
#X text 62 67 The [tabplay~] object plays a sample \, or part of one \, with no transposition or interpolation. It is cheaper than [tabread4~] and there are none of [tabread4~]'s interpolation artifacts., f 62;
#X text 217 339 <-- bang when finished playing the table;
#X obj 77 165 bng 17 250 50 0 empty empty empty 17 7 0 10 #dfdfdf #000000 #000000;
#X obj 259 475 tabread~;
#N canvas 519 131 758 403 multichannel 0;
#X obj 58 183 tabplay~ left right;
#X obj 58 281 output~;
#N canvas 0 0 450 300 (subpatch) 0;
#X array right 62079 float 2;
#X coords 0 1 62079 -1 250 100 1 0 0;
#X restore 496 246 graph;
#X obj 308 199 soundfiler;
#X obj 308 125 loadbang;
#N canvas 0 0 450 300 (subpatch) 0;
#X array left 155944 float 2;
#X coords 0 1 155944 -1 250 100 1 0 0;
#X restore 235 246 graph;
#X text 375 125 load tables;
#X obj 58 121 bng 22 250 50 0 empty empty empty 0 -10 0 12 #dfdfdf #000000 #000000;
#X obj 58 227 snake~ out;
#X msg 118 116 set right left;
#X msg 133 148 set left right;
#X text 82 23 [tabplay~] generates multichannel signals if you give it more than one argument. Each channel then corresponds to an argument/table. The "set" message can also replace more than one table name. Note that the arrays do not need to be of the same length and \, in which case the bang output is only sent when reaching the end of the largest table., f 86;
#X obj 188 215 bng 19 250 50 0 empty empty empty 0 -10 0 12 #dfdfdf #000000 #000000;
#X msg 308 155 read ../sound/bell.aiff left \, read ../sound/voice.wav right, f 29;
#X connect 0 0 8 0;
#X connect 0 1 12 0;
#X connect 4 0 13 0;
#X connect 7 0 0 0;
#X connect 8 0 1 0;
#X connect 8 1 1 1;
#X connect 9 0 0 0;
#X connect 10 0 0 0;
#X connect 13 0 3 0;
#X restore 705 382 pd multichannel;
#X text 554 367 mutichannel signal support ----------->, f 20;
#X msg 574 114 read ../sound/bell.aiff sample;
#X text 122 17 - play back from tables (non-transposing);
#X connect 8 0 19 0;
#X connect 9 0 19 0;
#X connect 13 0 19 0;
#X connect 16 0 19 0;
#X connect 19 0 22 0;
#X connect 19 1 18 0;
#X connect 20 0 19 0;
#X connect 25 0 40 0;
#X connect 36 0 19 0;
#X connect 40 0 5 0;
