When to use ScopedNoDenormals and when to not?

In a default Projucer Audio Plugin Project, there is a ScopedNoDenormals declared at the head of processBlock(). This would seem to imply that this is standard procedure.

Should this be in every processBlock of every AudioProcessor you create? Or are there times to use this and times not to?

If you are processing incoming audio, do you always need this? What about a synth?

I’m a little unclear on what exactly this does - a really dumbed-down simple explanation of denormals would help. I understand they are extremely tiny floating point values close to zero, but most of the explanations on the net baffle me…

That’s what they are essentially. You want to avoid them in your audio code because you may end up with anomalies like a plugin that outputs just silence will start using a crazy amount of CPU time. (Making calculations when the CPU is in the denormals mode is expensive.)

1 Like

So you should always use this?

Yes, unless you have reason to believe switching the denormals off and on is itself a really expensive operation.