Table of Contents

Class ChannelMixMatrix

Namespace
NAudio.Wave.SampleProviders
Assembly
NAudio.Core.dll

Defines common channel mixing matrices for use with ChannelMixerSampleProvider.

public static class ChannelMixMatrix
Inheritance
ChannelMixMatrix
Inherited Members

Remarks

Each matrix has one row per input channel and one column per output channel. The values returned are fresh copies, so callers may mutate them without affecting other callers.

Properties

MonoToStereo

Converts a mono source to a 2-channel source by copying the input to both outputs.

public static float[,] MonoToStereo { get; }

Property Value

float[,]

StereoLeft

Modifies a 2-channel stream by selecting only the first channel. The output is 2-channel.

public static float[,] StereoLeft { get; }

Property Value

float[,]

StereoRight

Modifies a 2-channel stream by selecting only the second channel. The output is 2-channel.

public static float[,] StereoRight { get; }

Property Value

float[,]

StereoTo5_1

Converts a 2-channel source to a canonical 5.1 output. The output has 6 channels: FrontLeft, FrontRight, Center, Sub, RearLeft, RearRight, in that order.

public static float[,] StereoTo5_1 { get; }

Property Value

float[,]

Remarks

The matrix is designed so that the aggregate output volume from the 6-channel output is the same output volume that would've occurred if the original input was applied to two channels; if the original audio would've produced 200W of output spread across 2 speakers, the transformed output would also produce 200W of output, instead spread across 6 speakers.

This can be noted by the fact that no column in the matrix sums to 1.0. The loudest channel is the center channel, receiving a sum of 0.444 of its inputs (0.222 from left, 0.222 from right).

If you would like a matrix that maximizes output volume, scale the matrix by a factor of 2.25. One might do this to preserve entropy during processing, with a final gain reduction step at the output to maintain intended power output.

StereoToMono

Converts a 2-channel source to a mono source by mixing the channels together using equal weight.

public static float[,] StereoToMono { get; }

Property Value

float[,]