[Audacity-devel] bug fix for RECIP function in Nyquist
A free multi-track audio editor and recorder
Brought to you by:
aosiniao
From: Roger D. <rb...@cs...> - 2009-01-12 15:02:36
|
I have a simple fix for audacity/lib-src/libnyquist/tran/recip.c: line 168, susp->scale = s1->scale; should be changed to: susp->scale = (1.0 / s1->scale); I've tested this in Nyquist, but due to beginning-of-semester crunch, haven't taken the time to check out and check in all of Audacity for a one-line change. Explanation: Nyquist keeps a scalar scale factor as part of it's internal sound_type and tries to fold scaling into existing multiplications. In the case of RECIP, the scaling can be folded in, but of course the code should be scaling the output by the *reciprocal* of the input scale factor. The bigger the input, the smaller the output. Since the scale factor is almost always 1.0, this mistake went unnoticed for a long time. For a complete fix, line 4 of audacity/lib-src/libnyquist/tran/recip.alg should also be changed from: (STATE ("double" "scale" "s1->scale")) to (STATE ("double" "scale" "(1.0 / s1->scale)")) This is the true source code which can be automatically translated into recip.c. Thanks, Roger |