I have seen a NaN reported by the AW Meter module on a floating point audio stream. Does it necessarily mean that NaNs are indeed present on the audio channel?
Certain floating point operations on unexpected inputs can produce NaN output, such as 0.0f/0.0f, log(negative #), etc. How do AW modules handle NaN outputs?
6:03pm
I tried a few simple experiments in AW running on a Windows/Intel machine.
0/0 doesn't produce NaN. This is the case when I tried two different ways. 1. Use a wav file of 0s as input, and Sys_toFloat module to convert to float; 2. Use floating DCSource module to generate 0.0f.
Sqrt module when passed in a negative # also doesn't generate NaN output.
Log10 module, however, indeed generate NaN output with a negative # input!
10:59am
Hi,
Good catch! The divide and sqrt modules do indeed have built in protections against divide by zero and sqrt of a negative. But, as you found, the Log10 module does not protect against negative inputs and just returns a NaN in that case.
To protect the Log10 operation, you can place an Abs module before it. Or, tweak your algorithm upstream to make sure that the input to the Log10 is always > 0.
As you've found, our documentation needs to be more clear about which modules have internal protection for invalid operations, and which may require user protection. I've put in a ticket to make this improvement.
-Axel