The COMM chunk describes the audio. Every file has exactly one. The size is
22 plus the length of the compression name’s bytes, the count byte and any pad byte
included.
Fields
| Offset | Size | Type | Name | Description |
|---|---|---|---|---|
| 0 | 2 | s16 | numChannels | the number of channels: 1 is mono, 2 stereo, 4 four-channel and so on |
| 2 | 4 | u32 | numSampleFrames | the number of sample frames, not bytes or sample points |
| 6 | 2 | s16 | sampleSize | the bits per sample point, 1 to 32; for compressed data, the depth of the audio before compression |
| 8 | 10 | extended | sampleRate | the sample frames per second, as an 80-bit float |
| 18 | 4 | ID | compressionType | a four-character code naming the compression; see Compression types |
| 22 | varies | pstring | compressionName | a name for people to read, such as not compressed |
The name is a Pascal string, a count byte and then the text. If the name’s length is odd it is followed by a 0 byte, not counted in the length, which keeps the string even. Custom compression types were to be registered with Apple. The name is meant for displaying in alert boxes, and software does not depend on it.
The 80-bit sample rate
The rate is an IEEE 754 extended-precision float: a sign bit and 15-bit exponent, big-endian, then a 64-bit mantissa with an explicit leading 1.
| Offset | Size | Meaning |
|---|---|---|
| 0 | 2 | the sign in the top bit, and the exponent plus 16,383 |
| 2 | 8 | the mantissa |
Value = mantissa ÷ 263 × 2exponent − 16383.
| Rate | Bytes |
|---|---|
| 8,000 Hz | 40 0B FA 00 00 00 00 00 00 00 |
| 22,050 Hz | 40 0D AC 44 00 00 00 00 00 00 |
| 44,100 Hz | 40 0E AC 44 00 00 00 00 00 00 |
| 48,000 Hz | 40 0E BB 80 00 00 00 00 00 00 |