Forums > MaxMSP

testing for a range?

July 17, 2009 | 4:43 pm

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.


July 17, 2009 | 4:59 pm

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

lh

– Pasted Max Patch, click to expand. –

July 17, 2009 | 8:52 pm

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

———-begin_max5_patcher———-
349.3ocwTEsSBCCE84QB+CM8YbosCVFFewuCiwzsUgZ1ZWncQTh+61dGEPYR
lHpurax4d6cmy41a2LdTDNWuVXvnqQ2ghh13Ph.LORT.HBWyWWTwMPg3Zgwv
WHvS1lzJVagDojcXxR.Qm+zUrzcnOpUVi7UgOGkESB3p1ZopRXg9yBnMbawR
oZwCqDE1NJxxl6NEhMk3CIr3YSPzrXB59CZkt0F5EM.2gYeoQz0HLd+Q7rRw
qgL3aWI4UXHyaiG4itvjA6M4sVqV0qMvv8JW5IjaBKCz4TJnZR362Wt4b0Bm
jOacoDO6Dwwi7a5UpjK2DOgkBpd9r8S7yyBjJ6uzP+KWHn84Nz4WP2Y1TvcR
R+S2G5pEWIUG81APRehOYXFc6phvOK7r.5.hVJLVohakt0mCph7wpVJKKEPA
6LqZYYi1Mb2xjScIe3jiLHxw9WHm+Bz.cN5Ohbd.W3c.b4xUU.
———–end_max5_patcher———–

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
July 17, 2009 | 10:11 pm

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.


July 18, 2009 | 12:10 am

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?


July 18, 2009 | 1:13 am

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
July 18, 2009 | 1:21 am

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.


July 18, 2009 | 10:07 am
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…


July 18, 2009 | 5:11 pm

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!


July 18, 2009 | 6:21 pm

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


July 18, 2009 | 7:36 pm

[if $i1 < 1 then bang]

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

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

-110


July 19, 2009 | 7:41 am

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


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