Splitting midi channels to control m8 with polyphony... but note off!

I’ve hit the limit of my poor PD knowledge!

I’m trying to create a patch that will allow me to control the Dirtywave m8 tracker (it’s amazing…) over MIDI for polyphony. Getting polyphony out of the m8 involves a bit of a hack, as it’s a tracker: each incoming midi channel can only play monophonically, so to get polyphony, you need to take the notes of a chord and send each note to a different midi channel (each incoming channel, in the m8, will be connected to the same instrument).

I’ve fudged together two prior projects.

One is this (quite old) discussion about using tables to store midi channel information.

The other is an existing (useful!) organelle patch called Midi Control Keys that has features I wanted to keep (like octave switching, transpose, and seq) which was created following a discussion here:

My attempt was only partially successful… I made a patch that successfully distributes the midi notes played on the organelle across different midi channels, so I can play polyphonically on the m8. Unfortunately it doesn’t turn notes off afterwards!

Is there a genius that can help please? Something is amiss in this patch, it might be something small, it might be something huge…

Thanks, and great community, great toy, great resources!

My attempt is here:

My bad! I left out two connections (the GUI of Pd is great but sometimes challenging to transcribe things!). I’ve added the two missing connections but it still doesn’t work, it is sending out notes on sequential channels but the note-off only sometimes and usually not, so notes just ring. My skills are not up to this, hope I’m not being too annoying in a forum of experts!

Corrected patch is here:
https://www.dropbox.com/s/lto6gs8wxtuwml2/m8 roundrobin2.zip?dl=0