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 descriptionLength in bytesStarts at byte in the chunkValue
chunk ID40x00The ASCII character string "smpl"
size40x04The size of the chunk less 8 (less the "chunk ID" and the "size")
manufacturer40x08The 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)
product40x0CThe product / model ID of the target device, specific to the manufacturer. A value of zero means no specific product
sample period40x10The 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 note40x14The 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 fraction40x18The fraction of a semitone up from the specified note. For example, one-half semitone is 50 cents and will be specified as 0x80
SMPTE format40x1CThe SMPTE format. Possible values are 0, 24, 25, 29, and 30 (see Time division (of a MIDI file))
SMPTE offset40x20Specifies 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 loops40x24Specifies the number of sample loops that are contained in this chunk's data
sample data40x28The 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 loopsvarious0x2CThe sample loops
sampler specific datavariousvariousThis sampler specific data is optional

A sample loop has the following structure.

Byte sequence descriptionLength in bytesStarts at byte in the sub-chunkValue
ID40x00A unique ID of the loop, which could be a cue point (see Cue chunk (of a Wave file))
type40x04The 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
start40x08The start point of the loop in samples
end40x0CThe end point of the loop in samples. The end sample is also played
fraction40x10The 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 loop40x14The number of times to play the loop. A value of zero means infinitely. In a MIDI sampler that may mean infinite sustain

See also:
Wave file format

Rate This Page: Poor Great   |  Rate Content |
Average rating:  5   
Number of Ratings : 1
Add Comment
No Comments Yet

Copyright 2006 by Kaliopa Publishing, LLC