The smpl chunk lets a sampler play a WAV file as an instrument. It gives
the note the recording was made at, a fine tuning, and any number of loops, so a short
sample can sustain for as long as a key is held. It is usually credited to the MIDI
Manufacturers Association; that origin is not confirmed here. It belongs to music
production rather than to the broadcast programmes BW64 was made for, but a reader that
meets one reads it as in any WAV file.
Fields
Offsets are from the start of the chunk’s data. Every field of the 36-byte header is a little-endian u32.
| Offset | Size | Type | Name | Description |
|---|---|---|---|---|
| 0 | 4 | u32 | dwManufacturer | MIDI manufacturer ID of the intended sampler, or 0 |
| 4 | 4 | u32 | dwProduct | the manufacturer’s product code, or 0 |
| 8 | 4 | u32 | dwSamplePeriod | the length of one sample in nanoseconds: 20,833 for 48,000 Hz |
| 12 | 4 | u32 | dwMIDIUnityNote | the MIDI note that plays the sample unchanged: 60 is middle C |
| 16 | 4 | u32 | dwMIDIPitchFraction | a fraction of a semitone above the unity note: 0x80000000 is 50 cents |
| 20 | 4 | u32 | dwSMPTEFormat | 0, or a SMPTE frame rate: 24, 25, 29 (30 drop frame) or 30 |
| 24 | 4 | u32 | dwSMPTEOffset | a SMPTE time at which the sample starts: hours (signed), minutes, seconds and frames, a byte each, from the high byte down |
| 28 | 4 | u32 | cSampleLoops | the number of loop records |
| 32 | 4 | u32 | cbSamplerData | the size of the sampler’s own data after the loops |
| 36 | 24 each | record | loops | the loops, laid out below |
| … | cbSamplerData | bytes | sampler data | data for the sampler named by the manufacturer and product |
The explorer reports a loop count larger than the chunk can hold.
Loop
| Offset | Size | Type | Name | Description |
|---|---|---|---|---|
| 0 | 4 | u32 | dwIdentifier | an ID, which can match a cue point |
| 4 | 4 | u32 | dwType | the loop type, below |
| 8 | 4 | u32 | dwStart | the first sample frame of the loop |
| 12 | 4 | u32 | dwEnd | the last sample frame of the loop, which is played |
| 16 | 4 | u32 | dwFraction | a fraction of a sample for finer loop points |
| 20 | 4 | u32 | dwPlayCount | how many times to play the loop: 0 means for ever |
dwType | Loop |
|---|---|
| 0 | forward |
| 1 | alternating: forward, then backward |
| 2 | backward |
| 3 to 31 | reserved |
| 32 and up | the manufacturer’s own |
The loop points are 32-bit frame numbers, so a loop cannot start or end past frame 4,294,967,295.