-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Spatial Audio Functional Regression - different spatial scaling factor for each object #10414
Comments
"Spatial Scale" in Bevy 0.11 was also "global" -- it affects the position of the ears as well. At least how it was implemented in the examples. I think another potential workaround would be adding a system that multiplies your emitter Affecting a particular audio source's distance attenuation seems useful. I'd like to see examples of how other game engine audio APIs work for this use-case. Would a minimum and maximum attenuation distance be more useful? I'm not sure how much fancier we could get without ditching |
Godot has the following on its emitters:
And no configuration for the listener, only position. There can only be one active listener. |
Yes, what I did was scale the sink around the listener:
I'll take a look, thanks!
Godot
Unity
Unreal
I guess there are 2 separate discussions:
|
Agreed, thanks for doing that roundup. (and for the excellent issue writeup). On the first bullet point, I know that scale is obviously feasible but I'm guessing that other attenuation options might not be doable with Just need to determine whether or not there's an acceptable workaround now. |
# Objective Fixes #10414. That issue and its comments do a great job of laying out the case for this. ## Solution Added an optional `spatial_scale` field to `PlaybackSettings`, which overrides the default value set on `AudioPlugin`. ## Changelog - `AudioPlugin::spatial_scale` has been renamed to `default_spatial_scale`. - `SpatialScale` is no longer a resource and is wrapped by `DefaultSpatialScale`. - Added an optional `spatial_scale` to `PlaybackSettings`. ## Migration Guide `AudioPlugin::spatial_scale` has been renamed to `default_spatial_scale` and the default spatial scale can now be overridden on individual audio sources with `PlaybackSettings::spatial_scale`. If you were modifying or reading `SpatialScale` at run time, use `DefaultSpatialScale` instead. ```rust // before app.add_plugins(DefaultPlugins.set(AudioPlugin { spatial_scale: SpatialScale::new(AUDIO_SCALE), ..default() })); // after app.add_plugins(DefaultPlugins.set(AudioPlugin { default_spatial_scale: SpatialScale::new(AUDIO_SCALE), ..default() })); ```
# Objective Fixes bevyengine#10414. That issue and its comments do a great job of laying out the case for this. ## Solution Added an optional `spatial_scale` field to `PlaybackSettings`, which overrides the default value set on `AudioPlugin`. ## Changelog - `AudioPlugin::spatial_scale` has been renamed to `default_spatial_scale`. - `SpatialScale` is no longer a resource and is wrapped by `DefaultSpatialScale`. - Added an optional `spatial_scale` to `PlaybackSettings`. ## Migration Guide `AudioPlugin::spatial_scale` has been renamed to `default_spatial_scale` and the default spatial scale can now be overridden on individual audio sources with `PlaybackSettings::spatial_scale`. If you were modifying or reading `SpatialScale` at run time, use `DefaultSpatialScale` instead. ```rust // before app.add_plugins(DefaultPlugins.set(AudioPlugin { spatial_scale: SpatialScale::new(AUDIO_SCALE), ..default() })); // after app.add_plugins(DefaultPlugins.set(AudioPlugin { default_spatial_scale: SpatialScale::new(AUDIO_SCALE), ..default() })); ```
What problem does this solve or what need does it fill?
I want to scale spatial audio differently for each effect. This is so I can have some "far away" effects (low volume, low distance scaling) mixed together with some "close up" effects (high volume, high distance scaling).
For example, explosions - when they happen far away, https://freesound.org/people/rhapsodize/sounds/255111/
When they happen close up, https://freesound.org/people/juskiddink/sounds/108641/
Both effects need to live at the same time with different spatial scales, because the camera can quickly move closer/further away from the audio source.
I would also want this to work on multiple listeners at the same time: one main camera for 80% volume, and a few extra cameras for 20% volume each.
This was trivial under Bevy 0.11 (in the old update positions system), but now is impossible with bevy_audio 0.12:
But the
AudioPlugin
is a global, so all objects must share the same spatial scale.What solution would you like?
Extra field
spatial scale
for each Spatial Audio SourceWhat alternative(s) have you considered?
RelativeVolume
component based on distance and some formulaThe text was updated successfully, but these errors were encountered: