Click or drag to resize
AudioCompressionManagerConvert Method (IntPtr, IntPtr, Byte, Boolean)
Converts the audio data from the specified old format to the new format.

Namespace: Alvas.Audio
Assembly: Alvas.Audio (in Alvas.Audio.dll) Version: 2016.0.6173.41573
Syntax
public static byte[] Convert(
	IntPtr oldFormat,
	IntPtr newFormat,
	byte[] data,
	bool fastConversion
)

Parameters

oldFormat
Type: SystemIntPtr
Old audio format.
newFormat
Type: SystemIntPtr
New audio format. Use ChooseCompatibleFormat(IntPtr, IntPtr) or GetCompatibleFormatList(IntPtr) or GetCompatibleFormat(IntPtr, Int16) for search compatible format
data
Type: SystemByte
The audio data.
fastConversion
Type: SystemBoolean
true if the conversion is fast; otherwise, the conversion is high-quality.

Return Value

Type: Byte
Returns the audio data in the new format.
Examples
This example shows simple using of Convert method.
Mp3Reader mr = new Mp3Reader(File.OpenRead("in.mp3"));
IntPtr formatMp3 = mr.ReadFormat();
byte[] dataMp3 = mr.ReadData();
mr.Close();
IntPtr formatPcm = AudioCompressionManager.GetCompatibleFormat(formatMp3,
    AudioCompressionManager.PcmFormatTag);
byte[] dataPcm = AudioCompressionManager.Convert(formatMp3, formatPcm, dataMp3, false);
WaveWriter ww = new WaveWriter(File.Create("out.wav"),
    AudioCompressionManager.FormatBytes(formatPcm));
ww.WriteData(dataPcm);
ww.Close();
See Also