The OpenD Programming Language

WavReader

After construction, the parameters are set and you can set them. After that, you process the samples range-style.

It ignores chunks in the file that aren't the basic standard. It throws exceptions if it isn't a bare-basic PCM wav file.

See wavReader for the convenience constructors.

Note that if you are reading a 16 bit file (bitsPerSample == 16), you'll actually need to cast(short[]) front.

auto reader = wavReader(data[]);
foreach(chunk; reader)
	play(chunk);
struct WavReader (
Range
) {
const
ushort numberOfChannels;
const
int sampleRate;
const
ushort bitsPerSample;
int dataLength;
float duration;
}

Meta