-
Notifications
You must be signed in to change notification settings - Fork 444
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
logarithmic volume control for global soundtray / volume #3248
base: dev
Are you sure you want to change the base?
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.0316227766016838 there'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:
|
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.5
for 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.