Dynamic voice allocation for variable-size MC chords
Hi everyone,
I’m trying to figure out the best way to handle dynamic voice allocation with MC signals, and I’m wondering if mc.voiceallocator (or another MC object) can solve this.
My setup is roughly this:
I’m using mc.chord to store and recall different chords/sets of notes. The number of notes is not fixed — sometimes the chord contains only one note, sometimes two or three, and sometimes it can contain 8 or more notes.
I would then like to send these notes to a bank of oscillators, for example something like:
mc.cycle~ with 30 channels
The problem is that I don't want all 30 MC channels to be active/processed when the current chord only contains, say, 2 notes.
Ideally, I would like some kind of dynamic voice allocation where:
If the current chord contains 1 note → 1 oscillator voice is active
2 notes → 2 voices
3 notes → 3 voices
8 notes → 8 voices
etc.
The voices should also be allocated/released properly, including the release/tail time of a voice. So if a note ends, its voice should become available again rather than simply having a fixed number of continuously active MC channels.
My initial thought was to use mc.voiceallocator, but I'm not quite sure how to structure the signal flow for this.
For example, would it be possible to have a fixed pool such as:
mc.cycle~ @chans 30
and then dynamically allocate only the number of voices actually required by the current mc.chord?
How can I dynamically map a variable number of notes from mc.chord to a pool of MC voices without processing unnecessary voices?
A little help patch would be deeply appreciated.
Thanks!
You want to use a "busymap" that keeps track of which voices are in use and then mute the rest. You can do that within a poly~ object using thispoly~. For mc.* objects, you're correct that mc.voiceallocator~ is one good approach. You can read up on its busymap (named or unnamed) in the help file and reference manual.
Here's an (overly simple) example. In practice you'd want to make sure that a voice is not sounding before you disable it, so you'd probably want to use a "round robin" voice allocation that only disables voices when they're done playing a note, and only starts notes on unbusy voices.
Christopher! thx for the patch will go through this carefully now but it seems like the exact thing I was looking for ! all the best, Luca
Hey Christopher. I kind of achieved what I wanted. Would you consider this a good solution?

Yes, that looks very good to me. A multichannel signal in the left inlet of mc.voiceallocator~ serves as its busymap; when the signal value of a given channel goes to 0 that voice is marked unbusy/muted. (The "audio input" tab of the help file has an example similar to yours.)