bitfocus / companion-module-allenheath-sq

MIT License
11 stars 4 forks source link

Fading to level +10dB under the LinearTaper fader law instead fades to very near +10dB before dropping to -∞ #62

Open jswalden opened 4 months ago

jswalden commented 4 months ago

The computation of `VCVF from level under the LinearTaper fader law is currently

Math.round(15196 + level * 118.775)

which is adequate as far as it goes. But it turns out, as I discovered by happenstance, it fails ever-so-slightly for +10dB: the result of the inner sum ends up being in range (16383, 16384), but closer to the upper level so Math.round changes it to 1 << 14 which means when VC/VF are extracted, they both end up being zeroes.

Changing this to use Math.floor will change computations by 1 part in 16384, but I think it's safe to say that amount of change in behavior is both tolerable, and practically utterly inaudible.

jswalden commented 4 months ago

This is fixed in https://github.com/bitfocus/companion-module-allenheath-sq/commit/01624c956b48418b926833bf0a7bd9204343ed11 and will...eventually...appear in a release. I'm guessing people don't ordinarily max out the level of a fader and so that's why this hasn't been reported before.