About RIFF

The basic building block of a RIFF file is a chunk. A chunk is a logical unit of data. Each chunk contains the following fields:

A chunk contained in another chunk is a subchunk. The only chunks allowed to contain subchunks are those with a chunk identifier of "RIFF" or "LIST".

The first chunk in a file must be identified as "RIFF". All other chunks in the file are subchunks of the RIFF chunk.

RIFF chunks include an additional field in the first four bytes of the data field. This additional field provides the form type of the chunk. The form type is a four-character code identifying the format of the data stored in the file. For example, DirectMusic styles have the form type "DMST".

LIST chunks also include an additional field in the first four bytes of the data field. This additional field contains the list type of the field. The list type is a four-character code identifying the contents of the list. For example, DirectMusic styles have a LIST chunk with a list type of "part" that contains data pertaining to a particular part (instrument track) in the performance.

A LIST chunk is a grouping of subchunks. Some of these subchunks may appear multiple times, but a LIST is not an array. The terminology can be a little confusing. You might expect the chunk labeled <part-list>, for example, to be a list of parts. In fact, it is a list of the elements of a "part" chunk, which describes a single part.

Note  Every four-character code used in DirectMusic files has a corresponding macro in Dmusicf.h. For example, the FOURCC for "DMST" is returned by the macro DMUS_FOURCC_STYLE_FORM.

For more information on RIFF files in general, see Resource Interchange File Format Services in the Platform SDK documentation.