2
Answers

Converting .wav files to .aiff

Keith Boynton

Keith Boynton

11y
1.5k
1
I'm trying to write a class that will convert .wav files to .aiff files as part of a project.
I've come across this library Alvas.Audio (http://alvas.net/alvas.audio,overview.aspx)

and am wondering if anyone has any experience with it as I'm really struggling to work out how to write the file in aiff format.
I have the following code so far but I can't work out how to define the outfile as a aiff:

string inFile = textBox1.Text;
WaveReader mr = new WaveReader(File.OpenRead(inFile));
IntPtr mrFormat = mr.ReadFormat();
IntPtr wwFormat = AudioCompressionManager.GetCompatibleFormat(mrFormat, AudioCompressionManager.PcmFormatTag);
string outFile = inFile + ".aif";
WaveWriter ww = new WaveWriter(File.Create(outFile), AudioCompressionManager.FormatBytes(wwFormat));
AudioCompressionManager.Convert(mr, ww, false);
mr.Close();
ww.Close();


Any help would be greatfully accepted :)




Answers (2)