Sample chunk (of a Wave file)

The sample chunk allows a MIDI sampler to use the Wave file as a collection of samples.

A sample chunk has the following format.

Byte sequence description Length in bytes Starts at byte in the chunk Value
chunk ID 4 0x00 The ASCII character string "smpl"
size 4 0x04 The size of the chunk less 8 (less the "chunk ID" and the "size")
manufacturer 4 0x08 The MIDI Manufacturers Association manufacturer code (see MIDI System Exclusive message). A value of zero implies that there is no specific manufacturer. The first byte of the four bytes specifies the number of bytes in the manufacturer code that are relevant (1 or 3). For example, Roland would be specified as 0x01000041 (0x41), where as Microsoft would be 0x03000041 (0x00 0x00 0x41)
product 4 0x0C The product / model ID of the target device, specific to the manufacturer. A value of zero means no specific product
sample period 4 0x10 The period of one sample in nanoseconds. For example, at the sampling rate 44.1 KHz the size of one sample is (1 / 44100) * 1,000,000,000 = 22675 nanoseconds = 0x00005893
MIDI unity note 4 0x14 The MIDI note that will play when this sample is played at its current pitch. The values are between 0 and 127 (see MIDI Note On message)
MIDI pitch fraction 4 0x18 The fraction of a semitone up from the specified note. For example, one-half semitone is 50 cents and will be specified as 0x80
SMPTE format 4 0x1C The SMPTE format. Possible values are 0, 24, 25, 29, and 30 (see Time division (of a MIDI file))
SMPTE offset 4 0x20 Specifies a time offset for the sample, if the sample should start at a later time and not immediately. The first byte of this value specifies the number of hours and is in between -23 and 23. The second byte is the number of minutes and is between 0 and 59. The third byte is the number of seconds (0 to 59). The last byte is the number of frames and is between 0 and the frames specified by the SMPTE format. For example, if the SMPTE format is 24, then the number of frames is between 0 and 23
number of sample loops 4 0x24 Specifies the number of sample loops that are contained in this chunk's data
sample data 4 0x28 The number of bytes of optional sampler specific data that follows the sample loops. If there is no such data, the number of bytes is zero
sample loops various 0x2C The sample loops
sampler specific data various various This sampler specific data is optional

A sample loop has the following structure.

Byte sequence description Length in bytes Starts at byte in the sub-chunk Value
ID 4 0x00 A unique ID of the loop, which could be a cue point (see Cue chunk (of a Wave file))
type 4 0x04 The loop type. A type of 0 means normal forward looping type. A value of 1 means alternating (forward and backward) looping type. A value of 2 means backward looping type. The values 3-31 are reserved for future standard types. The values 32 and above are sampler / manufacturer specific types
start 4 0x08 The start point of the loop in samples
end 4 0x0C The end point of the loop in samples. The end sample is also played
fraction 4 0x10 The resolution at which this loop should be fine tuned. A value of zero means current resolution. A value of 50 cents (0x80) means ½ sample
number of times to play the loop 4 0x14 The number of times to play the loop. A value of zero means infinitely. In a MIDI sampler that may mean infinite sustain

Comments

I have not seen any. It almost looks to me like this is a precursor to soundfonts, but with fewer options.

Add new comment

Filtered HTML

  • Freelinking helps you easily create HTML links. Links take the form of [[indicator:target|Title]]. By default (no indicator): Click to view a local node.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters shown in the image.