Table of Contents

Class AiffFileReader

Namespace
NAudio.Wave
Assembly
NAudio.Core.dll

A read-only stream of AIFF data based on an aiff file with an associated WaveFormat originally contributed to NAudio by Giawa

public class AiffFileReader : WaveStream, IDisposable, IAsyncDisposable, IWaveProvider
Inheritance
AiffFileReader
Implements
Inherited Members
Extension Methods

Constructors

AiffFileReader(Stream)

Creates an Aiff File Reader based on an input stream

public AiffFileReader(Stream inputStream)

Parameters

inputStream Stream

The input stream containing a AIF file including header

AiffFileReader(string)

Supports opening a AIF file

public AiffFileReader(string aiffFile)

Parameters

aiffFile string

Remarks

The AIF is of similar nastiness to the WAV format. This supports basic reading of uncompressed PCM AIF files, with 8, 16, 24 and 32 bit PCM data.

Properties

Length

public override long Length { get; }

Property Value

long

Position

Position in the AIFF file Position

public override long Position { get; set; }

Property Value

long

SampleCount

Number of Samples (if possible to calculate)

public long SampleCount { get; }

Property Value

long

WaveFormat

public override WaveFormat WaveFormat { get; }

Property Value

WaveFormat

Methods

Dispose(bool)

Cleans up the resources associated with this AiffFileReader

protected override void Dispose(bool disposing)

Parameters

disposing bool

Read(byte[], int, int)

Reads bytes from the AIFF File Read(byte[], int, int)

public override int Read(byte[] array, int offset, int count)

Parameters

array byte[]
offset int
count int

Returns

int

ReadAiffHeader(Stream, out WaveFormat, out long, out int, List<AiffChunk>)

Ensures valid AIFF header and then finds data offset.

public static void ReadAiffHeader(Stream stream, out WaveFormat format, out long dataChunkPosition, out int dataChunkLength, List<AiffFileReader.AiffChunk> chunks)

Parameters

stream Stream

The stream, positioned at the start of audio data

format WaveFormat

The format found

dataChunkPosition long

The position of the data chunk

dataChunkLength int

The length of the data chunk

chunks List<AiffFileReader.AiffChunk>

Additional chunks found