Implementing Round-Robin Voice Allocation with poly~ in a Max for Live Audio Effect

izuru inayoshi's icon

I'm developing a Max for Live audio effect called Spectral Grain Filter which randomly extracts spectrums from the input audio to create and output grains. I'm struggling to implement a round-robin system using the poly~ object to allow for multiple overlapping grains. I've tried solutions suggested by AI and various patches found online, but none of them worked. Could anyone provide a working solution or advice on how to properly implement round-robin with poly~ within this audio effect context?

Spectral Grain Filter prototype.amxd
amxd 96.20 KB