home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Sound / Tracker / Protracker3.61.lha / Install-Protracker / ProTracker / DOCS / PT-Fileformat_3.61.doc < prev    next >
Encoding:
Text File  |  1996-08-18  |  17.4 KB  |  322 lines

  1.              Fileformat Introducion for Protracker 3.59
  2.  
  3.  
  4. Introduction.
  5. =============
  6.  
  7. The text below was intended to be the documentation on the  fileformat  used  in
  8. this release of ProTracker.
  9.  
  10. Four  years  before Tom Bech from Cryptoburners has started an new scetch for an
  11. standart protracker format who was better to handle. Now, I'm not perfect, but I
  12. have  restarted this plan and release with beginning of PT3.59 an ProTracker who
  13. is able to load  and  save  the  standart  format  as  well  as  the  redesigned
  14. Protracker IFFMODL format.
  15.  
  16. It was in this phase not too difficult to rewrite an player in less than 1  hour
  17. if  you  wont use the new features because the fact, that in the music chunk can
  18. the ordinary old module format, and the new pattern format is not used since  an
  19. 8-channel Protracker is released.
  20.  
  21. The advance of the new format are:
  22.  
  23. - very easy identification of protracker mods
  24. - all relevant parameters of an soundmodule inside of the music file
  25.   (Timing method, Filter flags, types, IRQ's, lengths etc)
  26. - automatic playtime calculation with saving inside the musicfiles
  27.   (very easy handling for advanced modplayers, i have scanned 500 files in less
  28.   than 2 minutes and as result an complete musiclist witrh authors, timing ...)
  29. - dynamic hunk structure. i was able to advance most of the playerstructure,
  30.   and old replayers are working, they are using only the old features
  31. - for the near future it was able to improve Protracker to more than 4 channels
  32.   and removing the rigid patterndesign, using unlimited size and number of
  33.    samples, using more 16 bit formats (VOC, WAVE) ...
  34.   All we have to do is to use an new chunk for the fileformat an live
  35.   peaceful with the older files.
  36. - the user is able to change the save formats in setup, recognize by loading
  37.   automatic
  38. - All relevant parameters (master speed, VBI/CIA timing, master volume ...)
  39.   are setted automatic by loading an module in Protracker.
  40.  
  41.  
  42.  
  43.                     -**-
  44.  
  45. Protracker release 3.59 Fileformat documentation.
  46. =================================================
  47.  
  48. This document includes the complete documentation  of  the  fileformat  used  in
  49. Protracker  3.59,  and instructions on how to use it. Fields marked "*Reserved*"
  50. are reserved for future use and are guarantied to cause hangup if messed with.
  51.  
  52. General
  53. -------
  54.  
  55. With this release of Protracker we have decided to change the  filestructure  of
  56. the  musicfiles  produced  with  the  program.  We  felt  the old format was too
  57. obsolete, messy and out of date for us to use any further. So we  invented  this
  58. new  format.  The  format  is  based upon Interchanged File Format (IFF) chunks,
  59. originally developed by Electronic Arts, but now in widely use on the Amiga. The
  60. format  allows  considerable  flexibility  and  does not suffer too severly from
  61. changes and updates, and is therefore perfect for our use.
  62.  
  63. The Format
  64. ----------
  65.  
  66. We will in this section introduce and describe each chunk type  appearing  in  a
  67. Protracker music file. Look in the next section for the sequencial description.
  68.  
  69. ** Contents of Chunk "VERS":
  70.  
  71. OFFSET          Length          Contents        Meaning
  72. --------------------------------------------------------------------------------
  73.  0               4              "VERS"          Chunk identifier.
  74.  4               4              ????????        Chunk length (in bytes).
  75.  8               4              ????????        Version number (word). of musicfile
  76. 12               6              "PT3.59"        Version ID string.
  77. --------------------------------------------------------------------------------
  78.  
  79. This chunk is used by Protracker to identify the producer of the module, and  if
  80. necessary  perform  upgrade-conversion  if  the  file  was  made with a previous
  81. version of Protracker. There can be at maximum one "VERS" chunk in a  Protracker
  82. music  file. This chunk is not critical; it may be obmitted, but be aware of the
  83. possible incompatibility problems that may arise if it's left out.
  84.  
  85. ** Contents of Chunk "INFO":
  86.  
  87. OFFSET          Length          Contents        Meaning
  88. --------------------------------------------------------------------------------
  89.  0               4              "INFO"          Chunk identifier.
  90.  4               4              ????????        Chunk length (in bytes).
  91.  8              32              [..??..]        Song name (string).
  92. 40               2              ????????        Number of instruments (word).
  93. 42               2              ????????        Number of positions (word).
  94. 44               2              ????????        Number of patterns (word).
  95. 46               2              ????????        Overall volume factor (word).
  96. 48               2              007Dh           Default speed (BPM) (word).
  97. 50               2              ????????        Packed field. See below.
  98. 52               2              hexvalue        Creationdate (day) of File
  99. 54               2              hexvalue        Creationdate (month) of File
  100. 56               2              hexvalue        Creationdate (year) of File
  101. 58               2              hexvalue        Creationtime (hours)
  102. 60               2              hexvalue        Creationtime (minutes)
  103. 62               2              hexvalue        Creationtime (seconds)
  104. 64               2              hexvalue        Playtime of mod (hours)
  105. 66               2              hexvalue        Playtime of mod (minutes)
  106. 68               2              hexvalue        Playtime of mod (seconds)
  107. 70               2              hexvalue        Playtime of mod (mseconds)
  108. --------------------------------------------------------------------------------
  109.  
  110. Protracker uses this chunk to set different internal  variables,  and  to  store
  111. vital  information used in replay and processing of the file. The song name is a
  112. maximum 32 Chars long ASCII string. It need not be  NULL-terminated.  Number  of
  113. instruments  indicates  the number of instruments used in the song, it may range
  114. from 0 to 65535. At present version number, however, there may  be  maximum  255
  115. instruments  in  one song. Number of positions reflects the actual length of the
  116. song, that is; how many patterns that will be played during  a  complete  cycle.
  117. This  number  may  vary  from 0 to 65535. Number of patterns, on the other side,
  118. reflects how many _different_ patterns that will be played during the song. This
  119. number is used to calculate the total length (in bytes) of the song. The Overall
  120. Volume factor is used to compute the final volume  of  all  channels  after  the
  121. individual  channel-volumes  have  been  figured  out. In this way it is easy to
  122. control the loudness of the music from the program/ song itself.  Default  speed
  123. is  the  BPM  (Beats  per  minute)  flag of the module and if not changed by the
  124. composer as default by #125.
  125. The packed field consists of these  bits  (right  to  left order):
  126.  
  127. ---------------- packetfield meaning    -------------
  128. ;Bit    Meaning         0                       1                        Default
  129. ;--------------------------------------------------------------------------------
  130. ; 0     Timing method.  VBlank.                 CIA timing (BPM).             0
  131. ; 1     Filter flag.    Filter off.             Filter on.                    0
  132. ; 2     File type.      Module.                 Song (no instruments).        0
  133. ; 3     Soft IRQ        on/off                                                0
  134. ; 4     Length flag.    Equal pattern length.   Variable pattern length.      0
  135. ; 5     Voices flag.    4 voices.               8 voices.                     0
  136. ; 6     Sample res.     8 bit.                  16 bit.                       0
  137. ; 7     Packstatus.     Packed patterns.        Raw patterns.                 1
  138. ; 8     *Reserved*                                                            x
  139. ; 9     *Reserved*                                                            x
  140. ;10     *Reserved*                                                            x
  141. ;11     *Reserved*                                                            x
  142. ;12     *Reserved*                                                            x
  143. ;13     *Reserved*                                                            x
  144. ;14     *Reserved*                                                            x
  145. ;15     *Reserved*                                                            x
  146. ;--------------------------------------------------------------------------------
  147.  
  148. There can be at most one "INFO" chunk in a Protracker musicfile. This chunk is
  149. vital; it _must_ be present for the replay routine to function properly.
  150.  
  151. ** Contents of Chunk "INST":
  152.  
  153. OFFSET          Length          Contents        Meaning
  154. --------------------------------------------------------------------------------
  155.  0               4              "INST"          Chunk identifier.
  156.  4               4              ????????        Chunk length (in bytes).
  157.  8              32              [..??..]        Instrument name (string).
  158. 40               2              ????????        Length of instrument (word).
  159. 42               2              ????????        Instrument loop start (word).
  160. 44               2              ????????        Instrument loop length (word).
  161. 46               2              ????????        Instrument volume (word).
  162. 48               2              ????????        Instrument finetuning (integer).
  163. --------------------------------------------------------------------------------
  164.  
  165.  
  166.  
  167. ** Contents of Chunk "CMNT":
  168.  
  169. OFFSET          Length          Contents        Meaning
  170. --------------------------------------------------------------------------------
  171.  0               4              "CMNT"          Chunk identifier.
  172.  4               4              ????????        Chunk length (in bytes).
  173.  8               ?              [..??..]        Raw ASCII text.
  174. --------------------------------------------------------------------------------
  175.  
  176. The "CMNT"  chunk  is  used  for  a  signature,  comments,  greetings,  date  of
  177. completion  or  whatever  information the composer wishes to include with his or
  178. hers creation. This chunks is  not  critical;  it  may  be  left  out  and  will
  179. typically be ignored by most applications.
  180.  
  181. The sequential format
  182. ---------------------
  183.  
  184. In this section we will describe how the  various  chunks  are  expected  to  be
  185. located  within  the file. These rules _must_ be followed or it will wreak havoc
  186. when tried manipulated with inside Protracker. Here comes the header in
  187. table form:
  188.  
  189. OFFSET          Length          Contents        Meaning
  190. --------------------------------------------------------------------------------
  191.   0              4              "FORM"          Indicate start of IFF file.
  192.   4              4              ????????        File length.
  193.   8              4              "MODL"          IFF type identifier.
  194. -------------------------------------------------------------------------------
  195.  
  196. This header must be found in the start of the file, or it will be rejected as
  197. not being a Protracker musicfile. From offset 12 in the file, things may vary
  198. somewhat.
  199.  
  200. ** Contents of Chunk "PTDT":
  201.  
  202. OFFSET          Length          Contents        Meaning
  203. --------------------------------------------------------------------------------
  204.  0               4              "PTDT"          Chunk identifier.
  205.  4               4              ????????        Chunk length (in bytes).
  206.  8               ?              [..??..]        Protracker MOD Format.
  207. --------------------------------------------------------------------------------
  208.  
  209. At offset 8 begins, if saved in 4-channel-mode, the old ordinary Protracker
  210. MOD file. Length are calculated by saving by offset 4, so you can check correct
  211. values. If you write an simple replayer you have to scan in the file at the
  212. begin of the PTDT chunk and calculate the end with chunklength due the fact
  213. that other chunks can follow. (multiple soundmodules, combinations of
  214. multichannel songs ...)
  215.  
  216.  
  217. Chunk summary
  218. -------------
  219.  
  220. Now follows a list of the chunks that have meaning in a Protracker musicfile:
  221.  
  222. Chunk     Function                                                    Critical?
  223. -------------------------------------------------------------------------------
  224. "VERS"    Contains information about the producer of the file.               No
  225. "INFO"    Contains vital information and standard settings.                 Yes
  226. "CMNT"    Comments, greetings etc. Contains information in ASCII code.       No
  227. "PTDT"    This chunk contains the pure old Protracker stuff. if you rewrite
  228.       your software in the simplest way you scan for the begin of the
  229.       PTDT chunk and you have an old Protracker file. But remember:
  230.       The PTDT chunk is obselete in the near future if Protracker 4.0
  231.       with more than 4 channels is available, so your software should
  232.       be able to ignore this chunk.
  233. -------------------------------------------------------------------------------
  234.  
  235.  
  236.  
  237.  
  238. ----------------------- Future implementation planings ----------------------
  239.  
  240.  
  241. The follow implementations are not finnished because a lack of time, but you
  242. should look below for see the near future:
  243.  
  244. ** Contents of Chunk "INST":
  245.  
  246. OFFSET          Length          Contents        Meaning
  247. --------------------------------------------------------------------------------
  248.  0               4              "INST"          Chunk identifier.
  249.  4               4              ????????        Chunk length (in bytes).
  250.  8              32              [..??..]        Instrument name (string).
  251. 40               2              ????????        Length of instrument (word).
  252. 42               2              ????????        Instrument loop start (word).
  253. 44               2              ????????        Instrument loop length (word).
  254. 46               2              ????????        Instrument volume (word).
  255. 48               2              ????????        Instrument finetuning (integer).
  256. --------------------------------------------------------------------------------
  257.  
  258. The "INST" chunk is used to store information about an  instruments  properties,
  259. such  as length and volume. The instrument name is a maximum 32 Chars long ASCII
  260. string. It need not be NULL-terminated. The Length field describes the length of
  261. the  instrument  (in  words)  and  thus  ranges  from  0 to 128Kb (65535 words).
  262. Instrument Loop Start sets the offset from which  to  start  playing  after  the
  263. first  replay.  This  value may vary from 0 to the instrument length. Instrument
  264. Loop End sets the length of the loop to play after the first replay, relative to
  265. the  loop  start  value.  It  may  thus  vary  from  0  to [Ins_len-Loop_start].
  266. Instrument volume indicates which volume to use in the replay of the sample,  if
  267. the  song  doesn't  say  differently.  This  value  varies  between  0  and 40h.
  268. Instrument finetuning sets the sample-rate correction difference and varies from
  269. -7 to 7 (0fff9 to 0007h).
  270. There may be any number of "INST" chunks in a Protracker music file, limited  to
  271. the number of instruments actually used in the song. This chunk is not vital; it
  272. may be left out if the song-only bit of the control word in the "INFO" chunk  is
  273. set. Otherwise, it should result in an error.
  274.  
  275. ** Contents of Chunk "PPOS":
  276.  
  277. OFFSET          Length          Contents        Meaning
  278. --------------------------------------------------------------------------------
  279.  0               4              "PPOS"          Chunk identifier.
  280.  4               4              0ffh            Chunk length (in bytes).
  281.  8             256              [..??..]        Pattern position table.
  282. --------------------------------------------------------------------------------
  283.  
  284. This chunk contains the  table  defining  which  pattern  to  play  in  a  given
  285. songposition.  Each  entry  in  the  table is a byte indicating which out of 256
  286. possible patterns to play. There may  be  at  maximum  one  "PPOS"  chunk  in  a
  287. Protracker  musicfile.  This  chunk  is  vital; it _must_ be present to play the
  288. song.
  289.  
  290. ** Contents of Chunk "PTRN":
  291.  
  292. OFFSET          Length          Contents        Meaning
  293. --------------------------------------------------------------------------------
  294.  0               4              "PTRN"          Chunk identifier.
  295.  4               4              ????????        Chunk length (in bytes).
  296.  8              32              [..??..]        Pattern name.
  297. 40               ?              [..??..]        Pattern data.
  298. --------------------------------------------------------------------------------
  299.  
  300. This chunk is used in a module of variable pattern length. The chunk  must  thus
  301. appear as many times as there are patterns in the song. The chunk length divided
  302. by 8 ( >>3 ) will show the pattern length (default 64). Pattern  name  is  a  32
  303. byte  long ASCII string, describing the pattern, eg. "Intro part 3". It need not
  304. be NULL-terminated. This chunk is critical; it must be present in the  file,  or
  305. it  will  be  regarded  invalid.  NOTE:  This chunk is not in use in the present
  306. version (3.01B), and will be ignored if found.
  307.  
  308. ** Contents of Chunk "SMPL":
  309.  
  310. OFFSET          Length          Contents        Meaning
  311. --------------------------------------------------------------------------------
  312.  0               4              "SMPL"          Chunk identifier.
  313.  4               4              ????????        Chunk length (!in bytes!).
  314.  8               ?              [..??..]        Raw sample data.
  315. --------------------------------------------------------------------------------
  316.  
  317. The "SMPL" chunk contains the raw sample data of an instrument.  This  chunk  is
  318. not  critical;  if  the  song-only  bit  of  the  "INFO" chunk is set, it may be
  319. obmitted. If, however, the file is a module, then the number of "SMPL" chunks in
  320. the  file must be equal to or greater than the number of instruments used in the
  321. song. If not, the file will be regarded incomplete.
  322.