Table of Contents

Class WaveChunks

Namespace
NAudio.Wave
Assembly
NAudio.Core.dll

A read-only view of the non-essential RIFF chunks found in a WAV file (everything except the fmt and data chunks, which are handled directly by WaveFileReader).

Chunk metadata (id, length, stream position) is materialised when the file is opened; chunk contents are read lazily via GetData(RiffChunk) or an IWaveChunkInterpreter<T>.

public sealed class WaveChunks : IReadOnlyList<RiffChunk>, IReadOnlyCollection<RiffChunk>, IEnumerable<RiffChunk>, IEnumerable
Inheritance
WaveChunks
Implements
Inherited Members
Extension Methods

Properties

Count

Number of chunks.

public int Count { get; }

Property Value

int

this[int]

Gets the chunk metadata at the given index.

public RiffChunk this[int index] { get; }

Parameters

index int

Property Value

RiffChunk

Methods

Contains(string)

Returns true if a chunk with the given four-character identifier is present. Comparison is case-insensitive (RIFF treats LIST and list as the same chunk).

public bool Contains(string chunkId)

Parameters

chunkId string

Returns

bool

Find(string)

Returns the first chunk matching the given four-character identifier, or null if none is present. Comparison is case-insensitive.

public RiffChunk Find(string chunkId)

Parameters

chunkId string

Returns

RiffChunk

FindAll(string)

Returns every chunk matching the given four-character identifier. Comparison is case-insensitive.

public IEnumerable<RiffChunk> FindAll(string chunkId)

Parameters

chunkId string

Returns

IEnumerable<RiffChunk>

GetData(RiffChunk)

Reads the raw bytes for the given chunk from the underlying stream. The stream position is preserved across the call.

public byte[] GetData(RiffChunk chunk)

Parameters

chunk RiffChunk

Returns

byte[]

GetEnumerator()

Returns an enumerator that iterates through the collection.

public IEnumerator<RiffChunk> GetEnumerator()

Returns

IEnumerator<RiffChunk>

An enumerator that can be used to iterate through the collection.

Read<T>(IWaveChunkInterpreter<T>)

Runs the given interpreter over this chunk collection. Returns default if the interpreter's required chunks are not present.

public T Read<T>(IWaveChunkInterpreter<T> interpreter)

Parameters

interpreter IWaveChunkInterpreter<T>

Returns

T

Type Parameters

T