Ratatouille.lv2 icon indicating copy to clipboard operation
Ratatouille.lv2 copied to clipboard

Blend Knob Issue: Volume Drops at Midpoint Settings

Open Riebeck-one opened this issue 9 months ago • 2 comments

It seems like the blend knob does not keep the volume constant across its range. What I mean is that having the blend set to 0 or 1 gives approximately the same output volume, but setting it to a value in between, like 0.5, results in a much lower volume.

I tried to look into your code to see what is really happening with the blend option. I'm very rusty with my C++, and I do not know exactly how LV2 plugins work internally, so I might be saying something irrelevant, but hey, you never know.

I made some calculations to find how you could add the volumes of the two channels corresponding to each neural network. Let $L_1$ be the volume of the first one, $L_2$ the volume of the second one, $L_{\text{tot}}$ the total volume when the two are combined, and $x$ the value of the blend setting (which ranges from 0 to 1). I supposed all volumes are in dB.

My assumption is that:

$L_{\text{tot}} = 10 \log_{10} \left( x \cdot 10^{L_1/10} + (1-x) \cdot 10^{L_2/10} \right)$

Maybe you're already using this kind of formula, but if you don't (and if I didn't make a mistake in my reasoning and calculations), it should make the volume constant across the range of the blend knob.

Riebeck-one avatar May 20 '24 12:05 Riebeck-one