#N canvas 352 75 847 546 12;
#X obj 36 411 snapshot~;
#X obj 36 175 sig~;
#X floatatom 36 149 6 1 8 0 - - - 0;
#X floatatom 36 437 6 0 0 0 - - - 0;
#X obj 44 17 tabread4~;
#X obj 94 487 tabwrite~;
#X obj 298 487 tabsend~;
#X obj 94 513 tabreceive~;
#X obj 165 487 tabplay~;
#X floatatom 166 260 5 0 10 0 - - - 0;
#X obj 220 379 ../3.audio.examples/B15.tabread4~-onset;
#X obj 181 513 tabosc4~;
#X obj 249 513 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 323 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 422 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 722 96 575 293 reference 0;
#X obj 11 52 cnv 5 550 5 empty empty INLET: 8 18 0 13 #202020 #000000 0;
#X obj 11 186 cnv 2 550 2 empty empty OUTLET: 8 12 0 13 #202020 #000000 0;
#X obj 11 231 cnv 2 550 2 empty empty ARGUMENT: 8 12 0 13 #202020 #000000 0;
#X obj 10 268 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 text 144 95 signal -;
#X obj 11 148 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 207 157 sets table onset., f 42;
#X text 116 117 set <list> -;
#X text 207 117 set the table names., f 42;
#X text 123 198 signal(s) -;
#X text 207 198 value(s) of index input from given table(s).;
#X text 137 243 1) list - sets table names to read from.;
#X text 207 95 sets index for table(s) with interpolation.;
#X text 144 157 signal -;
#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 340 Open this example for more details on setting onset:, f 35;
#X obj 8 475 cnv 1 830 1 empty empty empty 8 12 0 13 #000000 #000000 0;
#X text 18 500 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 513 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 749 203 563 414 multichannel 0;
#X obj 68 270 snake~ out, f 12;
#X obj 69 151 sig~;
#X floatatom 69 125 6 0 10 0 - - - 0;
#X obj 68 347 snapshot~;
#X floatatom 68 376 8 0 0 0 - - - 0;
#X obj 89 304 r bang;
#X obj 149 347 snapshot~;
#X floatatom 149 376 8 0 0 0 - - - 0;
#X msg 117 150 set array99 array100;
#X msg 130 181 set array100 array99;
#X obj 68 222 tabread4~ array99 array100;
#X text 51 12 [tabread4~] 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., f 67;
#X obj 72 96 hsl 162 19 0 10 0 0 empty empty empty -2 -8 0 10 #dfdfdf #000000 #000000 0 1;
#X obj 310 150 cnv 19 198 98 empty empty empty 20 12 0 12 #e0e0e0 #404040 0;
#X obj 310 276 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;
#X coords 0 5.2 10 -0.2 200 100 1 0 0;
#X restore 310 149 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;
#X coords 0 5.2 10 -0.2 200 100 1 0 0;
#X restore 309 276 graph;
#X connect 0 0 3 0;
#X connect 0 1 6 0;
#X connect 1 0 10 0;
#X connect 2 0 1 0;
#X connect 3 0 4 0;
#X connect 5 0 3 0;
#X connect 5 0 6 0;
#X connect 6 0 7 0;
#X connect 8 0 10 0;
#X connect 9 0 10 0;
#X connect 10 0 0 0;
#X connect 12 0 2 0;
#X restore 697 364 pd multichannel;
#X text 546 349 mutichannel signal support ----------->, f 20;
#X obj 128 402 metro 200;
#X obj 128 375 loadbang;
#X obj 128 430 s bang;
#X obj 56 378 r bang;
#X text 89 147 incoming signal is index. Indices should range from 1 to (size-2) so that the 4-point interpolation is meaningful (from 1 to 8 in this example)., f 52;
#X text 212 255 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 260 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;
#X coords 0 10 10 0 250 200 1 0 0;
#X restore 572 102 graph;
#X obj 166 291 sig~;
#X text 625 507 updated for Pd version 0.55;
#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 155944 float 2;
#X coords 0 1 155944 -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 649 424 pd player-examples;
#X text 220 418 open to see how to deal with '\$0', f 17;
#X text 335 423 -->;
#X text 572 409 open for player --> examples, f 10;
#X obj 229 487 tabread4;
#X connect 0 0 3 0;
#X connect 1 0 14 0;
#X connect 2 0 1 0;
#X connect 9 0 41 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 31 0 33 0;
#X connect 32 0 31 0;
#X connect 34 0 0 0;
#X connect 41 0 14 1;
