home *** CD-ROM | disk | FTP | other *** search
/ Large Pack of OldSkool DOS MOD Trackers / digit299.zip / FORMAT.TXT < prev    next >
Text File  |  1995-10-21  |  22KB  |  482 lines

  1.                                                       ┌─-─--·· · · ··--─-─┐
  2. ╒═════════════════════════════════════════════════════│    █▐  n-Factor's │══╕
  3. ├─────────────────────────────────────────────────────│    █▐             │──┤
  4. │                                                     │ ▐███▐  ▀ ▐███▌  ▀ │  │
  5. │   ≡≡≡ DIGITRAKKER ≡≡≡ FILE-FORMAT DESCRIPTION ≡≡≡   │ █  █▐ █▐ █  █▐ █▐ │  │
  6. │                                                     │ ▐███▐ █▐ ▐███▐ █▐ │  │
  7. ├─────────────────────────────────────────────────────│             █▐    │──┤
  8. ╘═════════════════════════════════════════════════════│  t r a k k▐██▌e r │══╛
  9.                                                       └─-─--·· · · ··--─-─┘
  10.  
  11. --------------------------- by prodatron/n-Factor ----------------------------
  12.  
  13.  
  14. This file contains information about the songmodule-format "MDL", the
  15. instrument-format "IST" and the old sample-format "SPL".
  16. If you have some problems or if you have questions about these formats, which
  17. are not answered in here, just contact me.
  18.  
  19.  
  20.  
  21.  
  22. ╔════════════════════════════════════════════════════════════════════════════╗
  23. ║                        THE SONGMODULE-FORMAT  (MDL)                   V1.1 ║
  24. ╚════════════════════════════════════════════════════════════════════════════╝
  25.  
  26. Offset Lenght Description
  27.  
  28.  000    004     "DMDL"; the four letters mark the mdl-format
  29.  004    001     version; the current version is 11h (=1.1)
  30.  005    ???     the different data-blocks are stored at this position
  31.  
  32. Some words to the format version-number:
  33. - if the low-nibble increases, there are extensions in the format, but old
  34.   loaders should be able to load the new modules (or most of them...)
  35. - if the high-nibble increases, there are changes in the format which make old
  36.   loaders unable to read the new songfiles
  37.  
  38. The MDL-songmodule-format is subdivided into the following blocks:
  39.  
  40. "IN"    infoblock; contains most songparameters, like speed, length etc.
  41. "ME"    songmessage; contains the songinformation from the composer
  42. "PA" c  pattern; contains the length, names and tracklists for every pattern
  43. "TR"    tracks; contains all the tracks for the pattern
  44. "II" n  instruments; contains all information for the used instruments
  45. "VE" n  volume-envelopes; contains the construction of all used vol-envelopes
  46. "PE" n  panning-envelopes; the same for the used pan-envelopes
  47. "FE" n1 frequency-envelopes; ...used frq-envelopes (LFO)
  48. "IS" c  sampleinfos; contains information for every used sample
  49. "SA"    samples; contains the sample-datas
  50.  
  51. [[ c  = blockstructure changes from v0.0 to v1.0 ]]
  52. [[ n  = new in version 1.0                       ]]
  53. [[ n1 = new in version 1.1                       ]]
  54.  
  55. The sequence of the blocks in a file is not fixed so they can be stored in any
  56. way. Digitrakker uses the descripted sequence.
  57.  
  58. The structure for every block is the same:
  59.  
  60. Offset Lenght Description
  61.  
  62.  000    002     "xx"; block-ID (example: "IN" for infoblock)
  63.  002    004     blocklength; this dword contains the length of the FOLLOWING
  64.         datas.
  65.  006 <blocklen> datas for this block...
  66.  
  67. The next block will be at offset (006 + <blocklength>).
  68.  
  69. ┌────────────────────────────────────────────────────────────────────────────┐
  70. │                          The Song-Infoblock  (IN)                          │
  71. └────────────────────────────────────────────────────────────────────────────┘
  72.  
  73. Offset Lenght Description
  74.  
  75.  000    002     "IN"; infoblock-ID
  76.  002    004     blocklenght
  77.  006    032     songname; name of the songmodule (filled with spaces [32])
  78.  038    020     composername; name of the song-composer
  79.  058    002     songlength; Digitrakker supports up to 255 songpositions
  80.  060    002     songrepeat
  81.  062    001     mainvolume (001-255)
  82.  063    001     song-speed (001-255)
  83.  064    001     beats per minute (004-255)
  84.  065    032     channel-information: bit 0-6 - panposition (0=left,127=right)
  85.                      bit 7   - 0=channel on, 1=channel off
  86.                 [number of channels = last active channel]
  87.  097  <snglen>  sequencer; contains the number of the pattern for every
  88.         songposition
  89.  ???  <chnnam>  the names for every channel (8 chars for one name).
  90.         <chnnam> = 8 * <number of channels>
  91.  
  92. ┌────────────────────────────────────────────────────────────────────────────┐
  93. │                            The Songmessage (ME)                            │
  94. └────────────────────────────────────────────────────────────────────────────┘
  95.  
  96. Offset Lenght Description
  97.  
  98.  000    002     "ME"; songmessage-ID
  99.  002    004     blocklenght
  100.  006    ???     songmessage; every line is closed with the CR-char (13). A
  101.         0-byte stands at the end of the whole text.
  102.  
  103. ┌────────────────────────────────────────────────────────────────────────────┐
  104. │                           The Patterndatas  (PA)                           │
  105. └────────────────────────────────────────────────────────────────────────────┘
  106.  
  107. Offset Lenght Description
  108.  
  109.  000    002     "PA"; patterndata-ID
  110.  002    004     blocklenght
  111.  006    001     number of pattern; values from 1 to 255 are possible
  112.  007  <patlar>  the datablocks for all saved pattern
  113.  
  114. The structure of one pattern-datablock:
  115.  
  116.  000    001    number of used channels (0-32)
  117.  001    001    patternlength-1; the actual digitrakker-version only
  118.         supports patterns with 64 rows (always 63 in this byte)
  119.  002    016    pattern-name (filled with [32])
  120.  018  <trklar>  tracksequencing-list
  121.         <trklar> = 2 * number of channels in this pattern
  122.  
  123. The tracksequencing-lists descripe which track is used as which voice in the
  124. pattern. The first word in this list is the number of the track at voice 0.
  125. The second is track for voice 1 and so on...
  126. As every track is saved independend, it is possible to save some discspace by
  127. this methode: If the song contains equal tracks at several positions in
  128. the patterns, these double tracks will only saved one time.
  129. Track 0 is not saved and represents an empty track.
  130.  
  131. ┌────────────────────────────────────────────────────────────────────────────┐
  132. │                            The Trackdatas  (TR)                            │
  133. └────────────────────────────────────────────────────────────────────────────┘
  134.  
  135. Offset Lenght Description
  136.  
  137.  000    002     "TR"; trackdata-ID
  138.  002    004     blocklenght
  139.  006    002     number of tracks
  140.  008    ???     track-datablocks; every trackdatablock is stored in this way:
  141.         Ofs.000 Len.002         length of the trackdatas
  142.             002 <trackdatalen>  datas for this track
  143.  
  144. Every track consists of 1-256 notepositions and every notposition contains
  145. 6 bytes:
  146.  
  147. byte 0              - note-value; 1 = C-0, 2 = C#0,..., 120 = B-9,
  148.               0 = nothing (---), 255 = key off (^^^)
  149. byte 1              - sample-number; 1-255; 0 = nothing
  150. byte 2              - volume; 1-255; 0 = no volume change
  151. byte 3, low nibble  - number of the first effect-command
  152. byte 3, high nibble - number of the second effect-command (commands "g"-"l"
  153.               get the numbers 1-6)
  154. byte 4              - databyte for the first effect-command
  155. byte 5              - databyte for the second effect-command
  156.  
  157. Digitrakker stores the tracks in a packed way. The structure of this very
  158. effective (!!!) packformat is the following:
  159.  
  160.      bit 76543210
  161. byte 0 - xxxxxxyy
  162.  
  163. if yy = 00 -> <xxxxxx>+1 is the number of the empty notepositions which are
  164.           following.
  165. if yy = 01 -> the last noteposition will be repeated <xxxxxx>+1 times.
  166. if yy = 10 -> the noteslot from position <xxxxxx> is copied to the actual
  167.           position.
  168. if yy = 11 -> the following datas will be put in the actual noteslot:
  169.         bit 2 = 1 -> note
  170.         bit 3 = 1 -> sample
  171.         bit 4 = 1 -> volume
  172.         bit 5 = 1 -> effectcommand numbers
  173.         bit 6 = 1 -> databyte for effect 1
  174.         bit 7 = 1 -> databyte for effect 2
  175.  
  176. To find out the number of notepositions in a track you should decrease a
  177. counter (startvalue: length of the packed trackdatas) while depacking.
  178. Every depacked track has to be filled out with 0-values up to position 256.
  179. When you copy the track into a pattern just take the number of positions you
  180. need for the pattern (if the pattern has a length of 64 positions only take
  181. the first 64 positions from the track).
  182.  
  183. ┌────────────────────────────────────────────────────────────────────────────┐
  184. │                           The Instruments (II)                             │
  185. └────────────────────────────────────────────────────────────────────────────┘
  186.  
  187. Offset Lenght Description
  188.  
  189.  000    002     "II"; intrument-ID
  190.  002    004     blocklenght
  191.  006    001     number of saved instruments; values from 0 to 255 are possible
  192.  007  <inslar>  the datablocks for all used instruments
  193.  
  194. The structure of one instrument-datablock:
  195.  
  196.  000    001     instrument-number; (1-255)
  197.  001    001    number of samples in instrument; (1-16)
  198.  001    032     instrument-name; the name of the instrument (filled with [32])
  199.  033  <is-len>  this block contains the infos for all defined samples in the
  200.         instrument; every info consist of 14 bytes, so
  201.         <is-len> = 14 * number of defined samples
  202.  
  203. The structure of one instrument-sample datablock:
  204.  
  205.  000    001     sample-number; (1-255)
  206.  001    001     playrange-end (0-119,0='c-0'); the last note for this sample;
  207.         a higher note uses one of the next samples
  208.  002    001     volume (1-255)
  209.  003    001     bit 0-5 -> volumeenvelope-number (0-63)
  210.         bit 6   -> flag, if volume is used
  211.         bit 7   -> flag, if volumeenvelope is used
  212.  004    001     panning (0-127)
  213.  005    001     bit 0-5 -> panningenvelope-number (0-63)
  214.         bit 6   -> flag, if panning is used
  215.         bit 7   -> flag, if panningenvelope is used
  216.  006    002     fadeout-speed (0-65535)
  217.  008    001     vibrator-speed (0-255)
  218.  009    001     vibrator-depth (0-255)
  219.  010    001     vibrator-sweep (0-255)
  220.  011    001     vibrator-form (0-2)
  221.  012    002     ** reserved ** (should be set to <0>)
  222.  
  223. ┌────────────────────────────────────────────────────────────────────────────┐
  224. │                         The Volume-Envelopes  (VE)                         │
  225. └────────────────────────────────────────────────────────────────────────────┘
  226.  
  227. Offset Lenght Description
  228.  
  229.  000    002     "VE"; volume-envelope-ID
  230.  002    004     blocklenght
  231.  006    001     number of saved vol-envelopes (0-64)
  232.  007  <ve-lar>  volume-envelope datas; a datablock contains 33 bytes, so
  233.         <ve-lar> = 33 * number of saved vol-envelopes;
  234.  
  235. The structure of one envelope-datablock:
  236.  
  237.  000    001     envelope-number; (0-63)
  238.  001    030     the positions of the 15 points are stored here; the first
  239.         byte is the x-distance from the last point (1-255; 0 means,
  240.         that no more points are defined; take 1 for the first point),
  241.                 the second byte is the y-position (0-63)
  242.  031    001     bit 0-3 -> sustain-point (0-14)
  243.         bit 4   -> flag, if sustain is on
  244.         bit 5   -> flag, if loop is on
  245.                 bit 6-7 -> ** reserved ** (should be set to <0>)
  246.  032    001     bit 0-3 -> loop-start (0-14)
  247.         bit 4-7 -> loop-end (0-14)
  248.  
  249. ┌────────────────────────────────────────────────────────────────────────────┐
  250. │                         The Panning-Envelopes (PE)                         │
  251. └────────────────────────────────────────────────────────────────────────────┘
  252.  
  253. Offset Lenght Description
  254.  
  255.  000    002     "PE"; panning-envelope-ID
  256.  002    004     blocklenght
  257.  006    001     number of saved pan-envelopes (0-64)
  258.  007  <pe-lar>  panning-envelope datas; a datablock contains 33 bytes, so
  259.         <pe-lar> = 33 * number of saved pan-envelopes
  260.         see at "VE" for the description of an envelope-datablock
  261.  
  262. ┌────────────────────────────────────────────────────────────────────────────┐
  263. │                        The Frequency-Envelopes (FE)                        │
  264. └────────────────────────────────────────────────────────────────────────────┘
  265.  
  266. Offset Lenght Description
  267.  
  268.  000    002     "FE"; frequency-envelope-ID
  269.  002    004     blocklenght
  270.  006    001     number of saved frq-envelopes (0-64)
  271.  007  <fe-lar>  frequency-envelope datas; a datablock contains 33 bytes, so
  272.                 <fe-lar> = 33 * number of saved frq-envelopes
  273.         see at "VE" for the description of an envelope-datablock
  274.  
  275. ┌────────────────────────────────────────────────────────────────────────────┐
  276. │                         The Sample-Infoblocks (IS)                         │
  277. └────────────────────────────────────────────────────────────────────────────┘
  278.  
  279. Offset Lenght Description
  280.  
  281.  000    002     "IS"; sampleinfo-ID
  282.  002    004     blocklenght
  283.  006    001     number of saved samples; values from 0 to 255 are possible
  284.  007  <samlar>  sample-infoblocks; a infoblock for one sample contains 59
  285.                 bytes, so <samlar> = 59 * number of saved samples
  286.  
  287. The structure of one sample-infoblock:
  288.  
  289.  000    001     sample-number; (1-255)
  290.  001    032     sample-name; the name of the sample (filled with [32])
  291.  033    008     filename of the sample
  292.  041    004     C-4 sample-frequency in hz
  293.  045    004     sample-length
  294.  049    004     sample-repeatstart
  295.  053    004     sample-repeatlength; if this value is set to 0, the sample
  296.         will not loop
  297.  057    001     ** not used ** (this was the volume in old v0.0-modules)
  298.  058    001     infobyte:
  299.         bit 0   -> 0=8 bit sample, 1=16 bit sample
  300.         bit 1   -> 0=forward looping, 1=bidirectional looping
  301.                 bit 2,3 -> packmethode (0=not packed, 1=8bit packing,
  302.                            2=16bit packing, 3=not defined)
  303.                 bit 4-7 -> ** reserved ** (should be set to <0>)
  304.  
  305. ┌────────────────────────────────────────────────────────────────────────────┐
  306. │                            The Sampledatas (SA)                            │
  307. └────────────────────────────────────────────────────────────────────────────┘
  308.  
  309. Offset Lenght Description
  310.  
  311.  000    002     "SA"; sampledata-ID
  312.  002    004     blocklenght
  313.  006    ???     sampledatas; samples are stored in numeric sequence
  314.  
  315. Unpacked samples are stored in signed form. Packmethode (1) is designed for
  316. 8 bit samples, Packmethode (2) for 16 bit samples. Methode (3) isn't defined
  317. in this version.
  318. A packed sample begins with a dword which contains the length of the
  319. following datastream.
  320.  
  321.  
  322. The description of the sample-packmethode (1) [8bit packing]:...
  323. ────────────────────────────────────────────────────────────────
  324.  
  325. This methode is based on the huffman-algorithm. It's an easy form, but very
  326. fast and effective on samples. The packed sample is a bit-datastream:
  327.  
  328.     Byte 0    Byte 1    Byte 2    Byte 3
  329. Bit 76543210  fedcba98  nmlkjihg  ....rqpo
  330.  
  331. A packed byte is stored in the following form:
  332.  
  333. xxxx10..0s => byte = <xxxx> + (number of <0>-bits between s and 1) * 16 - 8 ;
  334.           if s=1 then byte = byte xor 255
  335.  
  336. If there are no <0>-bits between the first bit (sign) and the <1>-bit, you
  337. have the following form:
  338.  
  339. xxx1s      => byte = <xxx> ; if s=1 then byte = byte xor 255
  340.  
  341. To depack one byte, you have to use the following algorithm:
  342. ┌────────────────────────────────────────────────────────────────────────────┐
  343. │       read bit                                                             │
  344. │       sign = bit                                                           │
  345. │       read bit                                                             │
  346. │       if bit = 1                                                           │
  347. │               then  read [3bits]                                           │
  348. │                     byte = [3bits]                                         │
  349. │                     goto next                                              │
  350. │               else  byte = 8                                               │
  351. │loop:  read bit                                                             │
  352. │       if bit = 0                                                           │
  353. │               then  byte = byte + 16                                       │
  354. │                     goto loop                                              │
  355. │               else  read [4bits]                                           │
  356. │                     byte = byte + [4bits]                                  │
  357. │next:   if sign = 1                                                         │
  358. │               then byte = byte xor 255                                     │
  359. └────────────────────────────────────────────────────────────────────────────┘
  360.  
  361. Two examples:
  362.  
  363. xxxx  s
  364. 1001101 = ( 9 + 1 * 16 - 8 ) xor 255 = 238
  365.  
  366. xxx s
  367. 01010 = 2
  368.  
  369. Note that the depacked bytes are delta values. To convert them to real data
  370. use this algorithm:
  371.  
  372. oldbyte = 0
  373. for sampleposition = 1 to samplelength
  374.     newbyte = byte [sampleposition] + oldbyte
  375.     byte [sampleposition] = newbyte
  376.     oldbyte = newbyte
  377. next sampleposition
  378.  
  379.  
  380. The description of the sample-packmethode (2) [16bit packing]:...
  381. ────────────────────────────────────────────────────────────────
  382.  
  383. This works as methode (1) but it only crunches every 2nd byte (the high-
  384. bytes of 16 bit samples). So when you depack 16 bit samples, you have to
  385. read 8 bits from the data-stream first. They present the lowbyte of the
  386. sample-word. Then depack the highbyte in the descripted way (methode [1]).
  387. Only the highbytes are delta-values. So take the lowbytes as they are.
  388. Go on this way for the whole sample!
  389.  
  390.  
  391. ┌────────────────────────────────────────────────────────────────────────────┐
  392. │                    ** Differences to older formats **                      │
  393. └────────────────────────────────────────────────────────────────────────────┘
  394.  
  395. Changes from v0.0 to v1.0:
  396. - block "PN" (patternnames) doesn't exist in v1.0-modules (patternnames now
  397.   stored in block "PA")
  398.   the old v0.0 structure of the "PN"-block:
  399.     000    002     "PN"; patternnames-ID
  400.     002    004     blocklenght
  401.     006  <patnam>  the names for every pattern (16 chars for one name).
  402.            <patnam> = 16 * <number of patterns>
  403. - structure of block "PA" changes completely
  404.   the old v0.0 structure of the "PA"-block:
  405.     000    002     "PA"; patterndata-ID
  406.     002    004     blocklenght
  407.     006    001     number of pattern; values from 1 to 255 are possible
  408.     007  <patlar>  tracksequencing-list for the used patterns;
  409.            <patlar> = 64 * number of patterns (32 words with the
  410.            tracknumbers for every pattern)
  411. - new blocks in v1.0-modules: "II" (instruments), "VE" (volume-envelopes) and
  412.   "PE" (panning-envelopes)
  413. - volumebyte (byte 57) in the sample-datablocks (block "IS") isn't used;
  414.   the C-4 sample-frequency increases from a word (2 bytes) to a dword (4
  415.   bytes), so one whole sample-infoblock has a length of 59 bytes
  416.  
  417. Extension from v1.0 to v1.1:
  418. - new block: "FE" (frequency-envelopes)
  419.  
  420.  
  421.  
  422.  
  423. ╔════════════════════════════════════════════════════════════════════════════╗
  424. ║                        THE INSTRUMENT-FORMAT  (IST)                   V0.1 ║
  425. ╚════════════════════════════════════════════════════════════════════════════╝
  426.  
  427. The IST-format has the same structure like the MDL-format:
  428.  
  429. Offset Lenght Description
  430.  
  431.  000    004     "DIST"; the four letters mark the ist-format
  432.  004    001     version; the current version is 01h (=0.1)
  433.  005    ???     the different data-blocks are stored at this position
  434.  
  435. The IST-instrument-format is subdivided into the following blocks:
  436.  
  437. "II"    instruments; contains all information for the saved instrument
  438. "VE"    volume-envelopes; contains the construction of all vol-envelopes for
  439.         this instrument
  440. "PE"    panning-envelopes; the same for the pan-envelopes
  441. "FE"    frequency-envelopes (new in v0.1); the same for the frq-envelopes
  442. "IS"    sampleinfos; contains information for every used sample
  443. "SA"    samples; contains the sample-datas
  444.  
  445. The structures for the several blocks are the same as in the mdl-format.
  446. The instrument-infoblock ("II") contains one instrument only.
  447.  
  448.  
  449.  
  450.  
  451. ╔════════════════════════════════════════════════════════════════════════════╗
  452. ║                          THE SAMPLE-FORMAT  (SPL)                     V0.0 ║
  453. ╚════════════════════════════════════════════════════════════════════════════╝
  454.  
  455. Here comes the description for the old sample-format "SPL", which was used in
  456. older tracker-versions (V2.0-V2.2). This format isn't supported any longer in
  457. Digitrakker, that means you can read it, but you can't save samples in this
  458. form.
  459. The reason for this step was the fact, that there are too many sample-formats
  460. and it makes no sense to introduce a new one, because the existing IFF-format
  461. nearly contains all infos you need for a Digitrakker-sample.
  462.  
  463. Offset Lenght Description
  464.  
  465.  000    004     "DSPL"; the four letters mark the spl-format
  466.  004    001     version; the current version is 0
  467.  005    032     sample-name; the name of the sample (filled with [32])
  468.  037    008     filename of the sample
  469.  045    002     C-4 sample-frequency in hz (00000-65535)
  470.  047    004     sample-length
  471.  051    004     sample-repeatstart
  472.  055    004     sample-repeatlength; if this value is set to 0, the sample
  473.         will not loop
  474.  059    001     sample-volume (1-255)
  475.  060    001     infobyte:
  476.         bit 0   -> 0=8 bit sample, 1=16 bit sample
  477.         bit 1   -> 0=forward looping, 1=bidirectional looping
  478.         bit 2,3 -> packmethode (0=not packed, methodes 2 and 3 doesn't
  479.                exist in this version)
  480.         bit 4-7 -> not used (should be set to 0)
  481.  061    ???     sampledatas... (see above)
  482.