bevyengine / bevyengine/bevy

Audio Filters and Digital Signal Processors

Open
#5,833 12 comments 0 reactions 0 assignees View on GitHub
A-Audio C-Feature
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?

Imagine you are in a water level, but still above ground. The music plays normally.

Then you go underwater, thus the music becomes all muddied up.

Next, you jump out of the water, and the music returns to normal.

How do you implement that in Bevy?

- Godot has [audio buses](https://docs.godotengine.org/en/stable/tutorials/audio/audio_buses.html).
- Unreal Engine 5 has [MetaSounds](https://docs.unrealengine.com/5.0/en-US/audio-in-unreal-engine-5/).
- Unity has [audio effects](https://docs.unity3d.com/Manual/class-AudioEffectMixer.html).

## What solution would you like?

An `AudioFilter` trait, with a single method `filter(&mut self, input: &[Sample], output: &mut [Sample])`, where `Sample` is simply a type that implements `rodio::Sample`.

Boxed audio filters are stored in `Audio`, in order, and each can be toggled programmatically. These effects are global (unless #5832 is implemented, then it is local to each `AudioListener`).

## What alternative(s) have you considered?

Implement an audio filter using `Decodable` and pass the audio source to it. Similar to iterator combinators or fundsp's audio units combinators. Very unergonomic when manually implemented.

## Additional context

N/A

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.