#N canvas 395 23 754 706 12;
#X declare -stdpath ./;
#X floatatom 181 253 4 57 83 0 - - - 0;
#X obj 181 290 t b f, f 9;
#X obj 181 316 f;
#X msg 359 334 next \$1;
#X msg 367 383 this \$1;
#X msg 378 431 set \$1;
#X msg 387 479 all \$1;
#X text 422 308 "next" forwards a message to the next instance (incrementing and repeating circularly)., f 31;
#X text 430 362 "this" forwards a message to the previous instance sent to by "this" or "next", f 30;
#X text 63 623 note: for backwards compatibility \, you can also invoke this as "clone 16 clone-abstraction" (for instance) \, swapping the abstraction name and the number of voices., f 91;
#X obj 181 556 output~;
#X obj 30 8 clone;
#X obj 181 378 pack f f;
#X listbox 181 406 5 0 0 0 - - - 0;
#X obj 70 571 declare -stdpath ./, f 11;
#X obj 6 37 cnv 1 740 1 empty empty empty 8 12 0 13 #000000 #000000 0;
#X obj 6 668 cnv 1 740 1 empty empty empty 8 12 0 13 #000000 #000000 0;
#X obj 210 316 + 1;
#N canvas 696 57 567 608 reference 0;
#X obj 8 43 cnv 5 550 5 empty empty INLETS: 8 18 0 13 #202020 #000000 0;
#X obj 8 76 cnv 1 550 1 empty empty 'n': 8 12 0 13 #9f9f9f #000000 0;
#X obj 8 299 cnv 2 550 2 empty empty OUTLETS: 8 12 0 13 #202020 #000000 0;
#X obj 7 586 cnv 5 550 5 empty empty empty 8 18 0 13 #202020 #000000 0;
#X obj 28 13 clone;
#X obj 8 393 cnv 2 550 2 empty empty ARGUMENTS: 8 12 0 13 #202020 #000000 0;
#X obj 7 418 cnv 1 550 1 empty empty flags: 8 12 0 13 #7c7c7c #000000 0;
#X text 104 84 list -;
#X text 55 189 next <list> -;
#X text 55 223 this <list> -;
#X text 62 255 set <list> - sets the "next"/"this" counter., f 67;
#X text 28 443 "-s <float>" - sets starting voice number (default 0)., f 70;
#X text 84 426 "-x" - avoids including a first argument setting voice number., f 62;
#X text 113 524 1) symbol - abstraction name., f 49;
#X text 113 542 2) float - number of copies., f 49;
#X obj 7 519 cnv 1 550 1 empty empty args: 8 12 0 13 #7c7c7c #000000 0;
#X text 113 560 3) list - optional arguments to the abstraction., f 49;
#X text 153 85 first number sets the copy number and the rest of the list is sent to that instance's inlet., f 54;
#X text 153 188 forwards a message to the next instance's inlet (incrementing and repeating circularly)., f 54;
#X text 153 223 forwards a message to the previous instance's inlet sent to by "this" or "next"., f 54;
#X text 62 273 all <list> - sends a message to all instances' inlet., f 67;
#X text 79 52 (number and type depends on the abstraction);
#X text 90 116 signal -;
#X text 153 117 for signal inlets \, audio is sent to all copies., f 54;
#X text 75 13 - make multiple copies of an abstraction.;
#X obj 8 329 cnv 1 550 1 empty empty 'n': 8 12 0 13 #9f9f9f #000000 0;
#X text 62 154 vis <list> -;
#X text 153 155 opens a copy \, takes copy number and visualization status (1 to open \, 0 to close)., f 54;
#X text 34 136 resize <float> -;
#X text 153 137 resizes the number of copies., f 54;
#X text 61 335 control outlets - message with a prepended copy number., f 68;
#X text 68 353 signal outlets -, f 16;
#X text 187 353 either a multichannel output with signals from all copies or the sum of all copies as a mono output., f 50;
#X text 91 460 -di - distribute multichannel input signals across cloned patches., f 66;
#X text 91 475 -do - combine signal outputs to make a multichannel signal.;
#X text 98 491 -d - set both -di and -do flags.;
#X text 84 304 (number and type depends on the abstraction);
#X restore 571 8 pd reference;
#X text 664 8 <= click;
#X text 222 247 A list beginning with a number dispatches the rest of the list as a message to a copy of the abstraction defined by the first number., f 69;
#X text 49 519 click to open --> (first copy only), f 17;
#X text 78 9 - make multiple copies of an abstraction;
#X text 531 677 updated for Pd version 0.54;
#X text 28 678 see also:;
#X obj 107 679 inlet;
#X obj 159 679 snake~;
#X text 396 576 mutichannel signal support ----------->, f 20;
#X floatatom 378 409 5 0 3 0 - - - 0;
#N canvas 462 108 850 454 multichannel 0;
#X obj 361 338 output~;
#X obj 361 296 snake~ out;
#X msg 361 221 next \$1;
#X floatatom 361 189 5 57 83 0 - - - 0;
#X text 583 46 The '-d' flag sets both -di and -do flags \, so it takes and generates multichannel signals., f 27;
#X obj 95 340 output~;
#X obj 95 256 snake~ in;
#X obj 95 217 osc~ 444;
#X obj 167 217 osc~ 666;
#X floatatom 95 189 5 0 0 0 - - - 0;
#X floatatom 167 189 5 0 0 0 - - - 0;
#X obj 361 258 clone -do clone-abs-a 2;
#X obj 95 298 clone -di clone-abs-b 2;
#X text 54 118 The '-di' flag distributes a multichannel signal to different copies inside [clone]., f 32;
#X obj 615 203 snake~ in;
#X obj 615 164 osc~ 444;
#X obj 687 164 osc~ 666;
#X floatatom 615 136 5 0 0 0 - - - 0;
#X floatatom 687 136 5 0 0 0 - - - 0;
#X obj 615 335 output~;
#X obj 615 293 snake~ out;
#X obj 615 245 clone -d clone-abs-b 2;
#X text 46 20 By default \, for signal inlets \, [clone] expects a single mono channel and distributes it to all copies of the abstraction. If you have a multichannel input you need to use a flag to split and disctribute the channels separately to each copy. By default \, an outlet connection gets the sum of all copies \, but you can also get a multichannel output that combines the output of all copies with a flag., f 70;
#X text 322 118 The '-do' flag combines the audio of all copies into a multichannel signal output., f 27;
#X connect 1 0 0 0;
#X connect 1 1 0 1;
#X connect 2 0 11 0;
#X connect 3 0 2 0;
#X connect 6 0 12 0;
#X connect 7 0 6 0;
#X connect 8 0 6 1;
#X connect 9 0 7 0;
#X connect 10 0 8 0;
#X connect 11 0 1 0;
#X connect 12 0 5 0;
#X connect 14 0 21 0;
#X connect 15 0 14 0;
#X connect 16 0 14 1;
#X connect 17 0 15 0;
#X connect 18 0 16 0;
#X connect 20 0 19 0;
#X connect 20 1 19 1;
#X connect 21 0 20 0;
#X restore 547 591 pd multichannel;
#X obj 181 352 mod 4;
#X msg 39 309 vis 2 0;
#X msg 102 309 vis 2 1;
#X text 49 266 open or close copy number 2:, f 14;
#X floatatom 387 457 4 57 83 0 - - - 0;
#X floatatom 367 361 5 0 3 0 - - - 0;
#X floatatom 359 312 5 0 3 0 - - - 0;
#X text 325 518 <-- file name and number of copies;
#X obj 181 518 clone clone-abs-a 4;
#X floatatom 275 289 5 0 0 0 - - - 0;
#X msg 275 329 resize \$1;
#X text 438 419 "set" sets the "next" and "this" counter, f 22;
#X text 444 467 "all" sends a message to all instances, f 21;
#X text 322 286 <-- resize the number of instances;
#X text 40 46 [clone] creates any number of copies of an abstraction (a patch loaded as an object in another patch). By default "\$1" is set to the instance number within each copy (counted from 0 unless overridden by the "-s" flag). You can prevent '\$1' from reflecting the instance number with the "-x" flag. Arguments must be filename and number of copies \, additional arguments are passed to the copies and appear as \$2 and onward (or \$1 and onward with the "-x" flag)., f 95;
#X text 40 197 Signal inlets can get non float control messages with the 'fwd' argument in the same way \, but signals are sent to all the instances. See [pd multichannel] example for more details on how signal distribution works in [clone]., f 95;
#X listbox 311 546 7 0 0 0 - - - 0;
#X text 40 121 [clone]'s inlets/outlets correspond to those of the contained patch \, and may be control and/or signal inlets/outlets (this example has one control inlet plus one signal and another control outlet). You can click on the clone object to see the first of the created instances. At least one control inlet is present even if the abstraction has none so [clone] can receive the 'vis' and 'resize' messages. The way control inlets/outlets forward messages is shown below., f 95;
#X text 368 546 control data is preceded by instance number;
#X connect 0 0 1 0;
#X connect 1 0 2 0;
#X connect 1 1 12 1;
#X connect 2 0 30 0;
#X connect 3 0 38 0;
#X connect 4 0 38 0;
#X connect 5 0 38 0;
#X connect 6 0 38 0;
#X connect 12 0 13 0;
#X connect 13 0 38 0;
#X connect 17 0 2 1;
#X connect 28 0 5 0;
#X connect 30 0 12 0;
#X connect 30 0 17 0;
#X connect 31 0 38 0;
#X connect 32 0 38 0;
#X connect 34 0 6 0;
#X connect 35 0 4 0;
#X connect 36 0 3 0;
#X connect 38 0 10 0;
#X connect 38 1 46 0;
#X connect 39 0 40 0;
#X connect 39 0 30 1;
#X connect 40 0 38 0;
