Gale Andrews wrote:I think I've also gathered that the "Period" variant will continue to (visibly) attenuate the equal amplitude tone if there is still some audio in the window length chosen that is above the target level... even though that pushes the start or end of the audio below the target level. Correct?
The "Period Target Fade" is still pretty simple. It looks for the highest peak within the window and amplifies the sound so that that peak will be at the target level. If the overall fade is increasing, then the final level will be above the target, if the overall fade is going down then the final level will be below the target (it's a target, not a destination).
Gale Andrews wrote:I still think that's kind of unexpected; is it more useful with real world music to go straight to the position where there is no audio in the window length above the target
Yes, but that's a lot harder to do. It does not matter so much when the target length (the target "window") is very much smaller than the overall length, (as in the "Simple Target Fade") but for larger windows the slope of the amplification envelope becomes significant, and what was originally the highest peak may not be the highest peak after it has been amplified.
The simplest way to deal with that would be to scan the initial and final periods in small blocks (say 50 milliseconds) for peak values and store the results, then to compare each combination to find which combination will produce the desired result, but that could be millions of iterations. I've thought of a better way to do it, but not finished yet.
Gale Andrews wrote:Is the "Period" version amplifying more than it should?
No, the "Simple" version is amplifying less than it should.
The Simple version
should use a period size of 50 milliseconds for both the initial and end windows, but in fact it is using a 50 millisecond window size for the initial part, but a window size of 5% for the final period.
It's a bug.
The bug is fixed in the "Period" version.
The "Simple" version also contains no error checking, so it will produce "divide by zero" errors if the initial or final windows are silent (the first 50 milliseconds or final 5%).
The "Period" version avoids this by setting the amplification amount to zero if the window has only silence.
Here's a version of the "Simple Target Fade" that correctly uses 50 millisecond windows top and bottom.
It will also display an error if the start or end are silent (which is probably what it
should do).