Skip to content

audio: flexible/surround sound #21640

@francisdb

Description

@francisdb

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 is used by all below rust audio libs and can handle 7.1 channels.
Rodio has no surround sound for now: RustAudio/rodio#366
Kira also has no surround sound support.
Bevy Seedling has spatial audio but that's more about rendering 3d sound to stereo. Uses 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-AudioSounds playback and modificationC-FeatureA new feature, making something new possibleS-Needs-DesignThis issue requires design work to think about how it would best be accomplished

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions