-
-
Notifications
You must be signed in to change notification settings - Fork 25
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
Add spatial audio effects #634
Conversation
Just adding some justification for using Kira. Bevy's built-in audio engine is very restricted. As it's based on Rodio, it only allows simple physically-based sound with little control. Kira seems to be the most popular alternative sound backend for Bevy, and enables very fine control over many aspects of sounds, including total control over volume and panning, which I think comes in very handy in a game such as this. |
Also idk why but I can't seem to get rid of |
I am in the middle of migration to Bevy 0.11 (#636). I hope to finish the migration during the weekend. Let's see what lands first. |
Replace `bevy_audio` with `bevy_kira_audio`. Sounds are unedited/derived from CC0 sounds from FreeSound.org. Works towards DigitalExtinction#394, although many vital effects are still missing.
1, 2, 3, 4 => No distance attenuation; Linear from camera focus; InvSqr from camera; InvSqr from focus 8, 9, 0 => No view occlusion; Only play sounds in view; Occlude sounds based on angle
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.
Wow, the keybindings made it super easy to test! ❤️
I would use Attenuation::InverseSquare + Occlusion::Angle. IMHO it is good enough for merge. We can improve that later.
Ideas for further improvements in follow up PRs / experiments:
- make the angle sensitivity dependent on camera frustum angles, on wide monitors the fall off slope should be steeper vertically,
- compute the the angle from camera location (not moved backward) and make the angle fall-off non-linear (almost constant close to 0 and steep just behind camera frustum)
- use some kind of dynamic range compression so that everything closer than a threshold is not at the same volume.
PR itself is complete -> de-draftified, can port to 0.11 as well |
I'm aware of an upcoming upgrade to Bevy 0.11 and if this PR is delayed, I'm willing to migrate it if needed.
Replace
bevy_audio
withbevy_kira_audio
.Sounds are unedited/derived from CC0 sounds from FreeSound.org.
Works towards #394, although many vital effects are still missing.
List of sounds:
Sounds that aren't included but I've seen listed include units firing and UI sounds.
Attenuation is not great, but perhaps fine for now. imo, the dream would be for sounds to be loudest when they are close to the focal area of the view, and become quieter when they leave the screen/go far away.