This project has moved. For the latest updates, please go here.

I hope Naudio can let me to open the Aiff files too

Apr 16, 2011 at 5:29 AM

Aiff is just an uncompressed PCM files just like wav file, except the aiff-C

And I'm waiting for your WDM/KS out API too

Coordinator
Apr 16, 2011 at 7:19 AM

Maybe we will add AIFF reading at some point. I think the byte order is different.

As for WDM/KS, I really wanted to do that a while back, but could find no good documentation to point me in the right direction. Development effort is more likely to focus on WASAPI and ASIO in the future.

Mark

Apr 23, 2011 at 8:31 AM
Edited Apr 23, 2011 at 8:47 AM

Hi Parco and Mark,

I just happened to make an AiffFileReader class today, which is compatible with NAudio.  You can use the source code however you'd like (you can adopt into NAudio if you'd like).  It's very similar to WaveFileReader, but with some nasty endian swapping and a crazy IEEE 80-bit extended precision number.  It can only read uncompressed PCM data at 16-bit, 24-bit and 32-bit.  Perhaps I'll add support for other formats in the future.

http://www.giawa.com/tutorials/src/AiffFileReader.cs

Cheers

Edit:  You can use it just like the WaveFileReader too.  Might as well give an example:

 

OpenFileDialog open = new OpenFileDialog();
open.Filter = "AIFF File (*.aif)|*.aif;";
if (open.ShowDialog() != DialogResult.OK) return;

WaveChannel32 wave = new WaveChannel32(new AiffFileReader(open.FileName));

DirectSoundOut waveOut = new DirectSoundOut();
waveOut.Init(wave);
waveOut.Play();
Coordinator
Apr 23, 2011 at 9:46 AM

wow, thanks. I'd love to include this in NAudio. AIFF support has been on the TODO list for a very long time

Mark

Apr 23, 2011 at 10:47 AM

giawa,

But how about the AiffC?

Apr 23, 2011 at 6:06 PM
Edited Apr 23, 2011 at 6:40 PM

Hi Parco,

Are you actually wanting to decompress the data in an aifc file?  or are you only looking to a read an aifc file that has 'NONE' compression (ie - uncompressed PCM data, but in an AIFC container)?

Unfortunately I don't know much about compression, but if it's just raw PCM data in a different file header then it should be easy enough.  You can probably just make the following edit (untested):

Line 148:  Change "AIFF" to "AIFC"

Giawa

Edit:  Check out the latest version of http://www.giawa.com/tutorials/src/AiffFileReader.cs

  1. Added support for AIFC form type
  2. Can read compression type in COMM chunk (throws FormatException if compression type != "none")
  3. Added support for 8-bit aiff (sounds terrible!)
  4. Fixed a possible problem with the alignment of chunks (chunk length must always be %2, even if the chunk header says otherwise)
Coordinator
Oct 5, 2012 at 9:47 PM

thanks for this Giawa, your updated version is now in the NAudio source code