Forums > MaxMSP

Outputting a list if conditions are met

May 12, 2008 | 3:37 pm

Hi all,

I’m wondering if someone can give me a hint about something here…

Is there an easy way to have a message output only if certain conditions are met. In my case, I only need to match 2 conditions.

To be more specific, I’m trying to figure out the most efficient way to have a MIDI message pass through *only* if it fits the conditions. For example, if a C3 on channel 13 is hit, it allows the message through, while all other MIDI messages are ignored. I also want this to be something that can be set and changed easily, so, I don’t think ‘route’ works.

I’ve found a few complicated ways to do this, but I suspect there is an easy way that I am overlooking. Does anyone have any suggestions?

Cheers,
Joel


May 12, 2008 | 4:15 pm

Hey Joel,

This is one way of doing it. Not sure what you’d consider efficient, but it meets all the other aims. If you’re on 5, sorry that it’s 4.6. Can post a rounder corner version this eve if you can’t view it.

max v2;
#N vpatcher 10 59 307 232;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 4 131 50 196617 print list;
#P number 119 11 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 82 11 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 70 37 59 196617 sel;
#P newex 4 102 43 196617 pack 0 0;
#P newex 4 11 76 196617 ctlin;
#P newex 4 37 63 196617 sel;
#P newex 4 73 43 196617 buddy;
#P comment 151 13 123 196617 < desired note and channel;
#P connect 3 0 2 0;
#P connect 2 0 1 0;
#P connect 1 0 4 0;
#P connect 4 0 8 0;
#P connect 5 0 1 1;
#P connect 1 1 4 1;
#P connect 6 0 2 1;
#P connect 3 2 5 0;
#P connect 7 0 5 1;
#P pop;


May 12, 2008 | 4:23 pm

Hey!

Thanks so much for this! I think this will work. This is a bit more efficient than the versions I came up with so I will definitely try it out.

Cheers,
Joel


May 12, 2008 | 4:45 pm

have a look at [match]

/*j


May 12, 2008 | 8:48 pm

Ah yes!!

I was fiddling with match, and I didn’t think it would do what I wanted it to do. After reading this, I looked a little deeper. Turns out, it does exactly what I wanted it to do, I just needed to figure that whole ’65 nn 12′ bizness.

Thanks guys, this is working great now!

-j


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