#N canvas 287 58 866 500 12;
#X declare -stdpath ./;
#X text 146 151 "set" message permits you to switch between arrays;
#X obj 105 454 tabwrite~;
#X obj 55 18 tabplay~;
#X obj 574 139 soundfiler;
#X obj 177 454 soundfiler;
#X obj 325 454 tabread4~;
#X msg 90 226 0 48000;
#X msg 84 201 48000;
#X text 101 176 "bang" or 0 plays whole sample;
#X text 131 200 play starting at 48000th sample;
#X text 148 224 play starting at beginning for 48000 samples;
#X msg 95 251 48000 1000;
#X text 173 250 play from 48000 through 45099 (1000 samples);
#X text 654 454 updated for Pd version 0.43;
#X msg 102 276 stop;
#X text 138 277 stop playing (outputs zeros when stopped);
#X obj 207 346 bng 23 250 50 0 empty empty empty 17 7 0 10 #dfdfdf #000000 #000000;
#X msg 63 151 set sample;
#X text 26 454 see also:;
#X obj 63 348 output~;
#X obj 699 145 declare -stdpath ./;
#X text 641 80 load table;
#X obj 574 80 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 392 pd Dealing_with_"\$0";
#X text 197 383 open subpatch to see how to deal with '\$0', f 21;
#X obj 399 453 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 431 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 502 454 pd array-examples;
#X text 237 349 <-- bang when finished playing the table;
#X obj 77 177 bng 17 250 50 0 empty empty empty 17 7 0 10 #dfdfdf #000000 #000000;
#X obj 259 454 tabread~;
#N canvas 519 131 758 403 multichannel 0;
#X obj 58 183 tabplay~ left right;
#X obj 58 281 output~;
#X obj 308 199 soundfiler;
#X obj 308 125 loadbang;
#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 obj 236 247 cnv 19 248 98 empty empty empty 20 12 0 12 #e0e0e0 #404040 0;
#X obj 497 247 cnv 19 248 98 empty empty empty 20 12 0 12 #e0e0e0 #404040 0;
#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;
#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 connect 0 0 6 0;
#X connect 0 1 10 0;
#X connect 3 0 11 0;
#X connect 5 0 0 0;
#X connect 6 0 1 0;
#X connect 6 1 1 1;
#X connect 7 0 0 0;
#X connect 8 0 0 0;
#X connect 11 0 2 0;
#X restore 721 373 pd multichannel;
#X text 570 358 mutichannel signal support ----------->, f 20;
#X text 122 17 - play back from tables (non-transposing);
#X msg 574 110 read ../sound/bell.aiff sample-table;
#X obj 63 303 tabplay~ sample-table;
#X text 219 302 argument initializes array name;
#X obj 578 216 cnv 19 248 98 empty empty empty 20 12 0 12 #e0e0e0 #404040 0;
#N canvas 0 0 450 300 (subpatch) 0;
#X array sample-table 155944 float 2;
#X coords 0 1 155944 -1 250 100 1 0 0;
#X restore 577 215 graph;
#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. This also means it is less flexible and can only play samples that have the same sample rate that Pd is running., f 62;
#X connect 6 0 38 0;
#X connect 7 0 38 0;
#X connect 11 0 38 0;
#X connect 14 0 38 0;
#X connect 17 0 38 0;
#X connect 22 0 37 0;
#X connect 32 0 38 0;
#X connect 37 0 3 0;
#X connect 38 0 19 0;
#X connect 38 1 16 0;
