#N canvas 305 29 794 703 12;
#X declare -stdpath ./;
#X floatatom 223 250 5 57 83 0 - - - 0;
#X obj 223 290 t b f, f 9;
#X obj 223 316 f;
#X msg 401 334 next \$1;
#X msg 409 383 this \$1;
#X msg 420 431 set \$1;
#X msg 429 479 all \$1;
#X text 464 308 "next" forwards a message to the next instance (incrementing and repeating circularly)., f 31;
#X text 472 362 "this" forwards a message to the previous instance sent to by "this" or "next", f 30;
#X obj 223 548 output~;
#X obj 30 8 clone;
#X obj 223 378 pack f f;
#X listbox 223 406 5 0 0 0 - - - 0;
#X obj 100 560 declare -stdpath ./, f 11;
#X obj 6 37 cnv 1 775 1 empty empty empty 8 12 0 13 #000000 #000000 0;
#X obj 6 668 cnv 1 775 1 empty empty empty 8 12 0 13 #000000 #000000 0;
#X obj 252 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 592 8 pd reference;
#X text 685 8 <= click;
#X text 268 245 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 91 519 click to open --> (first copy only), f 17;
#X text 78 9 - make multiple copies of an abstraction;
#X text 565 677 updated for Pd version 0.54;
#X text 15 678 see also:;
#X obj 87 679 inlet;
#X obj 135 679 snake~;
#X text 438 576 mutichannel signal support ----------->, f 20;
#X floatatom 420 409 5 0 3 0 - - - 0;
#N canvas 461 86 828 543 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 322 118 The '-do' flag combines the audio of all copies into a multichannel signal output., f 27;
#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 distribute 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 73 440 When distributing a mutichannel input into copies \, if the number of channels is less than the number of copies \, [clone] will wrap around and copy the first channels until reaching the number of copies. This is specially useful if you have like an actual multichannel input in the leftmost inlet and other secondary signal inlets that just receive a single channel signal \, in which case the single channels are sent to all copies., f 97;
#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 589 591 pd multichannel;
#X obj 223 352 mod 4;
#X msg 44 455 vis 2 0;
#X msg 108 456 vis 2 1;
#X floatatom 429 457 4 57 83 0 - - - 0;
#X floatatom 409 361 5 0 3 0 - - - 0;
#X floatatom 401 312 5 0 3 0 - - - 0;
#X text 367 518 <-- file name and number of copies;
#X obj 223 518 clone clone-abs-a 4;
#X floatatom 317 289 5 0 0 0 - - - 0;
#X msg 317 329 resize \$1;
#X text 480 419 "set" sets the "next" and "this" counter, f 22;
#X text 486 467 "all" sends a message to all instances, f 21;
#X text 364 286 <-- resize the number of instances;
#X text 24 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 104;
#X text 23 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 104;
#X listbox 353 546 7 0 0 0 - - - 0;
#X text 23 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 104;
#X text 410 546 control data is preceded by instance number;
#X obj 193 679 poly;
#X text 80 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 text 54 412 Open or close copy number 2:, f 14;
#X floatatom 165 344 5 0 3 0 - - - 0;
#X text 24 257 Check [poly]'s help for a polyphonic synth example with [clone] and a list input., f 25;
#X text 25 330 Just a float sends an empty list to the instance \, which becomes a bang!, f 19;
#X connect 0 0 1 0;
#X connect 1 0 2 0;
#X connect 1 1 11 1;
#X connect 2 0 29 0;
#X connect 3 0 36 0;
#X connect 4 0 36 0;
#X connect 5 0 36 0;
#X connect 6 0 36 0;
#X connect 11 0 12 0;
#X connect 12 0 36 0;
#X connect 16 0 2 1;
#X connect 27 0 5 0;
#X connect 29 0 11 0;
#X connect 29 0 16 0;
#X connect 30 0 36 0;
#X connect 31 0 36 0;
#X connect 32 0 6 0;
#X connect 33 0 4 0;
#X connect 34 0 3 0;
#X connect 36 0 9 0;
#X connect 36 1 44 0;
#X connect 37 0 38 0;
#X connect 37 0 29 1;
#X connect 38 0 36 0;
#X connect 50 0 36 0;
