[PD] The parent patch file name... state saving

Frank Barknecht fbar at footils.org
Tue Sep 6 15:48:03 CEST 2005


Hallo,
Christopher Charles hat gesagt: // Christopher Charles wrote:

> for example: in my patch i have a drum machine abstraction, on it's 
> right, there is a subpatch(e.g. [pd s]) crossconnected, containing an 
> inlet, outlet, a message and a loadbang. everytime the patch is loaded, 
> the loadbang kicks the message into the drum machine, everytime sliders 
> in the drum machine are changed, a newly created status message is sent 
> to the message box in the subpatch via a "set" message. this way, the 
> patch itself becomes the savefile.

Yes, this is a different approach than mine. It is more "traditional"
in that a state is saved inside the/a patch using a message and
loadbangs. The beauty of it of course is that it is simple and just
works. Actually it's the way I also use for "one-off" or "throwaway"
patches. And it also is the way used in Pd, when you are using data
structures as the "score".

However for example I have one patch which I use when doing "party
sets" (see http://footils.org/cms/show/36) where the music is dancy
house music. The patch there is always running and contains various
instruments like a drum part, a "soul diva sample" part, a "phat
bassline" part etc. and sequencers controlling all that. Then I load a
big preset for lots of songs into the Memento pool and play along with
these for as long as the audience lets me. 

With that it is much more useful not to have the sequences stored
inside the patch, as the patch will stay the same all the time, but
the sequences, the *songs* will change. OTOH I don't want to change
the songs when I'm doing changes to the patch. So having both the
presets and the instrument as different thing is crucial to me. (Like
having a piano on one side and different score sheets on the other in
traditional music.) 

> it's a bit of a hassle to adapt all the abstractions to this behaviour 
> (especially when the abstractions have loads of sliders...) but it works 
> to save all the needed info in the parent patch, and what's best, no 
> additional dependencies (such as pool) are needed (well, i often used 
> [iem_prepend set] in my abstractions, but those could all be substituted 
> with [set $1 $2 $3...etc( messages). 

... or now use [list prepend] with pd-0.39. 

BTW: To save a bit of patching work, I'm currently experimenting with
dynamically generated state saving elements for Memento. For those
interested, I attached the current state of affairs with this. The
"dynamic-commun" part of this will later go into [originator] itself. 

Then instead of creating a lot of [commun] objects by hand, this work
can be replaced by sending special messages to [originator] itself as
illustrated in dynamic-commun-help.pd

The attached files require a working installation of Memento. Then
just drop the three new patches into your Memento directory and open
dynamic-commun-help.pd

Ciao
-- 
 Frank Barknecht                 _ ______footils.org_ __goto10.org__
-------------- next part --------------
#N canvas 505 274 742 456 10;
#N canvas 0 0 450 300 1006-dynamic-communs 0;
#X restore 509 83 pd \$0-dynamic-communs;
#X obj 282 312 f \$1;
#X obj 513 224 makefilename pd-%s;
#X obj 513 196 symbol \$0-dynamic-communs;
#X obj 513 253 s \$0-sub;
#X obj 325 336 r \$0-sub;
#X obj 513 168 loadbang;
#X obj 282 289 loadbang;
#X obj 409 183 f 0;
#X obj 139 16 inlet;
#X msg 97 175 \; \$1 clear;
#X obj 97 115 r \$0-sub;
#X obj 97 148 symbol;
#X obj 576 372 print sub;
#X msg 425 160 0;
#X msg 584 170 bang;
#X obj 442 183 + 20;
#X msg 51 117 bang;
#X msg 218 328 \$1;
#X obj 239 239 makefilename \$1-%s;
#X msg 237 214 symbol \$2;
#X obj 260 183 makefilename \$1-%s;
#X msg 256 158 symbol \$3;
#X obj 218 359 pack s s s f f s;
#X obj 139 36 route # init;
#X obj 218 119 t a a a b;
#X msg 218 397 \; \$6 obj 10 \$5 sr-commun \$1 \$2 \$3 \$4;
#X text 262 23 Required Argument is Dollar-Zero ($0) from parent.;
#X connect 1 0 23 3;
#X connect 2 0 4 0;
#X connect 3 0 2 0;
#X connect 5 0 23 5;
#X connect 6 0 3 0;
#X connect 7 0 1 0;
#X connect 8 0 16 0;
#X connect 8 0 23 4;
#X connect 9 0 24 0;
#X connect 11 0 12 0;
#X connect 12 0 10 0;
#X connect 14 0 8 1;
#X connect 15 0 3 0;
#X connect 16 0 8 1;
#X connect 17 0 12 0;
#X connect 18 0 23 0;
#X connect 19 0 23 1;
#X connect 20 0 19 0;
#X connect 21 0 23 2;
#X connect 22 0 21 0;
#X connect 23 0 26 0;
#X connect 24 1 14 0;
#X connect 24 1 17 0;
#X connect 24 2 25 0;
#X connect 25 0 18 0;
#X connect 25 1 20 0;
#X connect 25 2 22 0;
#X connect 25 3 8 0;
-------------- next part --------------
#N canvas 288 268 450 300 10;
#X obj 132 125 commun \$1 \$4;
#X obj 132 77 r \$2;
#X obj 132 173 s \$3;
#X connect 0 0 2 0;
#X connect 1 0 0 0;
-------------- next part --------------
#N canvas 427 96 725 630 10;
#X obj 71 375 originator /h \$0;
#X obj 63 289 dynamic-commun \$0;
#X msg 93 220 init;
#X obj 63 196 t b b;
#X msg 63 173 bang;
#X text 63 15 Dynamic commun generator:;
#X text 71 39 1) Send "init" to clear commun area;
#X text 71 59 2) For every thing you want to save \, send a list of
target name \, sender name and receiver name. Target has to start with
slash \, sender and receiver will internally get replaced with a "$0-NAME".
;
#X msg 178 348 /h/preset \$1;
#X obj 178 327 hradio 15 1 0 2 empty empty empty 0 -6 0 8 -262144 -1
-1 1;
#X obj 539 211 s \$0-w;
#X obj 542 190 hsl 128 15 0 127 0 0 empty empty empty -2 -6 0 8 -262144
-1 -1 4000 1;
#X obj 547 281 hsl 128 15 0 127 0 0 \$0-t \$0-t send/rec-inside -2
-6 0 8 -262144 -1 -1 7900 1;
#X obj 539 368 r \$0-d;
#X obj 539 411 s \$0-d-s;
#X text 289 266 use send/rec. like this;
#X floatatom 539 391 5 0 0 0 - - -;
#X obj 63 150 loadbang;
#X obj 539 167 r \$0-w-r;
#X msg 63 246 list /what w w-r \, list /that t t \, list /dis d-s d
;
#X msg 281 353 /h/what \$1;
#X obj 284 328 hsl 128 15 0 127 0 0 empty empty testOSC-/what -2 -6
0 8 -262144 -1 -1 6200 1;
#X obj 178 405 print;
#X floatatom 531 498 5 0 0 0 - - -;
#X obj 531 518 s \$0-more-s;
#X obj 531 475 r \$0-more-r;
#X msg 334 478 list /more more-s more-r;
#X obj 334 510 s \$0-more-communs;
#X obj 96 269 r \$0-more-communs;
#X connect 0 2 22 0;
#X connect 2 0 1 0;
#X connect 3 0 19 0;
#X connect 3 1 2 0;
#X connect 4 0 3 0;
#X connect 8 0 0 1;
#X connect 9 0 8 0;
#X connect 11 0 10 0;
#X connect 13 0 16 0;
#X connect 16 0 14 0;
#X connect 17 0 4 0;
#X connect 18 0 11 0;
#X connect 19 0 1 0;
#X connect 20 0 0 1;
#X connect 21 0 20 0;
#X connect 23 0 24 0;
#X connect 25 0 23 0;
#X connect 26 0 27 0;
#X connect 28 0 1 0;


More information about the Pd-list mailing list