Does JUCE apply some automatic gain control?

Hi,
I have a weird problem. When generating sound with a JUCE stand alone application, I’m not able to overdrive the output. When generating signal much larger than in the -1.0 to 1.0 range it still sounds unclipped. But I hear some gain control because when using a fast attack the sound initially sounds louder and then quickly goes down in gain.
Is this a behaviour of JUCE? For safety? Or does Windows do this (I’m on Windows 11). How can I prevent this?

No. JUCE has no automaitc gain control.
Also I wonder on what process you are setting a fast attack? Sounds like some kind of dynamic processor?
That is probably what you are hearing.

Windows does this intentionally. You can avoid it by using ASIO instead of Windows Audio.

1 Like

If you need clipping/overdriving, you should implement that in your own code and not rely on the operating system or sound hardware to do that for you.

The analogue overdrive is an artefact that is surprisingly hard to model in a digital algorithm.
If you just linearly increase the gain by a factor, it doesn’t sound any different but louder.
Once you exceed the specs of the system, you will get artifacts, but they are most likely not what you want.

You need to find that kind of non linearity that alters the sound in the desired way. And there are many different ones from a trivial hard clipper to non linear amplification curves or models of analog circuits.

A good introduction is @IvanC s 50 shades of distortion talk: