Forums > MaxMSP

Filtering CC messages

March 6, 2014 | 3:37 pm

I’m sure this is a pretty trivial problem but I can’t figure out how to filter for certain CC messages. So MIDI comes in and midiparse gives me just the CC’s like:

Controller value
15 36
15 37
15 38
20 101
20 102
15 39

etc.

– now I need to make a filter to allow e.g. only CC 20 through – and then give me the value for CC 20.

I’ll bet this is dead simple but I’m just going in circles with ‘sel’ and ‘gate’ right now! Any tips appreciated!


March 6, 2014 | 5:32 pm

route


March 6, 2014 | 5:39 pm

with [select] you are on the right path. but you can also use [route].

[route 20] will filter lists according to their indexes correctly but it cuts the first value in incoming lists off, so that you had to regenerate it.

you basically only need to do

[route 20]
|
[prepend 20]

and you have a working filter.

note that both, [route] and [prepend] can be "set" dynamically when they only have 1 argument.

if you want the same for general purpose you have to make sure that "20" can also pass when it comes as single number and not as list. this can be done like in the picture. (which here only takes arguments and is not dynamic.)

Attachments:
  1. route

March 7, 2014 | 9:24 am

Brilliant, thanks so much guys!


March 7, 2014 | 1:14 pm

@Roman,

You could use routepass and you wouldn’t have to muck around with prepend.

-E


March 7, 2014 | 3:22 pm

Thanks Evan – I think in this case Route suits the purpose best as once I’ve filtered for controller, all I need is the value :D


March 7, 2014 | 3:51 pm

Oh for sure, I was just pointing out the alternate routing object, I just found that one recently and it helped eliminate a ton of extraneous prepending :)


March 8, 2014 | 10:56 am

one could also do 5*4 and use zl join to prepend it. :)

right, routepass.


March 9, 2014 | 5:00 am

Thanks again, all!


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