Yes I figured there might be a limitation there somewhere.
This code uses iterated snd-avg calls to produce the average and get around the max block-size limitation that the previous version had. I did try writing the brute force loop through all the sound sample and accumulate s, s^2, smax and smin but that was going to be a LOT slower than the iterated snd-avg functions.
I also worry a bit, there may be an accuracy problem still. If you naively add up 2^20 samples in 32-bit floating point hoping to generate an average, toward the end of the sum you may be discarding a lot of bits from your samples. I donât know how snd-avg is implemented â do you know if it has anything that might mitigate this source of error?
Still what would be really nice would be a primitive call written in C++ (or whatever the native language of Audacity is) that efficiently went through a sound and return the sum of the samples, the sum of the samples squared, the max and the min.
[quote=âflynwillâ]
However the progress bar is totally confused by the multiple passes that the code takes.
[/quote]I think what is confusing the progress bar is the time taken to load and release memory. The actual processing is very fast, and that is shown reasonably accurately by the progress bar, but writing hundreds of MB of data to ram, (and then releasing the ram), takes time that the progress indicator cannot take account of.
I found a brief discussion of next cut at plugins being able to provide feedback to the progress bar to make it better⌠did that ever go anywhere?
There is another problem which is that A-weighting filter is specific to 44.1 kHz sample rate. If, for example, you analyze white noise with a peak of 1.0, the A-weighted result shows -7.1 dB, which I think is about right, but for a sample rate of 192 kHz it shows -12.85 dB. Fortunately the Nyquist filters are clever enough to recalculate their parameters so that the âshapeâ of the filter remains correct, so itâs only the âfudge factorâ that needs to be tweaked.
Hmm⌠Iâll check into that. Assuming the âfudge factorâ is a simple calculation from the sample rate that should be easy to fix.