Crates.io | audio-mixer |
lib.rs | audio-mixer |
version | 0.2.0 |
source | src |
created_at | 2019-12-27 20:54:57.546963 |
updated_at | 2024-04-24 13:36:49.901559 |
description | Mixing audio by the input and output channel layout |
homepage | |
repository | https://github.com/mozilla/audio-mixer |
max_upload_size | |
id | 192760 |
size | 84,600 |
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.
MPL-2