Noob qstn: polyphonic MIDI in?
Hi,
I would like to live-stream drum midi from Reaper. I have the virtual cable setup, and I'm receiving midi into Max via midiin to midiparse. All good there. But how can I - in real time - separate the kicks from hats if they are pre-quantized to the same note? I seem to only get one note number at a time. I tried to setup an if/then for each note # but the input seems to be monophonic.

btw - first time posting, so please be gentle.
Declan
Instead of [unpack], use the [route] object. Give it instrument CC numbers as arguments and you get a velocity output for each instrument (kick, snare, tom etc).
If you want to split by instrument but keep the number/value pairs for further processing, you can use [routepass].
Thank you! This is definitely what I'm looking for, but I don't seem to be getting the velocity output; only a bang when the kick (CC36) hits. Do I need to add a component to decouple the velocity value? Thanks for your help

when [route] receives only a single number, it will work like its brother [select], because it always cuts off the first list element, even if the input is not a list. :)
Interesting. I'm a little confused, though. Here is my (mis)understanding:
[midiparse] is sending a tree out of the first outlet (a sublist of Pitch, Velocity for each note). And Route is grabbing a branch of that tree, based on the argument (36 for me). So that branch is 1 item - a list (36, 127) - and that list gets dropped? I do get a bang on that button below, so something's coming through.
Thank you again, for your help - I'm loving this program. I use Grasshopper (for Rhino3d) all day every day, so list processing is a familiar concept.

I think you just don't see everything because of the speed. A kick is usually short and a message box is not a fast monitor. Check with the [print] object what's really going on.
When you send a kick event with number 36 and velocity 127 you get two lists from midiparse:
First '36 127' (CC number and note-on velocity)
and afterwards '36 0' (CC number and note-off velocity, which is zero in this case).
When you send that through [route 36], number 36 gets swallowed and you get the two velocities at the first route output (First 127, afterwards 0).
Ahhh, Ok, got it - thanks. So - maybe I will filter our the NoteOff event entirely. Like, If velocity > 0 then...
Thanks again!
Some examples to filter out zero:
Most common: [route 0] and listen at the second output
or
[zl.filter 0]
or
[split 1 127]
or
least common: [if $i1 > 0 then $i1]
Or as Roman would do it:
some [expr ...] formula I do not understand :-)
YES! Thank you Peter - adding the second [route 0] worked perfectly.
[stripnote] is another way to remove note-off messages.
Yup. I always forget stripnote.
But I seldom forget makenote!
@Declan
If you want to remove ALL note-offs, you should do that right after midiparse, not at each route output. For example:
