Keith Boynton

Keith Boynton

  • NA
  • 1
  • 1.9k

Converting .wav files to .aiff

Nov 11 2012 3:42 PM
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)