LoredCast / soundboard

Simple Soundboard
GNU General Public License v3.0
89 stars 9 forks source link

[Request] Turn volume slider from linear to logarithmic #14

Closed Kuroonehalf closed 2 years ago

Kuroonehalf commented 2 years ago

I hope this is a feasible request. It's not something I've done on a project personally so I don't know, but this is an extremely common problem with volume sliders that you find in pretty much every website on the internet and most games. Human hearing does not follow a linear distribution, and the result of having volume be linear means the sound will be heavily skewed toward the loud side. The very first value after 0 you would expect to be an almost imperceptible volume, but with a linear scale it is already very loud, and it makes it hard to adjust volume at lower levels - which is the problem I'm having with soundboard right now. And volumes past 50% sound virtually all the same. The solution is to change it to a logarithmic scale.

Here's some responses I found that I think might be useful in implementing this: https://ux.stackexchange.com/a/116300 https://www.reddit.com/r/programming/comments/9n2y0/stop_making_linear_volume_controls/c0dgsjj/

LoredCast commented 2 years ago

I get where you're coming from but I'm questioning the significance of such a change, also because many users are used to the linear scale in perception controls (e.g. backlight aswell). All my volume sliders I have and especially the physical ones where there is in fact a linear potentiometer built in work that way. Maybe increasing the descrete steps/making it continuous is more intuitiv. Don't get me wrong I like the idea, it's really not too hard to change scales, will think about it.

Kuroonehalf commented 2 years ago

They're used to it because they have no other option, but I doubt anyone actually likes it. It just doesn't function like how we perceive sound, and it's a constant hassle for headphone users.

LoredCast commented 2 years ago

Did some looking around and took the approach of a semi-physical logarithmic scale in 0.2.4. It's still base 10 logarithmic like bel units but I did some tweaking to fit it into 0...1 volume space for HTML Audio and to avoid a (way) too small step size with smaller volumes (although technically more accurate).