Forums > MaxMSP

Selecting a range of numbers from a list

April 30, 2007 | 2:37 pm

Hey everyone

I am new to Max/MSP, and until today it has all being going smoothly.

I have two constant streams of numbers that I need to process that range from 20 to 220 (x and y axis on a controller, where approximately 125 is the centre). Each individual stream is then separated into 3 separate banks of numbers to be processed further. To do this I am using the ‘split’ object. This all works well.

The part I am stuck on is being able to create an on/off command in the form of a toggle when X is in a curtain position that co-insides with Y. These have to be a range of numbers not a specific number for either axis.
for example in txt form

When x = a number between 27 and 52 and y = a number between 130 and 225 then toggle on

When x = 125 and y = 125 toggle off (this is centre where the controller rests)

My apologies if this has already been covered. I have had a look on the forum and could not see any answers to my problem.

Thanks

Martin


April 30, 2007 | 3:11 pm

you should be able to do this with the expr or if objects quite easily.


April 30, 2007 | 3:21 pm

you can use an [if]:

#P window setfont "Sans Serif" 9.;
#P number 148 96 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 189 104 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P toggle 148 234 15 0;
#P window linecount 1;
#P newex 148 129 50 9109513 bondo;
#P newex 148 155 50 9109513 pack;
#P newex 148 202 388 9109513 if (((27< =$i1 && $i1<=52)&& (130<=$i2 && $i2<=225))||($i1==125 && $i2==125)) then 1 else 0;
#P connect 0 0 3 0;
#P connect 1 0 0 0;
#P connect 5 0 2 0;
#P connect 4 0 2 1;
#P connect 2 0 1 0;
#P connect 2 1 1 1;
#P window clipboard copycount 6;


Viewing 3 posts - 1 through 3 (of 3 total)