-
Notifications
You must be signed in to change notification settings - Fork 485
Customizable volume curve #3248
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
THANK YOU. i KNEW something was up with the volume scale in the soundtray!!! |
|
Could linearToLog and logToLinear maybe go in FlxMath instead of are they probably not going to get used |
I'm pretty sure this is just for DB purposes. If they were to go in FlxMath, they'd probably need more descriptive names. |
Fair enough! |
|
Do we have any examples of how other systems handle volume? I'm looking at wikipedia and I see that 10db is 10x the power 0db, and 20db is 100x, but do people expect that behavior with volume controls?
Can we talk specifically about a 1db sound played at certain volume levels? What currently happens and what happens with this change. the above sentence confuses me because you only talk about decibels, not volume levels, and -10db is 10x quieter than 0db so I'm not sure what point you're trying to make. Also, I think this implementation is flawed, for a few reasons. Consider the following: FlxG.sound.volume = 0;
FlxG.sound.changeVolume(0.5);
assert(FlxG.sound.volume == 0.5);// FAIL - volume is 0.0316227766016838there's inconsistent behavior, now, between setting volume directly and changing the volume relatively. If I'm smelling what you're stepping in, it sounds like, currently, a volume of 0.5 will play a 1db sound at 0.5db, which is not half the "power" and with this change, a volume of 0.5 will be half the power which is actually like -3db? If I'm right, I still think we shouldn't change the value of volume to be non-linear, even under the hood, if anything we should have some Perhaps here? |
|
found this |
if this is a breaking issue, maybe fully change how flxsound volume works as a breaking change in a major version update instead? the current linear scale is really annyoing (you have to change master volume SUPER low for it to be decently low) but inconsistencies like this arent great either. |
|
it might be a breaking change, but I figured we could could add a compile flag FLX_LOG_VOLUME and FLX_LINEAR_VOLUME, or even just have a global |
|
what are thoughts on a variable like So |
on the first point:
either that or give me some kind of description of the experience you're currently having with sound and what you think should happen, like: "i think .5 volume is too loud, it seems more than half as loud as 1.0" For the second point, I still say the conversion should not be done in Lastly, I tried out this branch, I honestly believe 0.5 is now far too quiet with this curve, most sounds I tried seem too quiet to hear at 0.3 volume or less. I graphed the curve of linearToLog and it looks like this:
The opposite of the curve that I see used elsewhere:
What makes intuitive sense to me, is that flixel volume curve should match our PCs' volume curves, so I'm going to record sounds with various speaker volumes and compare the db to playing a sound in flixel at various volume levels |
|
this post has good lil writeup about volume control, the interactive demo is particularly helpful https://www.dr-lex.be/info-stuff/volumecontrols.html also random testing of volume controls, i believe at the very least both:
|
|
I'm taking all non-breaking changes off 6.0.0, but I promise i'll get to this on the next release |
|
untested, for now, but this should account for group volume, sound tray volume, fade volume and individual sound volume. Also, before i didn't like that it transformed the public volume to something different than what it was explicitly set to |
|
I'll be honest, I still don't get this logarithmic sound curve. I messed with a few apps and yeah, it seems like spotify and mac use logarithmic, but youtube doesn't. In my tests, I fucking hate the log ones and completely disagree with that article's assessments (assuming this follows that). For example
Using your log curve vs the old linear curve made no difference in whether I could distinguish a difference in volume, every increment sounded distinct, but lower volumes sounded far, far less distinct using the log curve, where linear, to me, seemed like each increment was as distinct as the others.
IMO the left side of the slider is useless in logarithmic, my spotify has never gone below 50% and in the example given in the article I can't hear the sound until I'm at 50% despite my system volume being at max. The linear slider in the example does seem to have little effect on the right half, but this is not my expereince with the flixel sound tray. Where .8 seems "loud" .9 seems "too loud" and 1.0 seems "way too fucking loud" in my opinion. This makes me wonder if openfl uses some underlying non-linear curve, already. I only tested this on html5, btw I assume all target behave the same, but that has been a bad assumption, in the past Maybe this is just a personal preference, So I made it easy to customize the global sound curve, but I'm keeping the default as it was Lastly:
This isn't how any of the examples work and I don't understand why setting the sound to 0.5 should sound differently to incrementing the sound to the halfway mark |
|
I'm down to revisit this, later. I still feel like there's something I'm not grasping. but hopefully this lets everyone do what they want, for now |




the global volume math is linear, however actual sound and dB stuff is NOT linear.
-10dB is NOT 10x quieter than -1dB for example
This PR changes specifically the GLOBAL volume control when using the soundtray. Changing via
FlxG.sound.volume = 0.5for example would scale it linearly as normal, however pressing the + and - keys will properly change the volume logarithmically to sound more "proper". Pressing - until it's about halfway will actually sound like the volume is set to half.