#N canvas 404 23 874 520 12;
#X declare -stdpath ./;
#N canvas 0 0 450 300 (subpatch) 0;
#X array sample 155944 float 0;
#X coords 0 1 155943 -1 250 200 1 0 0;
#X restore 568 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 248 475 tabread;
#X obj 307 475 tabwrite;
#X obj 55 18 tabplay~;
#X obj 550 137 soundfiler;
#X floatatom 550 163 7 0 0 0 - - - 0;
#X obj 374 475 soundfiler;
#X obj 176 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 165 328 bng 19 250 50 0 empty empty empty 17 7 0 10 #dfdfdf #000000 #000000;
#X text 122 17 - play a table as a sample (non-transposing);
#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 42 412 declare -stdpath ./;
#X msg 550 105 read -resize ../sound/bell.aiff sample;
#X text 617 75 load table;
#X obj 550 75 loadbang;
#N canvas 773 194 593 443 Dealing_with_"\$0" 0;
#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 specially useful in abstractions so each copy has local names instead of global., f 70;
#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 connect 2 0 10 0;
#X connect 4 0 12 0;
#X connect 5 0 4 0;
#X connect 8 0 9 0;
#X connect 10 0 8 0;
#X connect 11 0 2 0;
#X connect 12 0 3 0;
#X connect 12 0 3 1;
#X connect 14 0 12 0;
#X connect 15 0 5 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 459 475 array;
#N canvas 750 87 580 357 reference 0;
#X obj 13 52 cnv 5 550 5 empty empty INLETS: 8 18 0 13 #202020 #000000 0;
#X obj 13 186 cnv 2 550 2 empty empty OUTLETS: 8 12 0 13 #202020 #000000 0;
#X obj 13 293 cnv 2 550 2 empty empty ARGUMENT: 8 12 0 13 #202020 #000000 0;
#X obj 12 330 cnv 5 550 5 empty empty empty 8 18 0 13 #202020 #000000 0;
#X obj 13 248 cnv 1 550 1 empty empty 2nd: 8 12 0 13 #7c7c7c #000000 0;
#X obj 13 209 cnv 1 550 1 empty empty 1st: 8 12 0 13 #7c7c7c #000000 0;
#X text 58 160 set <symbol> -;
#X text 114 85 bang -;
#X text 163 85 plays the whole sample (same as '0')., f 46;
#X text 107 66 float -;
#X text 115 19 - play a table as a sample (non-transposing).;
#X text 163 66 sets starting sample and plays the sample., f 46;
#X text 114 103 list -;
#X text 163 103 1st element sets starting sample and 2nd element sets duration in samples.;
#X text 114 139 stop -;
#X text 163 139 stop playing (outputs zeros when stopped)., f 46;
#X text 163 160 set the table with the sample., f 53;
#X text 121 216 signal - sample output., f 54;
#X text 135 255 bang - bang when finished playing the table., f 54;
#X obj 45 18 tabplay~;
#X text 121 302 1) symbol - sets table name with the sample.;
#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 187 328 <-- 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 connect 7 0 8 0;
#X connect 11 0 23 0;
#X connect 12 0 23 0;
#X connect 16 0 23 0;
#X connect 19 0 23 0;
#X connect 23 0 26 0;
#X connect 23 0 26 1;
#X connect 23 1 21 0;
#X connect 24 0 23 0;
#X connect 28 0 7 0;
#X connect 30 0 28 0;
#X connect 41 0 23 0;
