Skip to content
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

Better volume control #714

Open
dvdsk opened this issue Mar 6, 2025 · 6 comments
Open

Better volume control #714

dvdsk opened this issue Mar 6, 2025 · 6 comments

Comments

@dvdsk
Copy link
Collaborator

dvdsk commented Mar 6, 2025

I noticed volume control in decibels in bevy. I think it would be great to adopt into rodio (with proper credit). It would augment the current amplify.

See: https://github.com/bevyengine/bevy/blob/ed7b366b24d7106f4715369eb3516875f915f536/crates/bevy_audio/src/volume.rs#L1

@roderickvd
Copy link
Collaborator

When at it, add a logarithmic mapping from [0.0; 1.0] over a range of 60 dB: https://www.dr-lex.be/info-stuff/volumecontrols.html

@roderickvd
Copy link
Collaborator

@dvdsk
Copy link
Collaborator Author

dvdsk commented Mar 6, 2025

No more than 10 lines: https://github.com/roderickvd/pleezer/blob/26599fcc63f97f54681e496ecb7fe8cd5dcb3214/src/player.rs#L1277

That is actually very nice! If you want to and have the time please contribute it.

@dvdsk
Copy link
Collaborator Author

dvdsk commented Mar 6, 2025

though I'm not sure in what form. I think we need to keep the current amplify. Maybe amplify_log? We should definitely point to it from the amplify docs since this is probably what users will want.

Ps, I'm off to bed now, have a great night! 🌙

@PetrGlad
Copy link
Collaborator

PetrGlad commented Mar 9, 2025

Maybe just add conversions for now? Using to_decibels() , to_linear(): amplify(to_linear(-1.2))?
By the way is 100% volume <-> 0.0dB in Bevy?

@roderickvd
Copy link
Collaborator

Maybe just add conversions for now? Using to_decibels() , to_linear(): amplify(to_linear(-1.2))?

I like it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants