audio: flexible/surround sound
- Dominant language
- Rust
- Stars
- 48.2k
- Forks
- 4.8k
- Avg merge
- 3d 22h
- Merged PRs (30d)
- 161
Description
## What problem does this solve or what need does it fill?
Bevy currently only supports 2.0 sound.
My use case is very specific but should give an example of a complex setup.
I want to create a virtual pinball game. My virtual pinball cabinet has 2 sound systems connected to a single 7.1 sound card.
A typical virtual pinball cabinet has the following setup:
* 2 backglass speakers + sub are connected to the front left/right channels forming a 2.1 system. These are used for general sound / music.
* 4 exciters ( + optionally even a bass shaker) mounted on the cabinet that simulate pinball hardware sounds/vibrations, connected to the mid and back channels forming a 4.0 system.
Some more context: http://mjrnet.org/pinscape/BuildGuideV2/BuildGuide.php?sid=audio
_An other example is a racing sim where you drive by a sound source and sound moves from front to back including doppler effect. Further there is an exciter under the racing sim rig seat that should produce specific car vibration sounds._
## What solution would you like?
1. Bevy supports basic spatial surround audio
2. A user can map sounds to specific 'sound environments'.
3. Environments can be set up using specific channels in `7.1`, `5.1`, `4.1`,`4.0`, `2.1` or `2.0` mode.
## What alternative(s) have you considered?
[cpal](https://github.com/RustAudio/cpal) is used by all below rust audio libs and can handle 7.1 channels.
[Rodio](https://github.com/RustAudio/rodio) has no surround sound for now: https://github.com/RustAudio/rodio/issues/366
[Kira](https://github.com/tesselode/kira) also has no surround sound support.
[Bevy Seedling](https://github.com/CorvusPrudens/bevy_seedling) has spatial audio but that's more about rendering 3d sound to stereo. Uses [Firewheel](https://github.com/BillyDM/Firewheel).
## Additional context
* creating a proper surround sound system is not as easy as easy as positioning sounds. For moving objects you might for example want to simulate the doppler effect.
* SDL allows setting this up. One example is
https://github.com/superhac/vpinball/blob/master/src/audio/SoundPlayer.cpp
* Some cabinets even use 2 distinct sound cards. One set in 2.1 and one in 4.1. But that would be a further extension where multiple sound outputs are supported.
Contributor guide
Assessment
This issue has not been assessed yet.