Hello list,
I am making a simple patch to automatically morph between parameters every so often. One idea for this is, if I end up VJing at the 6 am afterparty and I am too drunk, I can have it morph things for me and I can take a break. :) Well, I'm not sure if that is a joke, or if it's true.
Anyway, I know I'm doing something stupid with this patch, that causes it not to work right. The first time I run it, I hit bang, and it outputs twice to the print, instead of once - there is some kind of loop that I don't want. After that, if I bang it again, it seems to work perfectly. So, can someone tell me what the mistake is in my logic, and the best way to fix it? I can think of a hack fix, but I'd rather know a more logical solution.
Thanks, David
#N canvas 311 83 876 527 12; #X obj 157 209 line; #X obj 183 72 t b b; #X obj 157 163 pack 0 0; #X floatatom 499 161 5 0 0 0 - - -; #X obj 254 103 random 3000; #X obj 303 204 print; #X obj 214 133 + 500; #X obj 168 301 == 0; #X obj 174 399 sel 1; #X obj 160 354 change; #X obj 150 25 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X obj 499 280 mtof; #X obj 496 345 phasor~; #X obj 500 196 / 2; #X obj 496 237 + 15; #X obj 469 456 dac~; #X floatatom 17 275 5 0 0 0 - - -; #N canvas 0 0 466 316 get_new_target 0; #X obj 32 20 inlet; #X obj 102 223 outlet; #X obj 24 171 f; #X obj 94 161 sel 0; #X obj 171 166 f; #X obj 23 84 random 128; #X obj 186 95 oneshot; #X connect 0 0 5 0; #X connect 2 0 3 0; #X connect 3 0 5 0; #X connect 3 1 4 0; #X connect 3 1 1 0; #X connect 4 0 3 1; #X connect 5 0 2 0; #X restore 19 122 pd get_new_target; #X obj 171 446 s top; #X obj 191 30 r top; #X obj 317 454 s out; #X obj 494 114 r out; #X connect 0 0 7 0; #X connect 0 0 20 0; #X connect 1 0 17 0; #X connect 1 1 4 0; #X connect 2 0 0 0; #X connect 2 0 5 0; #X connect 3 0 13 0; #X connect 4 0 6 0; #X connect 6 0 2 1; #X connect 7 0 9 0; #X connect 8 0 18 0; #X connect 9 0 8 0; #X connect 10 0 1 0; #X connect 11 0 12 0; #X connect 12 0 15 0; #X connect 12 0 15 1; #X connect 13 0 14 0; #X connect 14 0 11 0; #X connect 17 0 2 0; #X connect 17 0 7 1; #X connect 17 0 16 0; #X connect 19 0 1 0; #X connect 21 0 3 0;
Hallo, David Powers hat gesagt: // David Powers wrote:
I am making a simple patch to automatically morph between parameters every so often. One idea for this is, if I end up VJing at the 6 am afterparty and I am too drunk, I can have it morph things for me and I can take a break. :) Well, I'm not sure if that is a joke, or if it's true.
Anyway, I know I'm doing something stupid with this patch, that causes it not to work right. The first time I run it, I hit bang, and it outputs twice to the print, instead of once - there is some kind of loop that I don't want.
The [s top] at the bottom will be read in again at the [r top] at the top and thus it will bang the [pack] twice at the first start.
Why does it do so? Because you didn't use [trigger] and have "fanned" connections in your patch at a crucial place: the outlet of [pd get_new_target]. Always use [t] where order might matter. Always.
So, the outlet of [pd g_n_t] goes to both the pack and the select. But which one will get it first? It's undefined without trigger. In your patch currently the [pack] gets it first, then the [select]. So at the first random number, lets call it A, [pack] will start a ramp from 0 to A, and [select] will first look for a 0, then for A. It will get the zero immediatly from the pack->line, because [line] starts at 0, so "change->sel->s top" will bang and reinitiate a new random number, lets call it B. B will get send to both [pack] and [select] again. In your patch, again the [pack] will get it first, then the [select], however actually the order is undefined as you didn't use [trigger].
So while [line] still is trying to reach A, [select] now is waiting for B which it might never see, if B is not in the range 0,...,A.
So to fix your patch, the old saying stays true: Pd stands for "Pull da trigger!"
Btw: You could also replace the [== 0][change][sel 1] construct with a simple [del] whose delaytime you set from the "[random 3000] + 500".
Frank Barknecht _ ______footils.org_ __goto10.org__