-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Clarify what happens when setting the audio volume #9480
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that the suggestion will give nicer formatting, but otherwise this LGTM.
Example |
Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
Example |
I think I don't agree with the comment. The video is audio at 1.0, then 0.01, then 1.0. for me it's much less than half the volume. audio-controls.mp4 |
That would be a quarter, based on the comment, but that's still perceived as much less than that to me. |
Sound is doubled with every 3dB, so to get half the sound you would need -3dB, or a power of 10^-3/10 ~= 0.5. If we take the square root of 0.5 you get 0.708 which is what you would need to set the volume to in order to halve the sound from the original 1.0 setting. Multiply the volume by 0.708 to halve the sound again etc. See table below: To make things more complicated: This means you would have to set the volume to 0.316 to perceive it half as loud as 1.0. These numbers seem to check out when I try it on the example, as well as the change in dB levels when I check with OBS. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with the documentation, but I am wondering if we should have it accept something like
enum Volume {
Logarithmic(f32),
Linear(u8), // 255 is the 100%, 128 is 50% of the volume, etc.
}
instead of just f32
.
Co-authored-by: GitGhillie <jillisnoordhoek@gmail.com>
Co-authored-by: François <mockersf@gmail.com>
# Objective - Fixes [bevyengine#8835](bevyengine#8835) ## Solution - Added a note to the `set_volume` docstring which explains how volume is interpreted. --------- Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com> Co-authored-by: GitGhillie <jillisnoordhoek@gmail.com> Co-authored-by: François <mockersf@gmail.com>
Objective
Solution
set_volume
docstring which explains how volume is interpreted.