> 2 plugins implement your strategy. Plug 1 goes negative on buffer 1, next in 
> line Plug 2 goes positive. During any overlapping  ‘zero’ period we are back 
> in the mire no?


You’re basically asking: What if your plugin is outputting a stream of, say, 
1e-18, due to its scheme of avoiding denormals, and the next plugin adds an 
offset of 1e-18 (maybe because both are toggling 1e-18). The DAW transport is 
stopped. The second would effectively be getting a stream of exact zeros, which 
it thinks it’s protected against. OK, if both were doing the same thing exactly 
in sync but on opposite phases, and the first was truly passing that value 
without gain change, that would be a problem. But first, the value gets added 
at the start of the plugin processing in the first plug in, and is unlikely to 
be that exact value when it exits, due to gain changes along the way. Second, 
any phase difference between the two would at least give tiny impulses and 
you’d still be OK.

But, you could also use a random number generator, once per entry, an LCG would 
be fine, seed it, scale it…very low cost, especially if you did it only once 
per buffer.

Your plugins could also scrub input of small numbers before adding its small 
number. This could be just adding 1.0, then subtracting 1.0, as long as you 
make sure the compiler doesn’t optimize it away. Or test and zero.

(Yeah, don’t we wish denormalized arithmetic was fast enough to not worry about 
it?) 



> On Apr 11, 2023, at 4:01 PM, Jerry Evans 
> <0000029d6878df19-dmarc-requ...@lists.columbia.edu> wrote:
> 
> This denormal stuff still gets my goat 😊
>  
> A question if I may.
>  
> 2 plugins implement your strategy. Plug 1 goes negative on buffer 1, next in 
> line Plug 2 goes positive. During any overlapping  ‘zero’ period we are back 
> in the mire no?
>  
> Jerry.
>  
> From: music-dsp <MUSIC-DSP@LISTS.COLUMBIA.EDU> On Behalf Of Nigel Redmon
> Sent: 11 April 2023 18:38
> To: MUSIC-DSP@LISTS.COLUMBIA.EDU
> Subject: Re: Are there now 64-bit processors that deal with denorms routinely 
> with no exception or interrupt?
>  
> FWIW, I set a “global” value (an instance variable in my plugin object) to 
> something like 1e-15 (-300 dBFS) or 1e-18. For most samples it’s simply 
> quantized out, and only changes zero samples.
>  
> I negate it periodically—every time my plugin process is called with a new 
> set of buffers is convenient. Toggling the sign keeps highpass filters from 
> removing the offset.
>  
> Add it to the input sample for further processing.
>  
> For typical processing that’s it. Toggling gets it through DC blockers, 
> lowpass filters don’t decay to denormals. But if you’re doing something 
> unusual, you can inject the value again at any point as needed.
>  
> If you skip toggling, you’ll have to be more aware of things like highpass 
> filters, and likely need to inject in more places. Testing a plugin is pretty 
> easy if you have a DAW that has processing meters for plugins. Run it with 
> audio, for a baseline, then stop the transport. If you’re got a denormals 
> problem, the meter for the plugin will rise.
>  
> For the excessively paranoid (“but…how can I be certain it’s not 
> happening?"), it’s not that you need to guard against a denormal ever 
> happening, but against decaying into a long string of consecutive denormals 
> at the sample rate.
>  
>  
> 
> 
>> On Apr 11, 2023, at 3:27 AM, STEFFAN DIEDRICHSEN 
>> <0000009333a9e91c-dmarc-requ...@lists.columbia.edu 
>> <mailto:0000009333a9e91c-dmarc-requ...@lists.columbia.edu>> wrote:
>>  
>>  
>> 
>> 
>>> On 10. Apr 2023, at 12:25, Julien Brulé <julien.br...@obspm.fr 
>>> <mailto:julien.br...@obspm.fr>> wrote:
>>>  
>>> very instructive interesting debate
>>> is it about reproducible legacy code ?
>>  
>> More or less. In the past (let’s say computer medieval age), you needed a 
>> strategy for filters running in floating point to avoid running into 
>> denormals by an ordinary underflow. This could be accomplished by adding a 
>> very small DC or noise component to the input or injecting it somewhere in 
>> the filter structure. This keeps the numerical range above the underflow 
>> condition. With fix point arithmetic, you’ll enjoy limit cycles, which can 
>> create some funky noises in reverb tanks. 
>>  
>> I’ll ry to sum up the state of discussion:
>>  
>> - RBJ's POV is, that todays CPUs should be able to seamlessly switch into 
>> denormals processing. As it seems (thank you for mentioning the 
>> DDI01001.pdf), that’s not the case. 
>>  
>> - Strategies like setting FPU flags to flush to zero or suppressing the 
>> underflow exception (FTZ / UFE) doesn’t seem to cut, since they might be 
>> time-consuming or might affect the processing of your dear neighbors in the 
>> DAW session or the host itself.
>>  
>> - Stefan Stenzel proposed to gain up the input by some hundred dBs and gain 
>> down the output accordingly to push out the likelihood of an underflow, 
>> which leads to an interesting compander scheme. 
>>  
>> - Another strategy is to switch back to fix point arithmetic. 
>> 
>> 
>>> maybe i m too funky ...
>>> DDI01001.pdf
>>  
>> OK, here it is, underflow is still an exception. 
>>  
>>  
>>> ps: how you deal with the discovery of the None or Nan ?
>>  
>> NaNs are very rare, since they can be produced numerically by dividing 0. by 
>> 0.. So, avoiding a division by zero or replacing a division by a 
>> multiplication with the inverse in case of a  constant resolves that. For 
>> denormals, we’re still stuck in the medieval age, see above. 
>>  
>> Best, 
>>  
>> Steffan 
>>  
>>  
>>  
> 
>  

Reply via email to