Sorting Midi Low to High
I'm building a sort of arpeggiator. I want to sort incoming Midi from the lowest note to the highest note when playing a quantized chord into my device. 90% of the time the midi from Ableton actually is already sorted that way, so the first note that arrives is the lowest and I can happily use a Poly object.
But with some chord changes this does not work - usually if I only change one note in my chord from one to the next.
Is there a way to do this without too much latency? I've tried a few methods before but they all create some sort of latency. I hope I'm not asking for something impossible.
Quick search brought this thread
Source Audio explained what to do
You can easily use zl.sort once list is grouped
But
What if chord is 3 notes, then next chord is 5 notes?
What if chord is 4 notes but only one note changes and 3 are held?
How does computer know what comes next when grouping?
Thank you! Yes I've tried thresh and group with zl.sort but the latency is too high unfortunately. There's must be something quicker I hope.
I mean off course there has to be some latency logically, but it should be a few samples only, since the notes arrive basically at the same time if I draw them in the note editor.
xxxxxxxxxxxxxxxxxxxxxxxx
Thanks! I guess I'll have to live with some delay. I updated your patch so that it uses my note on / off as well.
Also works with a quickthresh
"since the notes arrive basically at the same time if I draw them in the note editor."
in theory, in live, midi events can be scheduled in ticks. in practice they will not arrive in the same speed in max4live as they were send by the sequencer. it is not as bad as sending them over a physical connection, but it is not immovable, either.
also, in theory, if you set two notes to the same logical time (and the same track) in an app like live, they are usually sent out ordered already. at least you should check that if live sorts or actually store and play the events in the order they have been created. (i dont know for sure)
quickthresh or thresh 1 usually work in practice, but there is no written warranty coming with that.
as mentioned in that first link, you could use coll.
more of a question is how to play arpeggio with held notes
when number of held notes changes and they also get resorted.
here one example.

you can delete cellblock , it is just there to show held notes
"they are usually sent out ordered already." In most cases they are, just any note that stays the same between two chords comes late. If I play c3 min and c3 maj it becomes 60, 63, 67 - 64, 60, 67.
I'll also take a look at the coll suggestion, that looks like just what I needed. Thank you.