An audio mixer in Rust, used in Firefox browser
Перейти к файлу
Paul Adenot 29b5b45ee7
Merge pull request #16 from mozilla/discrete-channels-fix
Handling mixing with discrete channel hardware
2024-04-22 15:15:36 +02:00
.circleci Add circle-ci settings (#9) 2021-03-07 23:11:14 -08:00
.github/workflows Add a GitHub-Actions setting (#11) 2021-03-10 16:16:00 -08:00
benches Create mixer by &[Channel] instead of Vec<Channel> 2020-01-06 09:14:18 -08:00
src Fix logic error, add a test 2024-04-22 15:12:15 +02:00
.gitignore Audio Mixer in Rust 2019-12-26 13:02:41 -08:00
Cargo.toml 0.2 2024-04-22 15:12:15 +02:00
LICENSE Add MPL-2 licence 2023-04-23 10:00:13 -07:00
README.md Add a GitHub-Actions setting (#11) 2021-03-10 16:16:00 -08:00
install_rustfmt_clippy.sh Revise test settings (#5) 2020-03-02 09:56:31 -08:00
run_sanitizers.sh Add a GitHub-Actions setting (#11) 2021-03-10 16:16:00 -08:00
run_tests.sh Add a GitHub-Actions setting (#11) 2021-03-10 16:16:00 -08:00

README.md

Audio Mixer

CircleCI Build & Test

Mixing audio data from any input channel layout to any output channel layout, in a matrix-multiplication form.

output channel #1 ▸ │ Silence    │   │ 0, 0, 0, 0 │   │ FrontRight   │ ◂ input channel #1
output channel #2 ▸ │ FrontRight │ = │ R, C, 0, F │ x │ FrontCenter  │ ◂ input channel #2
output channel #3 ▸ │ FrontLeft  │   │ 0, C, L, F │   │ FrontLeft    │ ◂ input channel #3
                          ▴                 ▴         │ LowFrequency │ ◂ input channel #4
                          ┊                 ┊                ▴
                          ┊                 ┊                ┊
                      out_audio      mixing matrix m       in_audio

For example, the above means there are 3 output channels and 4 input channels. The order of output channels is Silence, FrontRight, and FrontLeft. The order of input channels is FrontRight, FrontCenter, FrontLeft, LowFrequency.

So the output data in the channel #2 will be:


Output data of ch #2 (FrontRight) =
    R x input channel #1 (FrontRight)   +
    C x input channel #2 (FrontCenter)  +
    0 x input channel #3 (FrontLeft)    +
    F x input channel #4 (LowFrequency)

where the C, F, L, R are mixing coefficients. The Silence channel is a unused channel in the output device, so its channel data will always be zero.

License

MPL-2