Hey Kas,
There's an insanely easy trick to avoid denormalization. Not sure if you're aware of it.
The trick: just add a very small bias to the input signal. Something in the order of 1E-10 or 1E-11 works well: many dB below audible level; and may orders of magnitude away from denormalization range (- 1E-35 to +1E-35, roughly).
Why does it work? Denorms almost always happen as the output of a filter (typically a IIR filter) settles toward zero. The chance of actually hitting a denorm value under any other circumstance are so vanishingly rare its not even worth considering. About 1 in 1E20 or so for typical small audio signal values. So if you add a tiny DC bias on the input signal, then the ouput filter should settle toward an even tinier DC bias on the output signal, and that tiny bias will be more than enough to keep the signal far away from denorm range.
As a matter of reasonable practice, you should us different constant randomly-selected small positive or negative values every time you choose to add an anti-denormalization bias, in order to avoid accidentally cancelling out the bias in successive stages.
The one counterexample to watch out for: IIR filters that have a perfect notch at 0Hz (many/most(?) high pass filters). In that case you want to add the denormalization bias to one of output delay taps.
From: chuck-users-bounces@lists.cs.princeton.edu [mailto:chuck-users-bounces@lists.cs.princeton.edu] On Behalf Of Kassen
Sent: Monday, February 28, 2011 9:46 AM
To: ChucK Users Mailing List
Subject: Re: [chuck-users] clearing a delay line
On 28 February 2011 15:35, Casper Schipper