testing for a range?

Crinkle's icon

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

Luke Hall's icon

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

lh

Max Patch
Copy patch and select New From Clipboard in Max.

Crinkle's icon

Hi there I looked at your example and studied the [

Max Patch
Copy patch and select New From Clipboard in Max.

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!

ch's icon

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.

Crinkle's icon

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:

Max Patch
Copy patch and select New From Clipboard in Max.

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?

Jean-Francois Charles's icon

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.

ch's icon

the stack overflow occurs because of that part :

Max Patch
Copy patch and select New From Clipboard in Max.

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.

Peter Castine's icon

Quote: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...

Crinkle's icon

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!

Luke Hall's icon

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!

lh

Roman Thilenius's icon

[if $i1 < 1 then bang]

[if $f1 >= -5. || $f1

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

-110

Phijel's icon

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