smpl chunk
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.
Fields
| 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: 22,675 for 44,100 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 |
| 28 | 4 | u32 | cSampleLoops | the number of loop records |
| 32 | 4 | u32 | cbSamplerData | the size of extra sampler data after the loops |
| 36 | 24 each | record | loops | the loops, laid out below |
Offsets are from the start of the chunk’s data.
Loop
| Offset | Size | Type | Name | Description |
|---|---|---|---|---|
| 0 | 4 | u32 | dwIdentifier | an ID, which can match a cue point |
| 4 | 4 | u32 | dwType | 0 forward, 1 alternating (forward then backward), 2 backward |
| 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 forever |