Closed metahexane closed 2 years ago
Hey thanks for this recommendation! I'll take a look at this when I get a breather. Hopefully by this weekend.
You are a rockstar for chiming in :)
Hey man, I actually just built the project from source and changed the code a little bit to function correctly. Had to change the function I proposed a bit as well to suit the options for gain_min
and gain_max
. The function now looks like this:
/**
* converts a A windows volume level (0-100) to Voicemeeter decibel level
*/
const convertVolumeToVoicemeeterGain = (windowsVolume, gain_min, gain_max) => {
if (isToggleChecked('limit_db_gain_to_0')) {
gain_max = 0;
}
// Avoid taking log_10 (0)
let amp = -1000;
if (windowsVolume > 0) {
amp = Math.log(windowsVolume / 100) / Math.log(10);
}
// Use function for dB = 20 * log_10 (amp), with an additional offset for gain_max
const gain = Math.max(20 * amp + gain_max, gain_min);
const roundedGain = Math.round(gain * 10) / 10;
return roundedGain;
};
Wasn't able to branch off and submit a pull request tho.
https://github.com/Frosthaven/voicemeeter-windows-volume/releases/tag/v1.7.3.0
I've also added you to a contributors list for providing this upgrade in functionality. Many thanks!
Is it possible to make this an optional setting?
i personally liked the older method better, though it's not a big deal :slightly_smiling_face:
Hi Jerrk, I'm sure that's possible, however if anything the old method should be optional, since users of this repo will expect the volume to behave like windows's volume.
To give an example: if your windows volume goes up from 2 to 4, it essentially doubles. Translating this into dB would mean roughly +6 dB. The logarithmic method takes care of this rigorously, while the old flat method doesn't. No single volume slider is implemented without this transformation, because it is not intuitive otherwise.
Of course, it still boils down to preference, so maybe Frosthaven has some time to implement it.
Hey friends! I'm not against having this as an option in the settings. I do think logarithmic is the most correct route to take for the base offering, but I can understand the desire to customize the experience, too. I'll try and take a look this weekend, but I'll be happy to review pull requests if someone beats me to it :)
@Jerrk Thanks for mentioning this, I really wasn't aware of it.
To preface this and to be completly honest, I don't know how Windows volume works and I also know zero about programming. But I really don't feel like logarithmic is better or colser to how Windows volume behaves, though from what I've seen online most if not all people who are programmers and know about this stuff way more than I do say logarithmic is the way to go, but I still feel linear is closer to how Windows volume behaves, though also linear is not a perfect 1:1 with Windows. I don't know maybe Windows volume is shit too and I've become used to it but to me it feels like the gold standard idk...
I think it would be a nice option if we can set whatever ratio we want.
I appreciate the added chime in on having a linear volume scaling option return. I was hoping to have that feature re-implemented a long time ago but my main job sort of took over.
I'll do what I can to push out an update this week - I do read these and appreciate the time spent in trying to make this software the best it can be :)
No worries, take your time And right back at ya, we appreciate the respond to the feedback and the work making this software better.
This has now been re-implemented in the latest version https://github.com/Frosthaven/voicemeeter-windows-volume/releases/tag/v1.7.4.0
An issue with the library (which i love btw), is the converison between volume (0-100) and dB, whose relationship is logarithmic. This problem essentially lies in the
convertVolumeToVoicemeeterGain
function. What is done here is simply a linear interpolation, but we need it to be logarithmic. The formula displayed here is the one we should be using. In our case, we already have theratio
, since this is just((new_win_vol - old_win_vol) / old_win_vol)
, so we need to solve for the difference in dB (a-b
). This results into our equationdiff_in_db = 20 * log_10 (ratio)
and just simply change voicemeeter's gain to:gain = gain + diff_in_db
.The library would be truly complete with the correct conversion.