[PD] clone object - dynamically change number of instances?

oliver oliver at klingt.org
Tue Mar 6 09:59:11 CET 2018


hans w. koch wrote:
> hello list,
> hello miller,
>
> is there any known way to dynamically change the number of instances associated with a clone object, e.g. via message?
> i know, the dsp graph would need to be rebulit, but for a project i am contemplating that would be less of a concern.

hi, hans !

you are aware of the "messages to PD" examples ?

afaict they are not mentioned in the latest official PD release, but i 
attached one exmaple from PD-extended, that's still valid and 
documenting this feature. this way you can easily change the instances 
of a clone object, simply by deleting it and creating a new one with the 
right arguments.

if you put your clone object as a single item into a subpatch, it's just 
a "clear" message and a "obj ... " message to the subpatch.

coming from MAX/MSP (where this object is called [poly~]), my experience 
is that assigning a new number of voices via a message does pretty much 
the same thing: it clears all former instances and reloads the new 
instances, all loadbang messages sent anew, no values are kept.

so i guess (while i too would appreciate a "voices" message for [clone]) 
in the end the result would probably be pretty much the same.

but mind you, this is no in-depth knowledge, just personal experience

best

oliver

-------------- next part --------------
#N canvas 123 120 1246 795 12;
#X msg 40 732 restore;
#X text 23 29 objects;
#X text 511 33 GUI stuff;
#X msg 515 56 menusave;
#X msg 515 80 menusaveas;
#X msg 515 104 menuclose;
#X msg 515 129 saveto;
#X msg 515 216 cut;
#X msg 515 242 copy;
#X msg 515 290 duplicate;
#X msg 515 153 tidy;
#X msg 515 177 texteditor;
#X msg 515 490 editmode \$1;
#X msg 515 521 loadbang;
#X msg 515 348 menufont;
#X msg 515 432 findagain;
#X msg 515 456 findparent;
#X text 579 130 ?????;
#X msg 515 266 paste;
#X msg 515 314 selectall;
#X text 22 470 reset the patch;
#X msg 40 492 clear;
#N canvas 20 500 500 200 subpatch 0;
#X coords 0 200 1 199 50 50 0;
#X restore 513 707 pd subpatch;
#X obj 40 762 s pd-subpatch;
#X obj 515 664 s pd-subpatch;
#X msg 40 236 connect 0 0 1 0;
#X msg 40 575 read textfile.txt;
#X msg 40 599 write textfile.txt;
#X msg 515 558 vis \$1;
#X obj 631 619 loadbang;
#X msg 40 705 donecanvasdialog 1 -1 1 0 -1 1 1 50 50 100 100;
#X text 22 685 this controls graph-on-parent;
#X msg 40 260 disconnect 0 0 1 0;
#X text 178 235 obj# outlet# obj# inlet#;
#X text 117 733 ?????;
#X msg 40 173 graph mygraph;
#X obj 173 201 s pd-mygraph;
#X msg 173 173 pop \, array array1 100 float 2;
#X msg 40 49 obj 350 10 r test;
#X msg 40 73 msg 350 40 bang;
#X msg 40 97 floatatom 350 70;
#X msg 40 121 symbolatom 350 100 symbol;
#X msg 40 145 text 350 130 comment;
#N canvas 166 389 487 212 ds 0;
#X obj 38 39 filledcurve 990 0 1 0 0 50 0 50 50 0 50;
#X obj 38 66 drawcurve 0 1 15 15 20 15 20 20 15 20 15 15;
#X obj 38 93 drawcurve 0 1 30 15 35 15 35 20 30 20 30 15;
#X obj 38 120 filledcurve 999 0 1 10 25 25 45 40 25 25 35 10 25;
#X obj 20 12 struct ds float x float y symbol sym;
#X obj 38 147 drawsymbol sym 55 25 0;
#X restore 318 623 pd ds;
#X msg 40 433 motion 200 200 0;
#X msg 40 314 editmode 1;
#X msg 40 385 key 1 8 0;
#X msg 40 337 mouse 340 135 1 0;
#X msg 40 361 mouseup 355 145 0;
#X msg 40 409 click 355 145 0 1 0;
#X text 128 385 (8 = backspace);
#X text 207 409 ?????;
#X text 181 434 ?????;
#X text 578 558 ( 0 or 1 );
#X text 622 490 ( 0 or 1 );
#X text 23 211 connections;
#N canvas 523 391 265 191 ds2 0;
#N canvas 50 470 557 157 template-toplevel 0;
#X obj 21 102 plot bazoo 700 3 10 20 20;
#X obj 21 68 drawpolygon q 4 0 0 20 z z -5 10 20;
#X obj 21 21 struct template-toplevel float x float y float z float
q array bazoo template-element;
#X restore 11 11 pd template-toplevel;
#N canvas 199 231 600 239 template-element 0;
#X obj 58 83 drawpolygon 10 2 5 0 0 -5 -5 0 0 5 5 0;
#X obj 59 48 struct template-element float x float y float w;
#X restore 11 34 pd template-element;
#X restore 318 587 pd ds2;
#X msg 40 623 scalar ds 225 225 -hi_there!;
#X text 22 551 reading/writing/creating data structures;
#X text 630 408 ( 0 or 1 );
#X text 603 105 Warning !!!;
#N canvas 458 158 549 396 META 0;
#X text 12 5 GENRE tutorial;
#X text 12 65 DESCRIPTION a (hopefully) comprehensive list of all internal
messages that can be sent to a canvas;
#X text 12 95 HELP_PATCH_AUTHORS Damien Henry. "pd meta" information
added by Jonathan Wilkes for Pd version 0.42.;
#X text 12 25 KEYWORDS control canvas_op nonlocal dynamic_patching
;
#X text 12 45 LICENSE public domain;
#X restore 611 707 pd META;
#X text 299 5 MESSAGES TO PD:;
#X obj 496 561 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
1;
#X obj 495 494 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
1;
#X obj 494 411 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
1;
#X msg 515 408 find route \$1;
#X msg 631 644 vis 0 \, clear;
#X text 49 280 events (only work when editmode = 1 \, vis = 1) !;
#X msg 515 372 font \$1 100 100;
#X msg 659 352 12;
#X msg 686 352 10;
#X text 810 19 This will create a sub patch in this window and open
it :, f 28;
#X obj 812 157 s pd-messages2pd;
#X text 949 695 You have to put the name of the patch to open and its
complete path, f 24;
#X msg 964 175 menuclose;
#X obj 964 200 s pd-new_patch;
#X msg 812 63 obj 850 200 pd new_patch;
#X msg 843 93 vis 1 \, editmode 1 \, mouse 848 198 0 0 \, mouseup 858
208 0 \, cut \, editmode 0, f 25;
#X text 1054 98 and this ugly hack will destroy it \; -), f 20;
#X msg 815 586 ol_msg.pd;
#X obj 815 634 path;
#X obj 815 610 symbol;
#X obj 815 657 split_path;
#X msg 815 706 \; pd open \$2 \$1;
#X obj 815 681 pack s s;
#X text 947 582 needs [path] from TOF and [split_path] from HCS, f
26;
#X text 813 550 OPEN a patch from PD;
#X msg 811 353 \; pd-subpatch menuclose \; pd-subpatch relocate \$1x\$2+0+0
0x0+\$3+\$4 \; pd-subpatch vis 1;
#X msg 811 333 350 70 600 20;
#X msg 1026 333 500 200 20 500;
#X text 812 276 relocate windows:;
#X text 811 305 size_x \, size_y \, pos_x \, pos_y;
#X connect 0 0 23 0;
#X connect 3 0 24 0;
#X connect 4 0 24 0;
#X connect 5 0 24 0;
#X connect 6 0 24 0;
#X connect 7 0 24 0;
#X connect 8 0 24 0;
#X connect 9 0 24 0;
#X connect 10 0 24 0;
#X connect 11 0 24 0;
#X connect 12 0 24 0;
#X connect 13 0 24 0;
#X connect 14 0 24 0;
#X connect 15 0 24 0;
#X connect 16 0 24 0;
#X connect 18 0 24 0;
#X connect 19 0 24 0;
#X connect 21 0 23 0;
#X connect 25 0 23 0;
#X connect 26 0 23 0;
#X connect 27 0 23 0;
#X connect 28 0 24 0;
#X connect 29 0 67 0;
#X connect 30 0 23 0;
#X connect 32 0 23 0;
#X connect 35 0 23 0;
#X connect 37 0 36 0;
#X connect 38 0 23 0;
#X connect 39 0 23 0;
#X connect 40 0 23 0;
#X connect 41 0 23 0;
#X connect 42 0 23 0;
#X connect 44 0 23 0;
#X connect 45 0 23 0;
#X connect 46 0 23 0;
#X connect 47 0 23 0;
#X connect 48 0 23 0;
#X connect 49 0 23 0;
#X connect 57 0 23 0;
#X connect 63 0 28 0;
#X connect 64 0 12 0;
#X connect 65 0 66 0;
#X connect 66 0 24 0;
#X connect 67 0 24 0;
#X connect 69 0 24 0;
#X connect 70 0 69 0;
#X connect 71 0 69 0;
#X connect 75 0 76 0;
#X connect 77 0 73 0;
#X connect 78 0 73 0;
#X connect 80 0 82 0;
#X connect 81 0 83 0;
#X connect 82 0 81 0;
#X connect 83 0 85 0;
#X connect 83 1 85 1;
#X connect 85 0 84 0;
#X connect 89 0 88 0;
#X connect 90 0 88 0;


More information about the Pd-list mailing list