Dynamic max voices based on CPU load

Hey, so my app is a cross-platform synth. Since each device has wildly different levels of processing power, what’s the recommended way of setting the max number of synth voices? I notice the ROLI Noise does it per device, i.e. on the iPad 2 it’s monophonic, but on newer devices you can have more.

My initial thought was to set this manually per device, like Noise. Detect the device type (iPad 2/3/4) then create x voices based on that. However, the CPU varies per preset, so it doesn’t make sense to limit the polyphony as much on cheaper presets.
What about a dynamic max voicing system? The voice count starts low, but based on the CPU load, it keeps adding new voices until a max load is reached. Then that level is saved with the instrument. This way, you don’t have to manually go through each instrument for each device, setting a maximum.

The easy way of doing this is having an option for max voices in the settings, and the user can then set it manually. However, since a lot of our users are new to digital music, they won’t associate buffer overruns with CPU power and thus swamp us in bug reports…

We do this for each preset. Every preset has it’s voice limits hard-coded.

Hard coded per preset per device? Won’t that be a nightmare on android?

So finally I implemented a dynamic voice count based on the peak cpu load since the last noteOn. It seems to work quite well. Each presets starts with 2 voices. At the start of each noteOn, if the peak CPU since the last one is less than a certain amount (say 30%) and all voices are being used, add a voice. Then if the peak CPU load is above another amount (say 40%) remove a voice. It saves the max voices so the procedure doesn’t have to start from 2 voices every time.
What would you recommend to be a good CPU usage threshold for adding and deleting voices?

1 Like