[chuck-users] clearing a delay line
robin.davies at quest.com
Mon Mar 14 17:33:43 EDT 2011
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 at lists.cs.princeton.edu [mailto:chuck-users-bounces at 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 <casper.schipper at gmail.com<mailto:casper.schipper at gmail.com>> wrote:
I wondered if there is any method to clear the internal buffer of a Delay ugen (since I did find such a function in the STK-kit).
Try setting the max length again. I believe that should flush the buffer as the memory is cleared and re-initialised. To do it without flushing you could use LiSa as a delay. LiSa has a explicit clear function. Theoretically speaking that might prevent memory fragmentation and should have a lower performance cost (and you can ramp down before clearing to avoid clicks). In practice I seem to remember that clearing LiSa can lead to some performance costs too, though that might be related to my ongoing struggle with hard to detect floating-point de-normalisation issues.
Hope that helps,
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the chuck-users