[PD] conditional flow in a patch?

Frank Barknecht fbar at footils.org
Tue Nov 25 16:51:42 CET 2003


Hallo,
Olaf Matthes hat gesagt: // Olaf Matthes wrote:

> qweqwe wqwewq wrote:
> 
> >Geetings. I'm new to this forum and PD.
> >
> >I have to do a work in my University and i'm using PD and 3 MIDI pressure 
> >sensors. Based in the output of that sensors, i need to launch 7 different 
> >patches in PD. So, i need to have a little abstraction where i analyse the 
> >3 sensors: - sensor 1 will output 0 if its below 30 and 1 if its below 30 
> >and below 127
> >- sensor 2 will output 0 if its below 50 and 1 if its below 50 and below 
> >127
> >- sensor 3 will output 0 if its below 70 and 1 if its below 70 and below 
> >127
> >
> [split 30 127] from maxlib 
> (http://www.akustische-kunst.org/puredata/maxlib/) can help you.

You could also just use moses, either two times or just ignore the
upper bound, because most midi cc messages don't go above that. 

> >Another problem is this. I want to read the inputs with 1 min interval, so 
> >a patch will stay for one minute minimum, after that i'll read the values, 
> >and if they are diferent, it'll launch another patch. If they are the 
> >same, it'll stay the same patch and will not retrigger the same one.
> >
> [speedlim 60000] from maxlib or cyclone 
> (http://suita.chopin.edu.pl/%7Eczaja/miXed/externs/cyclone.html) can do 
> this. Or use
> [ignore 60000], it will only allow values to pass through that stay 
> unchanged for one minute.

Then there is [change] and [delay] wich both are build-in. 

> >And finally, another problem... I'll give priority above all other sensors 
> >to sensor 1. This is: when i read the values, if the reading in the sensor 
> >1 is greater than 70 from the previous reading (say, last reading was 27 
> >and next min i have 120), it will launch a certain patch of the total 7 
> >that i have (patch 7 for example) and in this case the outs of sensor 2 
> >and 3 wont matter.

What happens, if sensor 1 was inactive in the previous go???

> >
> [delta] (maxlib again) will give you the difference between the current 
> and the previous value. The higher the value the bigger the change.
> 
> 
> Olaf-the-self-advertiser

Here I could advertise ">" or "<" or hierarchical "route" objects.

I attached an example. It converts your 8 possible states to a number,
that is only output if your either bang (after for example a minute),
or if it changes. 

You could do whatever you want with that number, it is unique for
every state possible. 

I did not account for your last problem yet, because of my open
question. Depending on the answer, you would do something with the
toggle-state of sensor 1 like send it to a spigot.

ciao
-- 
 Frank Barknecht                               _ ______footils.org__
-------------- next part --------------
#N canvas 211 22 846 623 10;
#X obj 26 78 ctlin 1;
#X obj 97 74 pack 0 1;
#X obj 163 75 pack 0 2;
#X obj 228 74 pack 0 3;
#X obj 23 138 pack 0 0;
#X floatatom 102 46 5 0 127 0 - - -;
#X floatatom 172 49 5 0 127 0 - - -;
#X floatatom 228 50 5 0 127 0 - - -;
#X obj 67 184 s input;
#X text 151 13 manual sensors;
#X msg 152 110 \$2 \$1;
#X obj 129 319 r input;
#X obj 150 418 print input;
#X obj 519 78 r input;
#X obj 519 107 route 1 2 3;
#X obj 476 161 moses 30;
#X obj 549 163 moses 50;
#X obj 616 162 moses 70;
#X obj 61 108 moses 128;
#X obj 550 307 * 2;
#X obj 598 307 * 1;
#X obj 489 303 * 4;
#X msg 475 194 0;
#X msg 509 194 1;
#X msg 559 194 0;
#X msg 593 194 1;
#X msg 631 195 0;
#X msg 665 195 1;
#X obj 545 478 nbx 5 14 -1e+37 1e+37 0 0 empty empty result 0 -6 0
10 -225280 -1 -1 7 256;
#X msg 291 23 40;
#X msg 323 24 70;
#X obj 545 429 expr $f1 + $f2 + $f3;
#X obj 755 241 tgl 15 0 empty empty sensor3 0 -6 0 8 -225271 -1 -1
1 1;
#X obj 759 302 tgl 15 0 empty empty sensor1 0 -6 0 8 -262131 -1 -1
1 1;
#X obj 757 272 tgl 15 0 empty empty sensor2 0 -6 0 8 -261689 -1 -1
1 1;
#X obj 581 335 t b f;
#X obj 521 327 t b f;
#X text 706 428 Sum it;
#X obj 545 522 change;
#X obj 529 550 print output;
#X obj 147 372 spigot;
#X obj 195 336 tgl 15 0 empty empty printdebugoutput 0 -6 0 8 -262144
-1 -1 0 1;
#X obj 483 508 f;
#X obj 381 457 bng 30 250 50 0 empty empty bang_here_to_bypass_change
0 -6 0 8 -257472 -1 -1;
#X connect 0 0 4 0;
#X connect 0 1 18 0;
#X connect 1 0 10 0;
#X connect 2 0 10 0;
#X connect 3 0 10 0;
#X connect 4 0 8 0;
#X connect 5 0 1 0;
#X connect 6 0 2 0;
#X connect 7 0 3 0;
#X connect 10 0 8 0;
#X connect 11 0 40 0;
#X connect 13 0 14 0;
#X connect 14 0 15 0;
#X connect 14 1 16 0;
#X connect 14 2 17 0;
#X connect 15 0 22 0;
#X connect 15 1 23 0;
#X connect 16 0 24 0;
#X connect 16 1 25 0;
#X connect 17 0 26 0;
#X connect 17 1 27 0;
#X connect 18 0 4 1;
#X connect 19 0 36 0;
#X connect 20 0 35 0;
#X connect 21 0 31 0;
#X connect 22 0 21 0;
#X connect 22 0 33 0;
#X connect 23 0 21 0;
#X connect 23 0 33 0;
#X connect 24 0 19 0;
#X connect 24 0 34 0;
#X connect 25 0 19 0;
#X connect 25 0 34 0;
#X connect 26 0 20 0;
#X connect 26 0 32 0;
#X connect 27 0 20 0;
#X connect 27 0 32 0;
#X connect 28 0 42 1;
#X connect 28 0 38 0;
#X connect 29 0 7 0;
#X connect 30 0 7 0;
#X connect 31 0 28 0;
#X connect 35 0 31 0;
#X connect 35 1 31 2;
#X connect 36 0 31 0;
#X connect 36 1 31 1;
#X connect 38 0 39 0;
#X connect 40 0 12 0;
#X connect 41 0 40 1;
#X connect 42 0 39 0;
#X connect 43 0 42 0;


More information about the Pd-list mailing list