home *** CD-ROM | disk | FTP | other *** search
/ Collection of Hack-Phreak Scene Programs / cleanhpvac.zip / cleanhpvac / FAQSYS18.ZIP / FAQS.DAT / EMD_FORM.TXT < prev    next >
Internet Message Format  |  1995-10-13  |  14KB

  1. From: husberg@proffa.cc.tut.fi (Husberg Fredrik)
  2. Newsgroups: alt.binaries.sounds.utilities
  3. Subject: Re: Playemd: newest version & EMD module format specs
  4. Date: 24 Aug 1994 14:14:53 GMT
  5. Organization: Tampere University of Technology, Computing Centre
  6.  
  7. Dirk / ELASTIK                     
  8. husberg@proffa.cc.tut.fi
  9.  
  10. =====================================================================
  11.     EMD module/song format for (A)dvanced 16-(B)it (T)racker ABT  
  12. =====================================================================
  13.                                                 Last update 14.8.1994 
  14.  
  15.  
  16. ---------------------------------------------------------------------
  17. Note!
  18.         This is NOT the final version of the EMD-module format. There
  19. will be some minor changes in the near future (like new features) but 
  20. they are always placed to those <reserved> entries and that is the 
  21. reason why they are not going to affect playing of these old EMDs 
  22. with future versions of ABT. This file has been written in hurry and
  23. because of that there may be some mistakes in this file. If you have
  24. questions concerning EMD or ABT please contact: 
  25.  
  26.                         Dirk/Elastik
  27.                         
  28.                         Internet:
  29.                         husberg@lehtori.cc.tut.fi
  30.                         husberg@proffa.cc.tut.fi
  31.                         
  32.                         Snailmail:
  33.                         Koulutie 10
  34.                         SF-36200 Kangasala
  35.                         Finland
  36. ---------------------------------------------------------------------
  37.  
  38.         What is EMD? It's new sample based sound/music module format.
  39. The letters E,M and D come from the words Extended MOD. EMD-module format 
  40. is much like the normal MOD but with new features and it's designed to be
  41. used with the ABT, Advanced 16Bit Tracker made by Kari Visala and Mikko
  42. Blomqvist. Here is the short description of the current EMD format, which
  43. should help you to use EMDs freely in your own projects.
  44. PLEASE, NO MODIFICATIONS
  45.  
  46.  
  47. -------------------
  48. EMD-file structure:
  49. -------------------
  50.  
  51.  
  52. OFFSET 0  Header:
  53. =================
  54. size       description
  55. --------------------------------------------------------------------------
  56. 4  bytes   'EMOD' , these four bytes are used to identify an EMD-file
  57. 1  byte    Version number of the module   4 high order bits = major version
  58.                                           4 low order bits  = minor version
  59.            for example version 1.0  ->  00010000b
  60. 8  bytes   <reserved>  (for later use..)
  61.  
  62.  
  63.  
  64. OFFSET 13  Module-info part:
  65. ============================
  66. size       description
  67. --------------------------------------------------------------------------
  68. 32 bytes   Name of the song (32 chars, no any ending chracters) IBM-ascii
  69. 1  byte    Number of the instruments 
  70. 2  bytes   Length of the pattern list
  71. 1  byte    Number of the patterns-1 (0 = there is only 1 pattern) 
  72. 32 bytes   Values of the pan positions of the channels in the beginning of
  73.            the song. (0-full left, 15-full right) byte/channel
  74. 2  bytes   Starting tempo, default=125 bpm
  75.            bpm = beats per minute (8 rows in pattern = 1 beat)
  76. 1  byte    0 = module 
  77.            1 = song ( no sample wave-data stored to this file)
  78. 1  byte    0 = normal patterns 
  79.            1 = packed patterns :-)  
  80. 1  byte    Number of channels (1..32)
  81. 1  byte    This byte is only for modules:
  82.            
  83.            0 = Samples are stored in normal 16-bit signed format (like WAV)
  84.            1 = Samples are in coded format 
  85.            Coding of the samples:
  86.            This next process has been done to every single byte of sample
  87.            raw data when module is saved: (so, if you want to uncode samples, 
  88.            do the steps backwards)
  89.                    1. step      first and last bit of byte changed
  90.                    2. step      neg
  91.            Here is the code I use to uncode these:
  92.                         mov al,[byte of sample data]
  93.                         mov bl,al
  94.                         and bl,10000000b
  95.                         shr bl,7
  96.                         mov bh,al
  97.                         and bh,00000001b
  98.                         shl bh,7
  99.                         and al,01111110b
  100.                         add al,bl
  101.                         add al,bh  
  102.                         mov [sample data],al  ; uncoded byte saved
  103.            The reason for coding those samples was that we didn't want
  104.            that everyone would be able to rip our 16 bit samples straight
  105.            from our asm'94 compo-modules, but I thought that this file 
  106.            format description should be complete and so I included uncoding
  107.            info. This feature won't have any future use.
  108.  
  109. 9  bytes   <reserved>
  110.  
  111.  
  112.  
  113.  
  114. OFFSET 96  Sample info part:
  115. ============================
  116. This part of the file contains all settings and info for the samples.
  117. Sample wave-data is not here. One sample takes 250 bytes of space and 
  118. they are saved to the module consecutive. So, the size of this part
  119. is number of instruments * 250 bytes
  120.  
  121. size       description
  122. --------------------------------------------------------------------------
  123. 1  byte    Number of the instrument in pattern data (1-99)
  124. 4  bytes   Length of the sample in bytes 
  125. 32 bytes   Name of the sample (no any ending characters) IBM-ascii
  126. 12 bytes   File name of the sample (used with song files) 
  127.            format: XXXXXXXX.XXX
  128. 72 bytes   Breakpoint information:  ( 18*4 bytes )
  129.            18 breakpoints:
  130.                  4 bytes = Offset from the beginning of the sample in words
  131.                            So, if sample is 50000 bytes long, then 25000 in     
  132.                            breakpoints is the end of the sample.
  133.            2 consecutive breakpoints = 1 loop (9 loops)
  134. 9 bytes    Directions of the loops
  135.            1 byte/loop :    0 = no loop
  136.                             1 = forward loop
  137.                             2 = bi-directional loop
  138. 1  byte    Active loop of the sample in the beginning of the song :
  139.                 0    = no loop on (default)
  140.                 1..9 = loop #
  141. 108 bytes  ADSR values (9 different ADSR for each instrument) (9*12 bytes)
  142.            1 ADSR value:
  143.                4 bytes   offset(place) of the decay point
  144.                4 bytes   offset(place) of the sustain point
  145.                1 byte    Attack value ( always in the start of the sample)
  146.                1 byte    Decay value
  147.                1 byte    Sustain value
  148.                1 byte    Release value ( always in the end of the sample)
  149.            ADSR control for samples isn't used by ABT in any way.
  150.            Only the space is reserved for these values. It is very likely
  151.            that ABT will never use this feature in the future because of
  152.            the limitations of the module-style music and these bytes could
  153.            be replaced by some other data.
  154. 1  byte    Active ADSR number 1-9  (0= no ADSR)
  155. 2  bytes   overall volume of the sample in the beginning of the song
  156.            value from 0 to 4095.
  157. 1  byte    finetune+128  ( Default=128, player converts this value to a
  158.            signed byte, -128..127:   0  =  normal finetune. 
  159.                                     -64 =  halfnote downwards
  160.                                      64 =  halfnote upwards
  161. 1  byte    midi on/off,   0  = normal GUS sample
  162.                           1  = midi instrument
  163. 1  byte    midi channel+1,  0...16 
  164.                   0 -> none, 
  165.                   1 -> channel 0, ... , 16 -> channel 15
  166. 1  byte    midi preset instrument number   
  167.            0 -> no preset instrument choosed from the ABT,
  168.                 note is played on synthesizer with choosed instrument
  169. 1  byte    Direct load on/off
  170.            1 = instrument is loaded directly to gusdram
  171.            0 = instrument only in EMS in the start of the song
  172. 3  bytes   <reserved>
  173.  
  174.  
  175.  
  176. OFFSET 96+250*inst#  Pattern list:
  177. ==================================
  178. Here is the play order of patterns. Length of this part is in the
  179. module info part. One pattern takes 1 byte of memory and because of
  180. that song can only contain 255 different patterns. Numbers of the patterns
  181. are stored here so that the first byte is the number of the first played 
  182. pattern and so on...
  183.  
  184.  
  185.  
  186. OFFSET 96+250*inst#+pattlstsize   Patterns:
  187. ===========================================
  188. This part of the file contains all data for the patterns.
  189. Patterns are stored here so that the first pattern here is
  190. the pattern marked with 0 in the patternlist, second is pattern 1 and so on.
  191. Size of a pattern is 13+channel#*pattern_length*5 bytes.
  192.  
  193. size       description
  194. --------------------------------------------------------------------------
  195. 8  bytes   Name of the pattern in IBM-ascii format with no ending character
  196. 1  byte    Length of the pattern (how many rows, default=64)
  197. 4  bytes   <reserved>
  198.  
  199. Here is some kind of pseudo-code presenting the way ABT stores patterns to
  200. EMD file:
  201.  
  202. for y=1 to pattern_length
  203.   for x=1 to #channels 
  204.     1 byte  Note = 0..255, 0   = no note, 
  205.                            1   = C-1 and so on...
  206.                            If pattern-packing is enabled in the moduleinfo
  207.                            part:
  208.                            255 = because note,sample#,effect and params would
  209.                                  all be zeros, program saves only one byte
  210.                                  here (255) and those other 4 bytes aren't
  211.                                  saved.
  212.  
  213.     1 byte  Number of the sample, 0=empty instrument, only stops playing sample
  214.     1 byte  Effect command 1-99,  0 = no effect
  215.     1 byte  Parameter 1 for the effect
  216.     1 byte  Parameter 2 for the effect
  217.   next x
  218. next y
  219.  
  220.  
  221.  
  222. OFFSET XXXX   Channel volumes:
  223. ==============================
  224. Here are the beginning volumes for each channel.
  225. One volume takes one byte, which is from 0 to 255 (default=255,max) 
  226. and 32 channels are always stored. So, the size of this part is 
  227. always 32 bytes.
  228.  
  229.  
  230.  
  231.  
  232. OFFSET XXXX   Raw wave data of samples:
  233. =======================================
  234. Only modules have this part of an EMD-file, in songs there is no sample raw
  235. data. All samples are stored here without any marks between them.
  236. Samples are stored so that the first sample here has the smallest number.
  237. All data is signed 16-bit, which is same as 16-bit wav files.
  238. Sample data can also be in coded format (read the module-info part).
  239.  
  240. End of EMD-file.
  241.  
  242.  
  243.  
  244.  
  245.  
  246. ========================================================================
  247. Currently supported effect commands of ABT:
  248. ========================================================================
  249. There will be more effect commands in the near future, but here are all 
  250. the basic commands for ABT, which are already ready (midi efx-commands
  251. aren't here yet) :
  252.  
  253. Effect command is a number between 1 and 99. One effect can have maximum
  254. 2 parameters, both 0-99, or one parameter from 0 to 9999 (par1*100+par2).
  255.  
  256.  
  257. Efx#      Description and parameters
  258. ----------------------------------------------------------------------------
  259.     1     Set volume 0-4095 (values is exponential)
  260.    11     Set linear volume 0-511
  261.     3     Set tempo 0-???? (beats per minute, 125=default, 8 rows = beat)
  262.     5     Set pan-value for a channel:  param1=channel#(0-31),
  263.               if param1>31 , then current channel (where the efx-command is) 
  264.               will be used for effect.
  265.               param2=pan-value from 0(left)-15(right)
  266.    17     Break pattern:  This efx-command jumps to the selected row of 
  267.               next pattern in the song. (next row after efx isn't played)
  268.               param1=row# of next pattern
  269.    18     Position jump:  Changes the song position and the row# played next.
  270.               param1=which pattern in pattern list (0=first)
  271.               param2=which row
  272.     2     Volume slide:   param1&2=new volume (0-4095) (slide is exponential)
  273.    82     Set length of a volume slide: param1=how many rows volume slide 
  274.               will take if tempo isn't changed. (0 is also 1 row)
  275.               This variable is independent for each of the channels.
  276.     6     Pitch up: param1=How many halfnotes upward, 
  277.               param2=length of bend in rows with current tempo (0 is same as 1)
  278.     7     Pitch down: Same as pitch up, but downwards
  279.    13     Load&remove sample from gusdram:
  280.               param1=number of the instrument to be loaded throught DMA
  281.               (0=no sample loaded)
  282.               param2=which instrument is unloaded from the gusdram
  283.               (0=no instrument unloaded)
  284.    22     Set frequency: If this efx-command is on the same row with note,
  285.               note isn't played, but only frequency of currently playing 
  286.               sample is changed to the given note.
  287.    15     Effect channel play: Plays unloaded sample from EMS throught DMA.
  288.               ( This efx-command isn't used yet)
  289.    84     Set Vibrato waveform: param1: 0=sine, 1=saw, 2=sqr, 3=ramp down
  290.     4     Vibrato: param1=Depth 0-99 (63=halfnote to both directions)
  291.               param2=speed of the vibrato 0-99: (param2/5)Hz  1/5Hz - 20Hz
  292.    34     Vibrato off
  293.    19     Arpeggio: middle note = basenote+param1*halfnote
  294.                     high note   = basenote+param2*halfnote
  295.               Major :   190407        Minor :   190307
  296.    89     Set speed of the arpeggio param1=how many notes played during 
  297.               one row of pattern. (default=3, the whole chord played on 
  298.               every row of pattern) (0 is same as 3)
  299.     9     Tremolo (always sine) param1=depth/4 -> Volume can varies from 0 to
  300.           400 in both directions. param2=speed of tremolo(same as vibrato)
  301.    38     Tremolo off
  302.    24     Note delay: param1:delay 0-99, "100"=next row
  303.  
  304. Note: All the effects that control the frequency of the sound can be used
  305.       simultaneously with effects that control the volume.
  306.