home *** CD-ROM | disk | FTP | other *** search
/ Chip 2000 September / Chip_2000-09_cd1.bin / sharewar / Slunec / app / 16 / MOD.SWG / 0004_DMF.pas < prev    next >
Pascal/Delphi Source File  |  1996-09-04  |  9KB  |  184 lines

  1. --------M-DMF-------------------------------
  2.  
  3. The  Digital Music Files are high quality  MOD style files with up to 32
  4. channels/1024  beats per track. The X-Tracker by the demo group D-Lusion
  5. produces  this  format. In general, the  format is well organised due to
  6. the  ID/Blocklength structure wich makes downward compatibility to older
  7. version  files  easy,  but the Version  4  (current version) of the file
  8. format,  produced by X-Tracker 0.30ß still requires some manual scanning
  9. for  the next ID which I regard as  not so nice. Version 5 of the format
  10. has  the [SEQU] block length fixed, but  the [SMPD] block has the length
  11. 0.
  12.  
  13. The file consists of several blocks, each with a 4 char (dwordint) ID tag
  14. and a length of the record data. The main file header looks as follows :
  15.  
  16. OFFSET              Count TYPE   Description
  17. 0000h                   4 char   ID='DDMF'
  18. 0004h                   1 byte   Version id.
  19.                                  4 -> XTracker 0.30ß
  20. 0005h                   8 char   Tracker name, e.g. 'XTRACKER', 'HACKTRAK' :-)
  21. 000Dh                  30 char   Song name (ASCIIZ?)
  22. 002Bh                  20 char   Name of composer (ASCIIZ?)
  23. 0049h                   1 byte   Day of creation
  24. 004Ah                   1 byte   Month of creation
  25. 004Bh                   1 byte   Year of creation
  26.  
  27. The other headers have the standard skip record format, in this section
  28. named DMFblock. The offsets start _after_ this header record :
  29.  
  30. OFFSET              Count TYPE   Description
  31. 0000h                   4 char   Record tag (see below)
  32. 0004h                   1 dword  Size of data bedwording to this tag
  33.  
  34. DMFblock [INFO]
  35.   Contains some message in ASCII. Length of the message is the size of
  36.   the record.
  37.  
  38. DMFblock [CMSG]
  39.   Contains the message the composer wants to bring to us. After the ID
  40.   record, another fill byte preceeds the real message !
  41. OFFSET              Count TYPE   Description
  42. 0000h                   1 byte   Junk byte
  43. 0001h                   ? char   Composer message
  44.  
  45. DMFblock [SEQU]
  46.   Contains the information necessary for sequencing the different tracks.
  47. OFFSET              Count TYPE   Description
  48. 0000h                   1 word   Song loop start
  49. 0002h                   1 word   Song loop end
  50. 0004h                   ? word   Sequencer data
  51.  
  52. DMFblock [PATT]
  53. This  block  contains the information  about  the different patterns and
  54. tracks.
  55.  
  56. 0000h                   1 word   Maximum pattern (=Songlength)
  57.                                  ="MPT"
  58. 0004h                   1 byte   Number of channels of this song (<= 16)
  59. 0005h               "MPT" rec    Pattern data.
  60.                         1 byte   Track entries. (<=32)
  61.                                  ="TET"
  62.                                  How many tracks this pattern has.
  63.                                  XTracker allows a different number of
  64.                                  tracks for each pattern.
  65.                         1 byte   Beat information
  66.                                  High nibble : Ticks per beat
  67.                                  Low nibble  : Beats per measure
  68.                         1 word   Maximum number of ticks (<=512)
  69.                         1 dword  Number of bytes to skip for the
  70.                                  next pattern information.
  71.                         ? rec    Track data stream
  72.                         1 byte   Global track effect
  73.                         1 byte   Global track data (only if global
  74.                                  effect >0 !!!)
  75.                     "TET" rec
  76.                         1 byte   Information byte, bitmapped
  77.                                  For each bit set in the info byte, one
  78.                                  or two data byte(s) follow. This info byte
  79.                                  must not always be there, see below. For
  80.                                  effects, 2 bytes follow.
  81.                                  0 - reserved
  82.                                  1 - Volume effect
  83.                                  2 - Note effect
  84.                                  3 - Instrument effect
  85.                                  4 - Volume set
  86.                                  5 - Note set
  87.                                  6 - Instrument set
  88.                                  7 - Counter to next information byte.
  89.                                      Not set means, that next info byte
  90.                                      follows in 1 tick, unit is in
  91.                                      ticks.
  92.                                  The maximum number of effects is 3 at a time,
  93.                                  the maxximum size of a track information is
  94.                                  11 bytes (with info=0FEh).
  95.                         ? rec   Effect bytes
  96.                         1 byte  Effect number
  97.                         1 byte  Effect data
  98.                         ? byte  Set data
  99. ** Here follows the pattern data, but it's too late today **
  100.  
  101. DMFblock [INST]
  102. This  block contains the information about  the instrument data. If this
  103. block does not exists, then the instrument numbers in the patterns point
  104. directly to the samples in the [SMPI] block.
  105.  
  106. OFFSET              Count TYPE   Description
  107. 0000h                   1 byte   Number of instruments
  108. 0001h                   ? rec    Instrument information block
  109.                        30 char   The name of the instrument
  110.                         1 byte   Instrument type, bitmapped
  111.                                  0 - Instrument type
  112.                                  1 - Instrument type
  113.                                    00 - Sample in [SMPI] block
  114.                                    01 - MIDI device
  115.                                    10 - FM instrument
  116.                                    11 - reserved
  117.                                  2 - valid attack envelope
  118.                                  3 - sustain on
  119.                                  4 - reserved
  120.                                  5 - reserved
  121.                                  6 - reserved
  122.                                  7 - reserved
  123.                         1 byte   Range entries
  124.                                  ="REN"
  125.                                  Like the GF1 patterns, an instrument can
  126.                                  consist of several samples.
  127.                     "REN" rec    Range definition
  128.                         1 byte   Sample to be played in this range
  129.                         1 byte   Length of this range in half tone steps up
  130.                         6 byte   Not yet defined 6-point envelope
  131.  
  132. DMFblock [SMPI]
  133. This block contains the information about the samples stored in the file.
  134.  
  135. OFFSET              Count TYPE   Description
  136. 0000h                   1 byte   Number of samples (<= 250)
  137.                                  ="NUM"
  138.                     "NUM" rec    Sample record
  139.                         1 byte   Length of sample name
  140.                         ? char   Name of the sample
  141.                         1 dword  Length of sample in bytes
  142.                         1 dword  Start of sample loop
  143.                         1 dword  End of sample loop
  144.                         1 word   Frequency used for C-3
  145.                         1 byte   Volume for sample
  146.                                  0 - Don't change current volume
  147.                                  otherwise volume (linear scale)
  148.                         1 byte   Sample type, bitmapped
  149.                                    0 - not looped/looped
  150.                                    1 - 8/16-bit sample
  151.                                      (16-bit not supported with X-Tracker v0.30)
  152.                                  2,3 - Pack type :
  153.                                    00 - unpacked, signed sample
  154.                                    01 - pack type 0
  155.                                    10 - pack type 1
  156.                                    11 - pack type 2
  157.                                  4-6 - reserved, set to zero
  158.                                    7 - Sample stored in dmf/bib
  159.                         1 word   reserved, set to zero
  160.                         1 dword  crc32 of sample to identify samples
  161.                                  in BIB.
  162.  
  163. DMFblock [SMPD]
  164. This block contains the sample data (raw or packed, see [SMPI] block) in
  165. the   following  format  :  <SampleLength>  <SampleData>  <SampleLength>
  166. <SampleData> etc.
  167.  
  168. OFFSET              Count TYPE   Description
  169. 0000h                   1 dword  Length of the following sample
  170.                         ? byte   Sample data (might be packed)
  171.  
  172. DMFBlock [ENDE]
  173. This  block  serves  as  a  end  of  file  marker  and  can  be used for
  174. validation.  Note  that the four ID  characters  are _not_ followed by a
  175. length  dword  !  Each  DMF file  simply  ends  with the four characters
  176. 'ENDE'.
  177.  
  178. EXTENSION:DMF
  179. OCCURENCES:PC
  180. PROGRAMS:X-TRACKER,PLAY_DMF
  181. SEE ALSO:
  182. VALIDATION:
  183.  
  184.