Skip to content

Commit

Permalink
Update clone help patch (backport from vanilla).
Browse files Browse the repository at this point in the history
  • Loading branch information
agraef committed Oct 19, 2024
1 parent cf7d959 commit c741576
Show file tree
Hide file tree
Showing 5 changed files with 303 additions and 110 deletions.
35 changes: 35 additions & 0 deletions pd/doc/5.reference/clone-abs-a.pd
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#N canvas 585 104 563 448 12;
#X obj 65 207 osc~;
#X obj 65 307 outlet~;
#X obj 65 246 *~;
#X obj 65 139 t f b, f 7;
#X obj 65 171 mtof;
#X obj 269 150 float \$1;
#X obj 269 106 bng 19 250 50 0 empty empty empty 17 7 0 10 #dfdfdf #000000 #000000;
#X text 64 14 This is the abstraction for the clone help patch. It plays tones at pitches sent to its inlet., f 64;
#X floatatom 269 179 5 0 0 0 - - - 0;
#X obj 111 207 vline~;
#X text 300 99 You can access the instance number within the patch., f 27;
#X obj 111 246 pow~ 4;
#X msg 111 171 0.5 50 \, 0 4000 50;
#X obj 65 66 inlet;
#X obj 318 307 outlet;
#X floatatom 318 261 5 0 0 0 - - - 0;
#X text 248 342 control data is preceded by instance number in [clone]'s output., f 25;
#X obj 65 104 route float bang;
#X obj 269 202 print instance number;
#X connect 0 0 2 0;
#X connect 2 0 1 0;
#X connect 3 0 4 0;
#X connect 3 1 12 0;
#X connect 4 0 0 0;
#X connect 5 0 8 0;
#X connect 6 0 5 0;
#X connect 8 0 18 0;
#X connect 9 0 11 0;
#X connect 11 0 2 1;
#X connect 12 0 9 0;
#X connect 13 0 17 0;
#X connect 15 0 14 0;
#X connect 17 0 3 0;
#X connect 17 1 5 0;
11 changes: 11 additions & 0 deletions pd/doc/5.reference/clone-abs-b.pd
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#N canvas 571 175 261 316 12;
#X obj 80 264 outlet~;
#X obj 80 193 *~;
#X obj 80 89 inlet~;
#X obj 98 152 osc~ 20;
#X obj 80 230 *~ 0.5;
#X text 16 15 This is an abstraction for the [clone] help patch. It performs amplitude modulation., f 31;
#X connect 1 0 4 0;
#X connect 2 0 1 0;
#X connect 3 0 1 1;
#X connect 4 0 0 0;
22 changes: 22 additions & 0 deletions pd/doc/5.reference/clone-abs-c.pd
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#N canvas 585 104 323 372 12;
#X obj 110 199 osc~;
#X obj 110 315 outlet~;
#X obj 110 238 *~;
#X obj 110 163 mtof;
#X obj 156 261 pow~ 4;
#X obj 110 81 inlet;
#X obj 110 114 unpack, f 7;
#X obj 156 156 / 127;
#X text 61 21 This is the abstraction for the [poly] help patch., f 26;
#X obj 156 222 line~;
#X msg 156 186 \$1 150;
#X connect 0 0 2 0;
#X connect 2 0 1 0;
#X connect 3 0 0 0;
#X connect 4 0 2 1;
#X connect 5 0 6 0;
#X connect 6 0 3 0;
#X connect 6 1 7 0;
#X connect 7 0 10 0;
#X connect 9 0 4 0;
#X connect 10 0 9 0;
307 changes: 235 additions & 72 deletions pd/doc/5.reference/clone-help.pd
Original file line number Diff line number Diff line change
@@ -1,76 +1,239 @@
#N canvas 155 58 847 810 12;
#X floatatom 218 329 5 36 144 0 - - -, f 5;
#X obj 218 350 t b f;
#X obj 218 374 f;
#X obj 218 398 + 1;
#X obj 218 422 mod 16;
#X obj 218 446 pack;
#X msg 327 422 next \$1;
#X floatatom 327 402 5 36 144 0 - - -, f 5;
#X floatatom 327 452 5 36 144 0 - - -, f 5;
#X msg 327 471 this \$1;
#X floatatom 326 499 5 36 144 0 - - -, f 5;
#X msg 326 518 set \$1;
#X msg 80 397 vis 5 1;
#X msg 79 425 vis 5 0;
#X floatatom 325 545 5 36 144 0 - - -, f 5;
#X msg 325 566 all \$1;
#X obj 178 662 ../3.audio.examples/output~;
#X text 597 749 updated for Pd version 0.47;
#X text 496 579 creation arguments:;
#X text 26 610 click to open ->;
#X text 14 632 (first copy only);
#X text 67 351 open or close copy number 5:, f 14;
#X text 276 326 A list beginning with a number dispatches the rest
of the list as a message, f 23;
#X text 403 392 "next" forwards a message to the next instance (incrementing
and repeating circularly)., f 33;
#X text 407 445 "this" forwards a message to the previous instance
#N canvas 309 29 783 709 12;
#X declare -stdpath ./;
#X floatatom 223 264 5 57 83 0 - - -, f 5;
#X obj 223 304 t b f, f 9;
#X obj 223 330 f;
#X msg 401 348 next \$1;
#X msg 409 397 this \$1;
#X msg 420 445 set \$1;
#X msg 429 493 all \$1;
#X text 464 322 "next" forwards a message to the next instance (incrementing
and repeating circularly)., f 31;
#X text 472 376 "this" forwards a message to the previous instance
sent to by "this" or "next", f 30;
#X text 391 500 "set" sets the "next"/"this" counter;
#X text 386 546 "all" broadcasts a message to all instances;
#X text 24 8 clone - make multiple copies of a patch;
#X text 20 170 clone's inlets and outlets correspond to those of the
contained patch \, and may be signal and/or control inlets and outlets.
(In this example there's one control inlet and one signal outlet).
You can click on the clone~ object to see the first of the created
instances., f 72;
#X obj 179 609 clone clone-subpatch 16;
#X text 30 734 note: for backward compatibility \, you can also invoke
this as "clone clone-subpatch 16" (for instance) \, swapping the abstraction
name and the mumber of voices.;
#X text 19 247 Signal inlets are copied to all the instances. Control
inlets forward messages as shown below. Signal outlets output the sum
of all instances' outputs \, and control outlets forward messages with
the number of the instance prepended to them., f 67;
#X text 418 605 optional "-s #" to set starting voice number \; optional
-x to avoid setting \$1 to voice number \; filename \; number of copies
\; optional arguments to copies;
#X text 21 36 clone creates any number of copies of a desired abstraction
(a patch loaded as an object in another patch). Within each copy \,
"\$1" is set to the instance number. (These count from 0 unless overridden
by the "-s" option in the creation arguments. You can avoid this behavior
using the "-x" option.), f 71;
#X text 23 129 You can pass additional arguments to the copies that
appear as \$2 and onward (or \$1 and onward with "-x" option)., f
71;
#X obj 223 562 output~;
#X obj 30 8 clone;
#X obj 223 392 pack f f;
#X listbox 223 420 5 0 0 0 - - -, f 5;
#X obj 100 574 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 330 + 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 -;
#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 259 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 533 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 582 mutichannel signal support ----------->, f 20;
#X floatatom 420 423 5 0 3 0 - - -, f 5;
#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 - - -, f 5;
#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 - - -, f 5;
#X floatatom 167 189 5 0 0 0 - - -, f 5;
#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 - - -, f 5;
#X floatatom 687 136 5 0 0 0 - - -, f 5;
#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 597 pd multichannel;
#X obj 223 366 mod 4;
#X msg 44 469 vis 2 0;
#X msg 108 470 vis 2 1;
#X floatatom 429 471 4 57 83 0 - - -, f 4;
#X floatatom 409 375 5 0 3 0 - - -, f 5;
#X floatatom 401 326 5 0 3 0 - - -, f 5;
#X text 367 532 <-- file name and number of copies;
#X obj 223 532 clone clone-abs-a 4;
#X floatatom 317 303 5 0 0 0 - - -, f 5;
#X msg 317 343 resize \$1;
#X text 480 433 "set" sets the "next" and "this" counter, f 22;
#X text 486 481 "all" sends a message to all instances, f 21;
#X text 364 300 <-- 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 listbox 353 560 7 0 0 0 - - -, f 7;
#X text 410 560 control data is preceded by instance number;
#X obj 193 679 poly;
#X text 80 627 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 431 Open or close copy number 2:, f 14;
#X floatatom 165 368 5 0 3 0 - - -, f 5;
#X text 24 269 Check [poly]'s help for a polyphonic synth example with
[clone] and a list input., f 25;
#X text 25 354 Just a float sends an empty list to the instance \,
which becomes a bang!, f 19;
#X text 23 129 [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. It also has a signal and another control
outlet. You can click on the [clone] object to see the first of the
cloned 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 23 213 Signal inlets can get non float control messages via
their 2nd outlet 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 obj 74 317 poly;
#X obj 236 678 notein;
#N canvas 946 442 494 344 META 0;
#X text 12 65 LIBRARY internal;
#X text 12 105 WEBSITE http://crca.ucsd.edu/~msp/;
#X text 12 25 LICENSE SIBSD;
#X text 12 85 AUTHOR Miller Puckette;
#X text 12 125 RELEASE_DATE 2023;
#X text 12 5 KEYWORDS clone abstraction;
#X text 12 45 DESCRIPTION make multiple copies of an abstraction;
#X text 12 145 HELP_PATCH_AUTHORS Updated for Pd version 0.54 by Alexandre
Porres. PDDP META added by Albert Gräf.;
#X restore 400 678 pd META;
#X connect 0 0 1 0;
#X connect 1 0 2 0;
#X connect 1 1 5 1;
#X connect 2 0 3 0;
#X connect 3 0 4 0;
#X connect 4 0 2 1;
#X connect 4 0 5 0;
#X connect 5 0 29 0;
#X connect 6 0 29 0;
#X connect 7 0 6 0;
#X connect 8 0 9 0;
#X connect 9 0 29 0;
#X connect 10 0 11 0;
#X connect 11 0 29 0;
#X connect 12 0 29 0;
#X connect 13 0 29 0;
#X connect 14 0 15 0;
#X connect 15 0 29 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 29 0 16 1;
#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 43 0;
#X connect 37 0 38 0;
#X connect 37 0 29 1;
#X connect 38 0 36 0;
#X connect 48 0 36 0;
Loading

0 comments on commit c741576

Please sign in to comment.