The DMF Audio File Format

Also known as:


Original Documentation

The Digital Music Files are high quality MOD style files with up to
32 channels/1024 beats per track. The X-Tracker by the demo group
D-Lusion produces this format. In general, the format is well organised
due to the ID/Blocklength structure wich makes downward compatibility to
older version files easy, but the Version 4 (current version) of the file
format, produced by X-Tracker 0.30β still requires some manual scanning for
the next ID which I regard as not so nice. Version 5 of the format has the
[SEQU] block length fixed, but the [SMPD] block has the length 0.

The file consists of several blocks, each with a 4 char (dwordint) ID tag
and a length of the record data. The main file header looks as follows :
OFFSET              Count TYPE   Description
0000h                   4 char   ID='DDMF'
0004h                   1 byte   Version id.
								 4 -> XTracker 0.30β
0005h                   8 char   Tracker name, e.g. 'XTRACKER', 'HACKTRAK' :-)
000Dh                  30 char   Song name (ASCIIZ?)
002Bh                  20 char   Name of composer (ASCIIZ?)
0049h                   1 byte   Day of creation
004Ah                   1 byte   Month of creation
004Bh                   1 byte   Year of creation

The other headers have the standard skip record format, in this section
named DMFblock. The offsets start _after_ this header record :
OFFSET              Count TYPE   Description
0000h                   4 char   Record tag (see below)
0004h                   1 dword  Size of data bedwording to this tag

DMFblock [INFO]
  Contains some message in ASCII. Length of the message is the size of
  the record.

DMFblock [CMSG]
  Contains the message the composer wants to bring to us. After the ID
  record, another fill byte preceeds the real message !
OFFSET              Count TYPE   Description
0000h                   1 byte   Junk byte
0001h                   ? char   Composer message

DMFblock [SEQU]
  Contains the information necessary for sequencing the different tracks.
OFFSET              Count TYPE   Description
0000h                   1 word   Song loop start
0002h                   1 word   Song loop end
0004h                   ? word   Sequencer data

DMFblock [PATT]
  This block contains the information about the different patterns and tracks.
0000h                   1 word   Maximum pattern (=Songlength)
								 ="MPT"
0004h                   1 byte   Number of channels of this song (<= 16)
0005h               "MPT" rec    Pattern data.
						1 byte   Track entries. (<=32)
								 ="TET"
								 How many tracks this pattern has.
								 XTracker allows a different number of
								 tracks for each pattern.
						1 byte   Beat information
								 High nibble : Ticks per beat
								 Low nibble  : Beats per measure
						1 word   Maximum number of ticks (<=512)
						1 dword  Number of bytes to skip for the
								 next pattern information.
						? rec    Track data stream
						1 byte   Global track effect
						1 byte   Global track data (only if global
								 effect >0 !!!)
					"TET" rec
						1 byte   Information byte, bitmapped
								 For each bit set in the info byte, one
								 or two data byte(s) follow. This info byte
								 must not always be there, see below. For
								 effects, 2 bytes follow.
								 0 - reserved
								 1 - Volume effect
								 2 - Note effect
								 3 - Instrument effect
								 4 - Volume set
								 5 - Note set
								 6 - Instrument set
								 7 - Counter to next information byte.
									 Not set means, that next info byte
									 follows in 1 tick, unit is in
									 ticks.
								 The maximum number of effects is 3 at a time,
								 the maxximum size of a track information is
								 11 bytes (with info=0FEh).
						? rec   Effect bytes
						1 byte  Effect number
						1 byte  Effect data
						? byte  Set data
** Here follows the pattern data, but it's too late today **

DMFblock [INST]
  This block contains the information about the instrument data.
  If this block does not exists, then the instrument numbers in the patterns
  point directly to the samples in the [SMPI] block.
OFFSET              Count TYPE   Description
0000h                   1 byte   Number of instruments
0001h                   ? rec    Instrument information block
					   30 char   The name of the instrument
						1 byte   Instrument type, bitmapped
								 0 - Instrument type
								 1 - Instrument type
								   00 - Sample in [SMPI] block
								   01 - MIDI device
								   10 - FM instrument
								   11 - reserved
								 2 - valid attack envelope
								 3 - sustain on
								 4 - reserved
								 5 - reserved
								 6 - reserved
								 7 - reserved
						1 byte   Range entries
								 ="REN"
								 Like the GF1 patterns, an instrument can
								 consist of several samples.
					"REN" rec    Range definition
						1 byte   Sample to be played in this range
						1 byte   Length of this range in half tone steps up
						6 byte   Not yet defined 6-point envelope

DMFblock [SMPI]
This block contains the information about the samples stored in the file.
OFFSET              Count TYPE   Description
0000h                   1 byte   Number of samples (<= 250)
								 ="NUM"
					"NUM" rec    Sample record
						1 byte   Length of sample name
						? char   Name of the sample
						1 dword  Length of sample in bytes
						1 dword  Start of sample loop
						1 dword  End of sample loop
						1 word   Frequency used for C-3
						1 byte   Volume for sample
								 0 - Don't change current volume
								 otherwise volume (linear scale)
						1 byte   Sample type, bitmapped
								   0 - not looped/looped
								   1 - 8/16-bit sample
									 (16-bit not supported with X-Tracker v0.30)
								 2,3 - Pack type :
								   00 - unpacked, signed sample
								   01 - pack type 0
								   10 - pack type 1
								   11 - pack type 2
								 4-6 - reserved, set to zero
								   7 - Sample stored in dmf/bib
						1 word   reserved, set to zero
						1 dword  crc32 of sample to identify samples
								 in BIB.

DMFblock [SMPD]
This block contains the sample data (raw or packed, see [SMPI] block) in the
following format :
<SampleLength> <SampleData> <SampleLength> <SampleData> etc.
OFFSET              Count TYPE   Description
0000h                   1 dword  Length of the following sample
						? byte   Sample data (might be packed)

DMFBlock [ENDE]
This block serves as a end of file marker and can be used for validation.
Note that the four ID characters are _not_ followed by a length dword ! Each DMF
file simply ends with the four characters 'ENDE'.
EXTENSION:DMF
OCCURENCES:PC
PROGRAMS:X-TRACKER,PLAY_DMF
SEE ALSO:
VALIDATION:

This information is from Corion.net and is used with permission.

More Resources