Forums > MaxMSP

comparing values

October 15, 2010 | 3:42 am

Why do these not work? How can I check if a value is within range?

I am managing to sent out a bang but how can I send a specific value?

Thanks.

– Pasted Max Patch, click to expand. –

October 15, 2010 | 4:13 am

Maybe split?

– Pasted Max Patch, click to expand. –

October 15, 2010 | 4:22 am

Nice, thanks. Good to know. The only thing is I need to output 1, 2, 3 and 4 in order to control Gate object with it. How please?

I would also like to understand why my expressions were not working.

And here is my attempt with comparison operators. This one also does not work.

Thank you very much.

– Pasted Max Patch, click to expand. –

October 15, 2010 | 5:31 am

if then needs a little getting used to, doesn’t always work like C (i had better luck making sure $f1 variables were towards the left among other things like being explicit about everything, etc.
i’m having trouble explaining…

if you can use comparison operators, that might be more efficient but here’s a little of both(you could easily rework the ifthen here for your question about outputting 1 through 4 for gate), hope it helps:

– Pasted Max Patch, click to expand. –

________________________________
*Never fear, Noob4Life was never here!


October 15, 2010 | 7:05 am

Thank you. Very useful. But they still output bangs, how do I get from a bang to an int? And output that int only once for each range of values?

Sorry about the primitive questions, I am finding it a bit hard to get through the simplest things sometimes because I am not familiar with MAX’s idiosyncrasies and the doc’s examples cannot cover everyone’s precise scenario…


October 15, 2010 | 7:14 am

I still think split makes sense for this problem.

– Pasted Max Patch, click to expand. –

In your example with all the > < operators, it looks like you're trying to set a range with each pair, but you have your range improperly specified.
For example, you’re looking for a number that is < -5.36 AND > -2.68, which is not going to happen. If you swap the operators so that you are looking for > -5.36 AND < -2.68 you will spacify a range.


October 15, 2010 | 10:48 am

Very nice. Thanks a bunch, Chris.


October 15, 2010 | 7:26 pm

you can come from bang to int using [i], [t], [var], [pvar], [zl reg], [sprintf], [text],
[coll], [expr], gui objects, java or javascript, or about 30 other ways … choose one!

my choice would be trigger: [t 4]

-110


October 15, 2010 | 11:20 pm

Thanks. I knew it was the case but helps to know what to look for.


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