ByteNoise

Wave format

Note: this information may be wrong! Use it at your own risk.

A .wav file header looks like this in hexadecimal:

52 49 46 46 ?? ?? ?? ?? 57 41 56 45 66 6d 74 20
10 00 00 00 01 00 02 00 44 ac 00 00 10 b1 02 00
04 00 10 00 64 61 74 61 ?? ?? ?? ??

The example I'm using here is of a 16-bit, stereo, unencoded PCM waveform. In other words, it's CD quality.

Let's break this down into smaller pieces and look at them in turn.

Bytes Meaning
52 49 46 46 "RIFF" in ASCII.
?? ?? ?? ?? The size of the whole file in bytes, minus 8 bytes.
57 41 56 45 "WAVE" in ASCII.
66 6d 74 20 "fmt " in ASCII.
10 00 00 00 I'm not exactly sure about this one. The size of the next number? It appears to be consistently this, at any rate.
01 00 Audio format 1, PCM.
02 00 2 channels, in other words stereo.
44 ac 00 00 "00 00 ac 44", which is 44100.
10 b1 02 00 "00 02 b1 10", which is 44100 * 4 (16-bit, stereo). In other words, the bytes per second.
04 00 The number of bytes for a single set of samples over all channels. (The 4 above.)
10 00 "00 10", which is 2 bytes per sample, 16-bit.
64 61 74 61 "data" in ASCII.
?? ?? ?? ?? The size of the whole file in bytes, minus 44 bytes.

The rest of the file consists of the raw data themselves. For 16-bit stereo, this involves four bytes per set of samples: two for the left channel, then two for the right.