Best practice to avoid audio clipping with polyphony

I have to handle the (classic) audio clipping problem when playing polyphony coming from the added signals from the different voices. One simple way to handle this is to decrease the overall gain. What is the best way to it: implement something on the voice-based (in SynthesizerVoice/MPESynthesizerVoice) or handle this where the signals are added (in Synthesizer/MPEsynthesize)? Is there a better way?
Thanks in advance.

Industry Best Practice: Add a control to your UI called ‘Master Volume’.


I would vote for “Main Volume”, or just “Output”. Avoid language like “Master” and “Slave”.

1 Like

The user has to reduce gain if too loud. After all if you’re compressing the mixed signals in some way you’ll ultimately alter the audio of the individual voices. And I recon you just want multiple pure voices in their full glory :slight_smile:

It all depends on the instrument you want to create. For the old hammond organs that choking effect, when the tone wheel didn’t deliver enough energy for all notes, was later an actually desired effect.
So in some instances a built in limiter is also a good choice.

1 Like

Thanks for the answers. Going for a main gain was my first choice too. I was also considering to “smooth” the added voices such as to make two voices sounds louder than one voice but not “twice” so loud. So i was wondering is this is a good practices and if some “smoothing algorithms” were well known.

For automatic gain compensation you can get some ideas from here: