home *** CD-ROM | disk | FTP | other *** search
/ Large Pack of OldSkool DOS MOD Trackers / digitr21.zip / FORMAT.TXT < prev    next >
Text File  |  1995-03-02  |  12KB  |  282 lines

  1. ╒════════════════════════════════════════════════════════════════════════════╕
  2. ├────────────────────────────────────────────────────────────────────────────┤
  3. │                                                                            │
  4. │   DIGITRAKKER FILE-FORMAT INFORMATION                 by proton/n-Factor   │
  5. │                                                                            │
  6. ├────────────────────────────────────────────────────────────────────────────┤
  7. ╘════════════════════════════════════════════════════════════════════════════╛
  8.  
  9.  
  10. This file contains information about the songmodule-format "MDL" and the
  11. sample-format "SPL". If you have some problems or if you have questions about
  12. these formats, which are not answered in here, just contact me.
  13.  
  14.  
  15. ╔════════════════════════════════════════════════════════════════════════════╗
  16. ║                        THE SONGMODULE-FORMAT  (MDL)                   V000 ║
  17. ╚════════════════════════════════════════════════════════════════════════════╝
  18.  
  19. Offset Lenght Description
  20.  
  21.  000    004     "DMDL"; the four letters mark the mdl-format
  22.  004    001     version; the current version is 0
  23.  005    ???     the different data-blocks are stored at this position
  24.  
  25. The MDL-songmodule-format is subivided into the following blocks:
  26.  
  27. "IN" - infoblock; contains most songparameters, like speed, length etc.
  28. "PN" - patternnames; contains the names of the pattern
  29. "ME" - songmessage; contains the songinformation from the composer
  30. "PA" - pattern; contains the tracklists for every pattern
  31. "TR" - tracks; contains the different tracks for the pattern
  32. "IS" - instruments; contains information for every used sample
  33. "SA" - samples; contains the sample-datas
  34.  
  35. The sequence of the blocks in a file is not fixed so they can be stored in any
  36. way. Digitrakker uses the descripted sequence.
  37.  
  38. The structure for every block is the same:
  39.  
  40. Offset Lenght Description
  41.  
  42.  000    002     "xx"; block-ID (example: "IN" for infoblock)
  43.  002    004     blocklength; this dword contains the length of the following
  44.         datas.
  45.  006 <blocklen> datas for this block...
  46.  
  47. The next block will be at offset (006 + <blocklength>).
  48.  
  49. ┌────────────────────────────────────────────────────────────────────────────┐
  50. │                             The Infoblock (IN)                             │
  51. └────────────────────────────────────────────────────────────────────────────┘
  52.  
  53. Offset Lenght Description
  54.  
  55.  000    002     "IN"; infoblock-ID
  56.  002    004     blocklenght
  57.  006    032     songname; name of the songmodule (filled with spaces [32])
  58.  038    020     composername; name of the song-composer
  59.  058    002     songlength; Digitrakker supports up to 255 songpositions
  60.  060    002     songrepeat
  61.  062    001     mainvolume (001-255)
  62.  063    001     song-speed (001-255)
  63.  064    001     beats per minute (004-255)
  64.  065    032     channel-information: bit 0-6 - panposition (0=left,127=right)
  65.                      bit 7   - 0=channel on, 1=channel off
  66.  097  <snglen>  sequencer; contains the number of the pattern for every
  67.         songposition
  68.  ???  <chnnam>  the names for every channel (8 chars for one name).
  69.         <chnnam> = 8 * <number of channels>
  70.  
  71. ┌────────────────────────────────────────────────────────────────────────────┐
  72. │                           The Patternnames  (PN)                           │
  73. └────────────────────────────────────────────────────────────────────────────┘
  74.  
  75. Offset Lenght Description
  76.  
  77.  000    002     "PN"; patternnames-ID
  78.  002    004     blocklenght
  79.  006  <patnam>  the names for every pattern (16 chars for one name).
  80.         <patnam> = 16 * <number of patterns>
  81.  
  82. ┌────────────────────────────────────────────────────────────────────────────┐
  83. │                            The Songmessage (ME)                            │
  84. └────────────────────────────────────────────────────────────────────────────┘
  85.  
  86. Offset Lenght Description
  87.  
  88.  000    002     "ME"; songmessage-ID
  89.  002    004     blocklenght
  90.  006    ???     songmessage; every line is closed with the CR-char (13). A
  91.         0-byte stands at the end of the whole text.
  92.  
  93. ┌────────────────────────────────────────────────────────────────────────────┐
  94. │                           The Patterndatas  (PA)                           │
  95. └────────────────────────────────────────────────────────────────────────────┘
  96.  
  97. Offset Lenght Description
  98.  
  99.  000    002     "PA"; patterndata-ID
  100.  002    004     blocklenght
  101.  006    001     number of pattern; values from 1 to 255 are possible
  102.  007  <patlar>  tracksequencing-data for the used patterns;
  103.  
  104. These sequencer-lists descripe which track is used as which voice in each
  105. saved pattern. Every pattern consists of 32 channels. The first word in this
  106. list is the number of the track at pattern 0, voice 0. The second is track for
  107. pattern 0, voice 1 and so on... As every pattern consists of 32 voices
  108. (channels), the tracksequencing-list needs 32 words = 64 bytes.
  109. <patlar> = 64 * <number of patterns>.
  110. As every track is saved independend, it is possible to save some discspace by
  111. this methode: If the song contains equal tracks at several positions in
  112. the patterns, these double tracks will only saved one time.
  113. Track 0 is not saved and represents an empty track.
  114.  
  115. ┌────────────────────────────────────────────────────────────────────────────┐
  116. │                            The Trackdatas  (TR)                            │
  117. └────────────────────────────────────────────────────────────────────────────┘
  118.  
  119. Offset Lenght Description
  120.  
  121.  000    002     "TR"; trackdata-ID
  122.  002    004     blocklenght
  123.  006    002     number of tracks
  124.  008    ???     track-datablocks; every trackdatablock is stored in this way:
  125.         Ofs.000 Len.002         length of the trackdatas
  126.             002 <trackdatalen>  datas for this track
  127.  
  128. Every track consists of 64 notepositions and every notposition contains 6
  129. bytes:
  130.  
  131. byte 0              - note-value; 1=C-0,2=C#0,...,120=B-9,0=nothing,255=stopper
  132. byte 1              - sample-number; 1-255; 0=nothing
  133. byte 2              - volume; 1-255; 0=no volume change
  134. byte 3, low nibble  - number of the first effect-command
  135. byte 3, high nibble - number of the second effect-command
  136. byte 4              - databyte for the first effect-command
  137. byte 5              - databyte for the second effect-command
  138.  
  139. So one track needs 6 * 64 = 384 bytes in the memory. Digitrakker stores the
  140. tracks in a packed way. The structure of this (very effective!) packformat is
  141. the following:
  142.  
  143.      bit 76543210
  144. byte 0 - xxxxxxyy
  145.  
  146. if yy = 00 -> <xxxxxx>+1 is the number of the empty notepositions which are
  147.           following.
  148. if yy = 01 -> the last noteposition will be repeated <xxxxxx>+1 times.
  149. if yy = 10 -> the noteslot from position <xxxxxx> is copied to the actual
  150.           position.
  151. if yy = 11 -> the following datas will be put in the actual noteslot:
  152.         bit 2 = 1 -> note
  153.         bit 3 = 1 -> sample
  154.         bit 4 = 1 -> volume
  155.         bit 5 = 1 -> effectcommand numbers
  156.         bit 6 = 1 -> databyte for effect 1
  157.         bit 7 = 1 -> databyte for effect 1
  158.  
  159. ┌────────────────────────────────────────────────────────────────────────────┐
  160. │                       The Instrument-Infoblock  (IS)                       │
  161. └────────────────────────────────────────────────────────────────────────────┘
  162.  
  163. Offset Lenght Description
  164.  
  165.  000    002     "IS"; intrumentinfo-ID
  166.  002    004     blocklenght
  167.  006    001     number of samples; vales from 0 to 255 are possible
  168.  007  <inslar>  instrument-datas; the datablock for an instrument contains
  169.         57 bytes, so <inslar> = 57 * number of saved samples
  170.  
  171. The structure of one instrument-datablock:
  172.  
  173.  000    001     sample-number; (1-255)
  174.  001    032     sample-name; the name of the sample (filled with [32])
  175.  033    008     filename of the sample
  176.  041    002     C-4 sample-frequence in hz (00000-65535)
  177.  043    004     sample-length
  178.  047    004     sample-repeatstart
  179.  051    004     sample-repeatlength; if this value is set to 0, the sample
  180.         will not loop
  181.  055    001     sample-volume (001-255)
  182.  056    001     infobyte:
  183.         bit 0   -> 0=8 bit sample, 1=16 bit sample
  184.         bit 1   -> 0=forward looping, 1=bidirectional looping
  185.         bit 2,3 -> packmethode (0=not packed, methodes 2 and 3 doesn't
  186.                exist in this version)
  187.         bit 4-7 -> not used (should be set to 0)
  188.  
  189. ┌────────────────────────────────────────────────────────────────────────────┐
  190. │                            The Sampledatas (SA)                            │
  191. └────────────────────────────────────────────────────────────────────────────┘
  192.  
  193. Offset Lenght Description
  194.  
  195.  000    002     "SA"; sampledata-ID
  196.  002    004     blocklenght
  197.  006    ???     sampledatas; samples are stored in numeric sequence
  198.  
  199. Unpacked samples are stored in signed form. Packmethode (1) only works with
  200. 8 bit samples, so 16 bit samples will always be unpacked.
  201.  
  202. The description of the sample-packmethode (1):...
  203.  
  204. This methode is based on the huffman-algorithm. It's an easy form, but very
  205. fast and effective on samples. The packed sample is a bit-data-stream:
  206.  
  207.     Byte 0    Byte 1    Byte 2    Byte 3
  208. Bit 76543210  fedcba98  nmlkjihg  ....rqpo
  209.  
  210. A packed byte is stored in the following form:
  211.  
  212. xxxx10..0s => byte = <xxxx> + (number of <0>-bits between s and 1) * 16 - 8 ;
  213.           if s=1 then byte = byte xor 255
  214.  
  215. If there are no <0>-bits between the first bit (sign) and the <1>-bit, you
  216. have the following form:
  217.  
  218. xxx1s => byte = <xxx> ; if s=1 then byte = byte xor 255
  219.  
  220. To depack one byte, you have to use the following algorithm:
  221. ┌────────────────────────────────────────────────────────────────────────────┐
  222. │       read bit                                                             │
  223. │       sign = bit                                                           │
  224. │       read bit                                                             │
  225. │       if bit = 1                                                           │
  226. │               then    read [3bits]                                         │
  227. │                       byte = [3bits]                                       │
  228. │                       goto next                                            │
  229. │               else    byte = 8                                             │
  230. │loop:  read bit                                                             │
  231. │       if bit = 0                                                           │
  232. │               then    byte = byte + 16                                     │
  233. │                       goto loop                                            │
  234. │               else    read [4bits]                                         │
  235. │                       byte = byte + [4bits]                                │
  236. │next:   if sign = 1                                                         │
  237. │               then byte = byte xor 255                                     │
  238. └────────────────────────────────────────────────────────────────────────────┘
  239.  
  240. Two examples:
  241.  
  242. xxxx  s
  243. 1001101 = ( 9 + 1 * 16 - 8 ) xor 255 = 238
  244.  
  245. xxx s
  246. 01010 = 2
  247.  
  248. Note that the depacked bytes are delta values. To convert them to real data
  249. use this algorithm:
  250.  
  251. oldbyte = 0
  252. for sampleposition = 1 to samplelength
  253.     newbyte = byte [sampleposition] + oldbyte
  254.     byte [sampleposition] = newbyte
  255.     oldbyte = newbyte
  256. next sampleposition
  257.  
  258.  
  259. ╔════════════════════════════════════════════════════════════════════════════╗
  260. ║                          THE SAMPLE-FORMAT  (SPL)                     V000 ║
  261. ╚════════════════════════════════════════════════════════════════════════════╝
  262.  
  263. Offset Lenght Description
  264.  
  265.  000    004     "DSPL"; the four letters mark the spl-format
  266.  004    001     version; the current version is 0
  267.  005    032     sample-name; the name of the sample (filled with [32])
  268.  037    008     filename of the sample
  269.  045    002     C-4 sample-frequence in hz (00000-65535)
  270.  047    004     sample-length
  271.  051    004     sample-repeatstart
  272.  055    004     sample-repeatlength; if this value is set to 0, the sample
  273.         will not loop
  274.  059    001     sample-volume (001-255)
  275.  060    001     infobyte:
  276.         bit 0   -> 0=8 bit sample, 1=16 bit sample
  277.         bit 1   -> 0=forward looping, 1=bidirectional looping
  278.         bit 2,3 -> packmethode (0=not packed, methodes 2 and 3 doesn't
  279.                exist in this version)
  280.         bit 4-7 -> not used (should be set to 0)
  281.  061    ???     sampledatas... (see above)
  282.