Sort/tagg a number of note events by pitch

FriFlo's icon

I would like to let max assign a number of n note events to voice 1-4. That works pretty well with the poly object. What I could not figure out is: How can I assign these not in the order they where played, but from highest to lowest pitch! Of course that would only work, as soon as the required number of notes was sent in, but that's ok!

For Example:
n=4 (four voices available) > a C-Major 7 chord is played > as soon as the last of the four notes was played the patch should output:
Voice number / Pitch:
1 / C3
2 / E3
3 / G3
4 / B3

Any idea? What I am missing is basically something like a "compare"-object. Anything to sort the three notes by pitch from smallest to biggest value ...

brendan mccloskey's icon

Hi friflo
I'm sure this came up recently, but damned if I can find it. Try the [zl group] [zl sort] objects?

Brendan

broc's icon

The output of poly (packed into a list) can be used directly to store the notes in [coll] and sort them there.
This makes sense in particular if you want to keep the individual note velocities.