Click or drag to resize
AudioCompressionManagerSplitStereo Method (IntPtr, Byte, IntPtr, Byte, Byte)
Splits stereo audio data array into two mono data arrays (left and right channels).

Namespace: Alvas.Audio
Assembly: Alvas.Audio (in Alvas.Audio.dll) Version: 2016.0.6173.41573
Syntax
public static void SplitStereo(
	IntPtr formatStereo,
	byte[] dataStereo,
	ref IntPtr formatMono,
	ref byte[] leftData,
	ref byte[] rightData
)

Parameters

formatStereo
Type: SystemIntPtr
input stereo audio format
dataStereo
Type: SystemByte
input stereo audio data
formatMono
Type: SystemIntPtr
output mono audio format
leftData
Type: SystemByte
output mono audio data for left channel
rightData
Type: SystemByte
output mono audio data for right channel
Examples
This example shows simple using of SplitStereo method.
string inFile = "stereo.wav";
string leftFile = "left.wav";
string rightFile = "right.wav";
WaveReader wr = new WaveReader(File.OpenRead(inFile));
IntPtr formatStereo = wr.ReadFormat();
byte[] dataStereo = wr.ReadData();
wr.Close();
IntPtr formatMono = IntPtr.Zero;
byte[] leftData = null;
byte[] rightData = null;
AudioCompressionManager.SplitStereo(formatStereo, dataStereo, ref formatMono, ref leftData, ref rightData);
byte[] headerMono = AudioCompressionManager.FormatBytes(formatMono);
WaveWriter wwLeft = new WaveWriter(File.Create(leftFile), headerMono);
wwLeft.WriteData(leftData);
wwLeft.Close();
WaveWriter wwRight = new WaveWriter(File.Create(rightFile), headerMono);
wwRight.WriteData(rightData);
wwRight.Close();
See Also