MIDI Poly alternative

Liam Maloney's icon

I'm building something that uses a poly object to allocate 8 MIDI notes in a synth. However, the poly object only allows you to 'steal' the oldest playing note. Is there a way to steal the nearest pitch note instead? I'm wracking my brains and I can't think of a workaround.

TFL's icon

As far as I know there is no built-in poly or poly~ mode to steal the nearest pitch note, but you can build such a system yourself.
For example you could use a list to keep track of your polyphony. For example, the list "0 56 60 0" would mean that voices 1 and 2 are playing notes 56 and 60 respectively, while voices 0 and 4 are free. Once the list is full of non zero values (meaning that all voices are being used), you can check the difference between the new note to play and each element of the list, and replace the one with the smallest difference. The hardest part might be how to build such a list...

Source Audio's icon

that is a good one.
You could for example store 8 notes into coll,
then search for nearest held note when 9th note arrives.

Using voice assignments like that will require
target messages instead of midinote or note .

Liam Maloney's icon

The list/coll idea is worth a shot certainly. I'll give that a go. Thanks for the help

@source audio - what do you mean by target messages?

Source Audio's icon

I mean that which voice gets replaced can not be left to poly~.
you have to use target messages to do that.
If you don't know what that is, look into help file of poly~.
By the way, making list with voice - note pairs is best done with coll
or borax.