#N canvas 293 72 847 570 12;
#X obj 36 431 snapshot~;
#X obj 36 175 sig~;
#X floatatom 36 149 6 1 8 0 - - - 0;
#X floatatom 36 457 6 0 0 0 - - - 0;
#X obj 44 17 tabread4~;
#X obj 94 511 tabwrite~;
#X obj 298 511 tabsend~;
#X obj 94 537 tabreceive~;
#X obj 165 511 tabplay~;
#X floatatom 166 280 5 0 10 0 - - - 0;
#X obj 220 399 ../3.audio.examples/B15.tabread4~-onset;
#X obj 181 537 tabosc4~;
#X obj 249 537 soundfiler;
#N canvas 780 240 401 220 init-table 0;
#X obj 35 42 loadbang;
#X msg 35 74 \; table2-ex resize 10 \; table2-ex bounds 0 10 10 0 \; table2-ex xlabel -0.2 0 1 2 3 4 5 6 7 8 9 \; table2-ex ylabel -0.3 0 1 2 3 4 5 6 7 8 9 10 \; table2-ex 0 1 4 2 8 5 6 1 7 4 2;
#X connect 0 0 1 0;
#X restore 727 78 pd init-table;
#X obj 36 343 tabread4~ table2-ex;
#X msg 52 217 set table2-ex;
#X text 124 16 - 4-point-interpolating table lookup for signals;
#N canvas 721 150 593 441 Dealing_with_"\$0" 0;
#X text 462 275 <= array with local name, f 13;
#X obj 221 291 f \$0;
#X msg 121 210 set \$1;
#X obj 121 184 symbol \$0-x;
#X obj 121 159 bng 19 250 50 0 empty empty empty 17 7 0 10 #dfdfdf #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 146 158 click to set name;
#X floatatom 67 188 6 1 8 0 - - - 0;
#X obj 311 276 array define \$0-x 10;
#X msg 221 320 \; \$1-x 0 1 0 -1 0 1 0 -1 1 0 -1;
#X obj 221 264 loadbang;
#X obj 67 251 tabread4~;
#X obj 67 345 snapshot~;
#X obj 86 313 metro 200;
#X floatatom 67 371 6 0 0 0 - - - 0;
#X obj 86 289 loadbang;
#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 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 2 0 11 0;
#X connect 3 0 2 0;
#X connect 4 0 3 0;
#X connect 7 0 11 0;
#X connect 10 0 1 0;
#X connect 11 0 12 0;
#X connect 12 0 14 0;
#X connect 13 0 12 0;
#X connect 15 0 13 0;
#X restore 363 442 pd Dealing_with_"\$0";
#X obj 39 121 hsl 162 19 1 8 0 0 empty empty empty -2 -8 0 10 #dfdfdf #000000 #000000 0 1;
#N canvas 613 110 573 306 reference 0;
#X obj 11 52 cnv 5 550 5 empty empty INLET: 8 18 0 13 #202020 #000000 0;
#X obj 11 190 cnv 2 550 2 empty empty OUTLET: 8 12 0 13 #202020 #000000 0;
#X obj 11 245 cnv 2 550 2 empty empty ARGUMENT: 8 12 0 13 #202020 #000000 0;
#X obj 10 282 cnv 5 550 5 empty empty empty 8 18 0 13 #202020 #000000 0;
#X obj 37 20 tabread4~;
#X text 117 20 - 4-point-interpolating table lookup for signals.;
#X obj 11 152 cnv 1 550 1 empty empty 2nd: 8 12 0 13 #7c7c7c #000000 0;
#X obj 11 85 cnv 1 550 1 empty empty 1st: 8 12 0 13 #7c7c7c #000000 0;
#X text 145 161 sets table onset., f 42;
#X text 61 212 signal(s) -;
#X text 145 212 value(s) of index input from given table(s).;
#X text 98 257 1) list - sets table names to read from.;
#X text 82 161 signal -;
#X text 54 115 set <list> -;
#X text 145 115 set the table names. No argument unsets the object. Setting the table names also sets the number of channels., f 57;
#X text 61 95 signal(s) -;
#X text 145 95 sets index(es) for table(s) with interpolation.;
#X restore 662 17 pd reference;
#X text 760 16 <= click;
#X obj 8 50 cnv 1 830 1 empty empty empty 8 12 0 13 #000000 #000000 0;
#X text 234 360 Open this example for more details on setting onset:, f 35;
#X obj 8 499 cnv 1 830 1 empty empty empty 8 12 0 13 #000000 #000000 0;
#X text 18 524 see also:;
#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 331 537 pd array-examples;
#X msg 457 244 \; pd dsp \$1;
#X obj 457 209 set-dsp-tgl;
#X text 374 212 DSP on/off;
#N canvas 630 190 566 524 multichannel 0;
#X floatatom 70 194 6 0 10 0 - - - 0;
#X obj 69 448 snapshot~;
#X obj 90 406 r bang;
#X msg 102 286 set array100 array99;
#X obj 69 364 tabread4~ array99 array100;
#X obj 319 244 cnv 19 198 98 empty empty empty 20 12 0 12 #e0e0e0 #404040 0;
#X obj 319 371 cnv 19 198 98 empty empty empty 20 12 0 12 #e0e0e0 #404040 0;
#N canvas 0 22 450 300 (subpatch) 0;
#X array array99 10 float 3;
#A 0 2.824 1.366 3.094 1.636 0.610006 4.552 1.906 0.826005 3.364 1.96001;
#A color 0;
#A width 2;
#X coords 0 5.2 10 -0.2 200 100 1 0 0;
#X restore 319 243 graph;
#N canvas 0 22 450 300 (subpatch) 0;
#X array array100 10 float 3;
#A 0 0.502 0.771999 1.096 1.582 2.122 2.662 3.20199 3.57999 3.95799 4.44399;
#A color 0;
#A width 2;
#X coords 0 5.2 10 -0.2 200 100 1 0 0;
#X restore 318 370 graph;
#X listbox 69 483 18 0 0 0 - - - 0;
#X msg 113 320 set array99;
#X obj 70 220 sig~ 0 0;
#X msg 87 258 set array99 array100 array99;
#X floatatom 123 194 6 0 10 0 - - - 0;
#X text 30 23 The number of channels in [tabread4~] depends on the maximum of input channels and given tables. If both are of the same size \, each input signal corresponds to an index of a given table. In case the numbers mismatch \, the smaller wraps around until reaching the number of the bigger one (like [*~] and other math objects). This is especially useful when you have a single input to read from many tables or use a single table as a waveshaper for multichannel inputs. The "set" message resets the table names and can change the number of signals in the output. Note that the arrays do not need to be of the same length and that you can repeat array names., f 72;
#X connect 0 0 11 0;
#X connect 1 0 9 0;
#X connect 2 0 1 0;
#X connect 3 0 4 0;
#X connect 4 0 1 0;
#X connect 10 0 4 0;
#X connect 11 0 4 0;
#X connect 12 0 4 0;
#X connect 13 0 11 1;
#X restore 681 367 pd multichannel;
#X obj 128 422 metro 200;
#X obj 128 395 loadbang;
#X obj 128 450 s bang;
#X obj 56 398 r bang;
#X text 212 275 set table onset to improve the accuracy of indexing (useful if you have Pd compiled for single precision), f 31;
#X text 157 210 "set" message lets you switch between arrays, f 22;
#X text 102 280 onset ->;
#X obj 573 103 cnv 19 248 198 empty empty empty 20 12 0 12 #e0e0e0 #404040 0;
#N canvas 0 22 450 300 (subpatch) 0;
#X array table2-ex 10 float 2;
#A color 0;
#A width 2;
#X coords 0 10 10 0 250 200 1 0 0;
#X xlabel -0.2 0 1 2 3 4 5 6 7 8 9;
#X ylabel -0.3 0 1 2 3 4 5 6 7 8 9 10;
#X restore 572 102 graph;
#X obj 166 311 sig~;
#X text 30 63 [tabread4~] is used to build samplers with more flexibility than [tabplay~] and other table lookup algorithms. The interpolation scheme is 4-point polynomial as used in [delread4~] and [tabosc4~]., f 67;
#N canvas 426 196 912 548 player-examples 0;
#X obj 59 355 soundfiler;
#X floatatom 59 384 7 0 0 0 - - - 12;
#X listbox 126 384 16 0 0 0 - - - 0;
#X obj 45 164 cnv 19 248 98 empty empty empty 20 12 0 12 #e0e0e0 #404040 0;
#N canvas 0 22 450 300 (subpatch) 0;
#X array tabread4 169735 float 2;
#A color 0;
#A width 2;
#X coords 0 1 169735 -1 250 100 1 0 0;
#X restore 44 163 graph;
#X msg 59 322 read -resize ../sound/bell.aiff tabread4;
#X obj 59 293 loadbang;
#X msg 126 410 \$1;
#X obj 59 437 s size;
#X obj 126 437 s fileSR;
#X obj 439 146 r size;
#X obj 464 174 r fileSR;
#X obj 439 203 swap;
#X floatatom 439 260 9 0 0 0 - - - 0;
#X obj 439 231 /;
#X obj 439 334 phasor~;
#X obj 439 398 tabread4~ tabread4;
#X obj 439 439 output~;
#X obj 439 293 *~ 1;
#X obj 439 364 *~;
#X obj 475 364 r size;
#X msg 485 308 0;
#X floatatom 524 239 7 -200 200 0 - - - 0;
#X obj 524 265 / 100;
#X text 340 245 Reading frequency -->, f 13;
#X obj 703 89 r size;
#X obj 763 89 r fileSR;
#X obj 735 151 /;
#X obj 735 182 * 1000;
#X obj 703 122 t f f;
#X listbox 682 308 16 0 0 0 - - - 0;
#X obj 647 188 metro;
#X obj 647 154 tgl 19 0 empty empty empty 0 -10 0 12 #dfdfdf #000000 #000000 0 1;
#X msg 682 334 0 \, \$1 \$2;
#X obj 682 364 line~;
#X obj 682 398 tabread4~ tabread4;
#X obj 682 439 output~;
#X obj 647 220 bng 19 250 50 0 empty empty empty 0 -10 0 12 #dfdfdf #000000 #000000;
#X floatatom 795 138 5 50 200 0 - - - 0;
#X obj 795 162 / 100;
#X obj 795 186 t b f;
#X obj 735 226 / 1;
#X obj 682 250 f;
#X obj 682 275 pack f f;
#X text 801 279 size and duration <-- in ms, f 9;
#X text 36 19 To build a playing sampler with [tabread4~] we need to load a file into an array with [soundfiler] and get its size in samples and sample rate. Two looping samplers are provided here implemented with [phasor~] and [line~] \, both of which can play the sample with different speeds., f 43;
#X text 512 212 speed (%);
#X text 789 118 speed (%);
#X text 516 308 restart;
#X text 387 20 The [phasor~] method is always looping and can easily switch to play backwards with negative speeds. Resetting the phase to '0' restartsl, f 31;
#X text 655 18 The [line~] can be triggered with bangs to play once or keep looping with a [metro]., f 29;
#X text 96 488 Check the 3.audio.examples series for more advanced sampler algorithms., f 37;
#X connect 0 0 1 0;
#X connect 0 1 2 0;
#X connect 1 0 8 0;
#X connect 2 0 7 0;
#X connect 5 0 0 0;
#X connect 6 0 5 0;
#X connect 7 0 9 0;
#X connect 10 0 12 0;
#X connect 11 0 12 1;
#X connect 12 0 14 0;
#X connect 12 1 14 1;
#X connect 13 0 18 0;
#X connect 14 0 13 0;
#X connect 15 0 19 0;
#X connect 16 0 17 0;
#X connect 18 0 15 0;
#X connect 19 0 16 0;
#X connect 20 0 19 1;
#X connect 21 0 15 1;
#X connect 22 0 23 0;
#X connect 23 0 18 1;
#X connect 25 0 29 0;
#X connect 26 0 27 1;
#X connect 27 0 28 0;
#X connect 28 0 41 0;
#X connect 29 0 42 1;
#X connect 29 1 27 0;
#X connect 30 0 33 0;
#X connect 31 0 37 0;
#X connect 32 0 31 0;
#X connect 33 0 34 0;
#X connect 34 0 35 0;
#X connect 35 0 36 0;
#X connect 37 0 42 0;
#X connect 38 0 39 0;
#X connect 39 0 40 0;
#X connect 40 0 41 0;
#X connect 40 1 41 1;
#X connect 41 0 31 1;
#X connect 41 0 43 1;
#X connect 42 0 43 0;
#X connect 43 0 30 0;
#X restore 658 434 pd player-examples;
#X text 220 438 open to see how to deal with '\$0', f 17;
#X text 335 443 -->;
#X text 581 419 open for player --> examples, f 10;
#X obj 229 511 tabread4;
#X text 91 146 The incoming signal is the index \, which is clipped to and must be in the range from 1 to (size-2) so that the 4-point interpolation is meaningful (from 1 to 8 in this example)., f 56;
#X text 546 349 mutichannel signal support -------->, f 18;
#X msg 73 249 set;
#X text 105 249 no argument unsets the object, f 30;
#X text 625 531 updated for Pd version 0.56;
#X connect 0 0 3 0;
#X connect 1 0 14 0;
#X connect 2 0 1 0;
#X connect 9 0 39 0;
#X connect 14 0 0 0;
#X connect 15 0 14 0;
#X connect 18 0 2 0;
#X connect 27 0 26 0;
#X connect 30 0 32 0;
#X connect 31 0 30 0;
#X connect 33 0 0 0;
#X connect 39 0 14 1;
#X connect 48 0 14 0;
