Personal tools
Namespaces
Variants
Actions
Navigation
Projects
Toolbox

Mixing

From AC3Filter
Revision as of 14:23, 8 February 2014 by Valex (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

This articles shows how automatic matrix mixing routes channels.

Contents

Introduction

Mixing occurs with help of matrix mixer. Output sample is formed with matrix multiplication:

O = M \cdot I

Where

This simple form allows to gain channel independently, route any channel to any other and do custom channel mixing. The main task is to find the matrix M. This article shows how the default matrix calculation works.

Matrix calculation involves several steps:

Notations

Values used in this article:

Channels:

Channel routing

All-in-one diagram

Mixing routes

Here you can see the whole routing picture.

Routing occurs only when the output speaker layout does not have some of the input channels. The purpose fo routing is to preserve these channels by mixing it into existing ones.

Note, that the center channel also acts as mono channel, and thus every channel has a route to the center.

Left and right speakers are 'main' speakers because they present at all speaker configurations (except mono). All other speakers have routes to main channels too.

Voice and surround levels are always applied to appropriate channels. When mixing, levels are applied before mixing, acting as mixing levels.

Center channel

Mixing of the center channel

Center channel has 2 routes:

In both cases one channel goes into two, so -3db gain is applied to preserve the resulting loudness.

Also Voice level is always applied to the center, so the resulting equations are:

\\
L' = C_L' = L + g_c \cdot 1/\sqrt{2} \cdot C\\
R' = C_R' = R + g_c \cdot 1/\sqrt{2} \cdot C

where g_c is the Voice level.

Main channels

Mixing of main channels

The only route for main channels is to the mono channel.

Side of center

Mixing of side of center

When 3 front channels present (1st route), each of side of center channels goes to the center and a main channel. This creates 'virtual' side of center channels placed in between of main and center channels. To preserve loudness -3db gain is applied:

\\
L' = L + 1/\sqrt{2} \cdot C_L\\
C' = g_c \cdot C + 1/\sqrt{2} \cdot C_L + 1/\sqrt{2} \cdot C_R\\
R' = R + 1/\sqrt{2} \cdot C_R

where g_c is the Voice level that is always applied to the center (but not to side of the center cahnnels).

Without the center channel (2nd route) side of center channels are divied as follows: 3/4 of power goes to the near main channel and 1/4 of power goes to the far channel:

\\
L' = L + \sqrt{3}/2 \cdot C_L + 1/2 \cdot C_R\\
R' = R + 1/2 \cdot C_L + \sqrt{3}/2 \cdot C_R

This also creates 'virtual' side of center channels.

In mono output mode (3rd route), everything goes to the center.

Side channels

Mixing of side channels

Routes for side channels:

  1. Speaker layouts with side and back channels are often confused and thus in presence of back chanenls side channels go there.
  2. If back center channel presents, side channels go there to preserve surroung effect.
  3. Main channels if output is stereo.
  4. Center channel if output is mono.

Surround level is always applied to all surround channels.

Back channels

Mixing of back channels

Routes for back channels:

  1. Speaker layouts with side and back channels are often confused and thus in presence of side chanenls back channels go there.
  2. If back center channel presents, back channels go there to preserve surroung effect.
  3. Main channels if output is stereo.
  4. Center channel if output is mono.

Surround level is always applied to all surround channels.

Back center

Mixing of back center

Routing of the back cemter is very simple. It goes to either:

  1. Back channels
  2. Side channels
  3. Main channels
  4. Center channel

In most cases one channel goes into two, so -3db gain is applied to preserve the resulting loudness (excluding mono mixing mode). Also, Surround level is always applied to all surround channels.

Subwoofer

LFE channel is mixed either to the subwoofer or main channels. LFE level is applied before mixing. This level is intended to specify the level of LFE channel in respect to main channels. But this problem is not so simple.

Quote from Dolby's paper:

The signal in the LFE channel is calibrated during soundtrack production to be able to contribute 10 dB higher SPL than the same bass signal from any one of the screen (front) channels.

This means that the sound coming from LFE level should be produced 10dB louder than sound from other channels. But by applying +10dB gain we loose 10db of dynamic range. It is not too bad, but the more correct way is to tune the subwofer itself. Many audio systems have an independent volume for the subwoofer, so you may set it to +10dB and leave LFE level at zero level.

Voice control

There's no center channel in stereo mode and thus we cannot control voice coming from the center directly. But it's still possible to do.

Stereo may be represented as a sum of in-phase and out-of-phase components:

\\
L' = 1/2 \cdot (L + R) + 1/2 \cdot (L - R)\\
R' = 1/2 \cdot (L + R) + 1/2 \cdot (R - L)

So we can gain this components separately. When Voice control option is on, Voice level controls the gain for in-phase component (perceived as coming from the center):

\\
L' = g_c \cdot 1/2 \cdot (L + R) + 1/2 \cdot (L - R)\\
R' = g_c \cdot 1/2 \cdot (L + R) + 1/2 \cdot (R - L)

Where g_c is Voice level.

Note, that decreasing of Voice level may lead to distorted sound because audio codec (especially at low bitrates) may encode the channel difference with much lower quality.

Expand stereo

Expand stereo routes

Expand stereo option allows to fill channels absent at input. I.e. does upmixing.

Upmixing to surround channels happens only when input has no surround channels at all.

New channels are made of main channels. Center channel receives in-phase component of main channels (sum of left and right), surround channels receive out-of-phase (difference of left and right). Voice and surround levels are applied to appropriate channels after exapnding.

\\
C' = g_c \cdot 1/\sqrt{2} \cdot (L + R)\\
S_L' = B_L' = g_s \cdot 1/2 \cdot (L - R)\\
S_R' = B_R' = g_s \cdot 1/2 \cdot (R - L)\\
B_C' = g_s \cdot 1/2 \cdot (L - R)\\

Where g_c is Voice level and g_s is Surround level.

Note, that sometimes surround may receive distorted sound, because audio codec (especially at low bitrates) may encode the channel difference with much lower quality.

Normalization

Per-channel gains

See also