How to mix Synthesizer oscillators? Why does dividing by the number of oscillators not work?

I’m currently using a Juce SynthesizerVoice class for my oscillators and I got controls like detune, random phase to work. However, I realized that although the synthesizer class is pretty good at avoiding clipping, when running 10 oscillators, the output clips and gets distorted. So to solve this problem I tried dividing the sample value by the number of oscillators currently running, but I realized as I increase the number of voices the sound actually gets quieter instead of the same.

Why is this happening and how can I fix it? Also how do mainstream synthesizers like sylenth1 or serum manage the number of oscillators? I realized when I increase the number of “voices”(oscillators) in sylenth1 or serum without detune/random phase, the output actually gets a bit louder and doesn’t stay the same level. If you can point me to any articles/links for oscillator volume management that’d also be great :slight_smile:

Dividing by the number of oscillators only makes sense when we are talking about summation of amplitudes. This only happens when the oscillators have the same frequency, and when they are in-phase. That’s not the case when there are different notes -> different frequencies. So in this case we have summation of energy. The only difference is a square-root in the calculations.

So what you can do is to simply divide by sqrt(numOscillators) instead of numOscillators. However, this won’t prevent your synth from clipping, as in-phase summation can occur, and you’ll get high peaks. And it might result in a strange feeling, cause in general you don’t want the level of one note to drop, just because you are playing another one. Try to have some headroom for more voices -> lowering the overall level of your synth. You could also use a smooth compressor and maybe even a decent limiter for really dense situations :slight_smile:


Thank you so much for the explanation! But although I got it to work in my code my intuition for the physics of amplitude/energy is a still bit blurry. Can you point me to some intuitive articles regarding why dividing by sqrt of number of oscillators work?

Haven’t read that specific one, but in general, Sengpiel wrote some very nice articles:
Voltage/sound pressure would be amplitude, intensity energy.
Maybe not the most intuitive or shortest article out there about sound level :slight_smile:

In general, adding two sounds will add up their energies. Unless the sounds are the same and perfectly in-phase, then it would be adding up the amplitudes, resulting in double amplitude but fourfold energy.

1 Like

Thank you!

Hey @danielrudrich sorry to bother you again… I totally forgot to test this earlier but I just realized that my synth clips like crazy when I do not have detune or random phase on, which you mentioned above. You said to use a smooth compressor, I’m guessing that means a compressor with a soft knee. I searched it up on the forums for examples but can’t find any. Can you point me to any links on how a real time smooth compressor for synthesizers works?

The compressor doesn’t got to have a knee setting, but won’t hurt :slight_smile: I rather meant gentle compression, as in general you don’t want the user to hear the compression. So light compression and enough headroom would be my advice here. In case I’ll find some spare time next week, I’ll create a github repo with my compressor class for JUCE.


Ohhh okay thanks for the clarification :slight_smile:

Done here:
There’s also a little article about the wrong and correct implementations of look-ahead:


Thank you so much! :slight_smile: