testing for a range?

Jul 17, 2009 at 4:43pm

testing for a range?

Is there any object which can check for a range of inputs, i am thinking something to test whether a decremeting number has gone below a threshhold, the equivalent in basic to what i want would be “IF x<0 then BANG", i did try Select <1 but it doesn't work.

Jul 17, 2009 at 4:59pm

Have a look at the patch below, you could also look at the [if] and [split] objects.


– Pasted Max Patch, click to expand. –
Jul 17, 2009 at 8:52pm

Hi there I looked at your example and studied the [< ] operator but it doesn’t seem to be working. Check this example:


I clicked the 1 first and then the 60 and the button lit up… is this backward maths or something?? I believe i’m setting 1 as the comparision “ie is smaller than 1″ however the button still bangs when i pass 60 as the test number?! WTF!

Jul 17, 2009 at 10:11pm

from the help/reference of [< ] :
“outputs a 1 if the number is less than the comparison-number or 0 if it is greater or equal”

from the help/reference of [button] :
“Button takes any message at its inlet and outputs a bang.”

So whatever the result of the comparison, the button receives something (0 or 1) and blinks. That’s why you have to use [sel 1] as shown in the patch lh posted.

Jul 18, 2009 at 12:10am

Ok thanks for that, i only thought the button went off if it was a 1 signal, which seems to me to make more sense. I’m about ready to give up on maxmsp as a programming language though, as like really early languages, it stops on a problem with a very general “stack overflow” error, without giving the faintest clue where the problem is. The following example:

– Pasted Max Patch, click to expand. –

Is supposed to produce a 1 dimensional “bouncing ball” effect, but does not.

0.08 is the initial gravity value and the red marked objects should be incrementing that gravitational velocity, before sending it on. The turquoise areas test for if it hits the bottom, and should invert the gravity velocity. The pink area is just the actual resulting position on the graph.

Am i doing this right? Is what i’m trying to achieve even remotely possible in maxmsp?

Jul 18, 2009 at 1:13am

Just answering about the Stack Overflow:

[+ ]
[f ]
output connected back to the left input of the [+ ] above

Of course, this is a typical example if you want to show student how to get a Stack Overflow.

Jul 18, 2009 at 1:21am

the stack overflow occurs because of that part :

– Pasted Max Patch, click to expand. –

where you doing an infinite loop. (BTW a simple [+] will give you an integer, not a float).

You should definitely go through the tutorials if you want to learn max.

Jul 18, 2009 at 10:07am
i only thought the button went off if it was a 1 signal, which seems to me to make more sense.

You really need to spend some time with the tutorials. The behavior of button is completely consistent with the way Max is conceived. If you come to Max with non-Max concepts, you’re going to spend a lot of time tripping over false expectations.

Nothing wrong with noobies using this list/forum, but Max has an extensive and excellent set of Tutorials and Help, and if you don’t use them you’re going to end up wasting a lot of time–yours and other people’s.

Just a word to the wise…

Jul 18, 2009 at 5:11pm

I did start looking at the tutorials actually. And to be honest, i dont think they really are tutorials, by my own expectations… the help files simply present you with the workings of maxmsp… they dont actually task you with building the examples, or modifying them. They do obviously show you the machines and explain them, but i’ve always though that getting you involved along the way and setting you tasks to do was a much better way of learning it.

Does anyone know of any such tutorial guides? As the maxmsp ones feel like more of a reference than a “teach yourself” resource!

Jul 18, 2009 at 6:21pm

Do you mean the tutorials or the help files? The help files explain what each object does and the tutorials explain some of the key concepts of max and how to do certain things in max, msp and jitter. They’re included with the program, you can find them under the help menu and also here online too. You might also want to check out the baz tutorials on youtube. Peter Elsea also has some great tutorials here. They’re all worth a look, the max ones especially. Think of them as required reading!


Jul 18, 2009 at 7:36pm

[if $i1 < 1 then bang]

[if $f1 >= -5. || $f1 < = 7.33 then bang ]

[if $f1>500 then $f1 else out2 bang]


Jul 19, 2009 at 7:41am

Max has the BEST set of tutorial for a program of this kind.
Trust me, you’ll go nowhere without going through them.
Start learning slowly, seriously & with humility before criticizing every aspect of something you simply do not understand.
And you’ll receive a lot of help from the wonderful people here when needed.
Otherwise, you’ll make a fool of yourself in no time.

just my 0,02


You must be logged in to reply to this topic.