Search guides and the APICtrl K
  1. API reference
  2. DSP

channel_matrix.h

Mixing between channel layouts.

#include <sonore/channel_matrix.h>
On this page

Design notes

A plugin that accepts 5.1 and is asked for stereo has to fold six channels into two, and the coefficients are not a matter of taste: ITU-R BS.775 says centre and surrounds come in at -3 dB, and a downmix that ignores it is either centre-heavy or centre-shy on every film stem it touches.

The usual shape for this is a generic matrix that leaves the coefficients to the caller. We can do better, because ProcessContext already carries what each channel MEANS: given the roles on both sides, the matrix derives itself, and the one thing nobody remembers (that LFE must not be folded into full-range channels) is handled rather than left as a footnote.

Types 1

An N-in, M-out mixing matrix.

Small and fixed-size: a channel count is bounded by kMaxAudioChannels, so this never allocates and can be built in prepare() or rebuilt whenever a layout changes.

↑↓ to move↵ to openEvery public name in the headers, and every guide