#N canvas 556 34 719 445 12;
#X text 100 149 index;
#X obj 66 18 tabread;
#X floatatom 67 150 4 0 9 0 - - - 0;
#X floatatom 67 268 5 0 0 0 - - - 0;
#N canvas 0 22 450 300 (subpatch) 0;
#X array table-ex 10 float 3;
#A 0 1 4 2 8 5 6 1 4 2 8;
#X coords 0 10 10 0 250 200 1 0 0;
#X restore 391 151 graph;
#X text 191 216 creation argument;
#X text 193 232 gives array name;
#X text 177 184 change array name;
#X text 498 410 updated for Pd version 0.43;
#X obj 162 409 tabwrite;
#X obj 94 409 tabread4;
#X obj 67 224 tabread table-ex;
#X msg 83 184 set table-ex;
#X text 110 269 output = table-ex[index];
#N canvas 746 749 401 220 init-table 0;
#X obj 35 42 loadbang;
#X msg 35 74 \; table-ex resize 10 \; table-ex bounds 0 10 10 0 \; table-ex xlabel -0.2 0 1 2 3 4 5 6 7 8 9 \; table-ex ylabel -0.3 0 1 2 3 4 5 6 7 8 9 10 \; table-ex 0 1 4 2 8 5 6 1 4 2 8;
#X connect 0 0 1 0;
#X restore 545 127 pd init-table;
#N canvas 978 194 593 412 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 text 435 291 <= array with local name, f 13;
#X obj 221 291 f \$0;
#X msg 120 210 set \$1;
#X obj 120 184 symbol \$0-x;
#X obj 120 161 bng 15 250 50 0 empty empty empty 17 7 0 10 #fcfcfc #000000 #000000;
#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 139 158 click to set name;
#X floatatom 69 179 4 0 9 0 - - - 0;
#X floatatom 69 295 5 0 0 0 - - - 0;
#X obj 284 292 array define \$0-x 10;
#X msg 221 320 \; \$1-x 0 1 0 -1 0 1 0 -1 0 1 0;
#X obj 221 265 loadbang;
#X obj 69 251 tabread;
#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 connect 2 0 11 0;
#X connect 3 0 13 0;
#X connect 4 0 3 0;
#X connect 5 0 4 0;
#X connect 8 0 13 0;
#X connect 12 0 2 0;
#X connect 13 0 9 0;
#X restore 200 332 pd Dealing_with_"\$0";
#X text 38 323 open subpatch to see how to deal with '\$0', f 21;
#X text 129 18 - non-interpolating table lookup;
#N canvas 750 87 581 232 reference 0;
#X obj 15 51 cnv 5 550 5 empty empty INLET: 8 18 0 13 #202020 #000000 0;
#X obj 15 117 cnv 2 550 2 empty empty OUTLET: 8 12 0 13 #202020 #000000 0;
#X obj 15 162 cnv 2 550 2 empty empty ARGUMENT: 8 12 0 13 #202020 #000000 0;
#X obj 14 199 cnv 5 550 5 empty empty empty 8 18 0 13 #202020 #000000 0;
#X text 120 85 set <symbol> -;
#X text 169 65 float -;
#X obj 43 17 tabread;
#X text 106 17 - non-interpolating table lookup.;
#X text 225 65 sets table index and output its value.;
#X text 225 85 set the table name., f 38;
#X text 169 130 float -;
#X text 225 130 value of index input.;
#X text 133 171 1) symbol - sets table name with the sample.;
#X restore 511 18 pd reference;
#X text 609 17 <= click;
#X obj 8 52 cnv 1 700 1 empty empty empty 8 12 0 13 #000000 #000000 0;
#X obj 8 392 cnv 1 700 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 339 409 pd array-examples;
#X text 19 408 see also:;
#X text 51 61 The [tabread] object reads values from an array ("table") according to an index. The index is rounded down to the next lower integer. Values in the table correspond to indices (starting at 0). Indices outside of the range are replaced by the nearest index in range (from 0 to 9 in this example)., f 84;
#X obj 228 409 tabread~;
#X obj 294 409 array;
#X connect 2 0 11 0;
#X connect 11 0 3 0;
#X connect 12 0 11 0;
