Ci-dessous, les différences entre deux révisions de la page.
| Les deux révisions précédentesRévision précédente | |||
| back2root:ibm-pc-ms-dos:xm [2023/05/21 00:44] – supprimée - modification externe (Date inconnue) 127.0.0.1 | back2root:ibm-pc-ms-dos:xm [2023/05/21 00:44] (Version actuelle) – ↷ Page déplacée de back2root:archives:xm à back2root:ibm-pc-ms-dos:xm frater | ||
|---|---|---|---|
| Ligne 1: | Ligne 1: | ||
| + | ====== XM Module format ====== | ||
| + | |||
| + | <WRAP round box> | ||
| + | The XM module format description for XM files version $0104. | ||
| + | |||
| + | By Mr.H of Triton in 1994. | ||
| + | |||
| + | - Be prepared! Are you sure you want to know? :-) | ||
| + | |||
| + | </ | ||
| + | |||
| + | ===== The XM file structure ===== | ||
| + | {{tablelayout? | ||
| + | ^ Offset | ||
| + | | 0 | ||
| + | | 17 | 20 | (char) | ||
| + | | 37 | 1 | ||
| + | | 38 | 20 | (char) | ||
| + | | 58 | 2 | ||
| + | | 60 | 4 | ||
| + | | +4 | 2 | ||
| + | | +6 | 2 | ||
| + | | +8 | 2 | ||
| + | | +10 | ||
| + | | +12 | ||
| + | | +14 | ||
| + | | +16 | ||
| + | | +18 | ||
| + | | +20 | ||
| + | ===== Patterns ===== | ||
| + | {{tablelayout? | ||
| + | ^ Offset | ||
| + | | ? | 4 | (dword) | ||
| + | | +4 | 1 | ||
| + | | +5 | 2 | ||
| + | | +7 | 2 | ||
| + | | ? | ||
| + | |||
| + | |||
| + | ===== Instruments: | ||
| + | {{tablelayout? | ||
| + | ^ Offset | ||
| + | | ? | ||
| + | | +4 | 22 | (char) | ||
| + | | +26 | ||
| + | | +27 | ||
| + | |||
| + | If the number of samples > 0, then the this will follow: | ||
| + | {{tablelayout? | ||
| + | ^ Offset | ||
| + | | +29 | ||
| + | | +33 | ||
| + | | +129 | 48 | ||
| + | | +177 | 48 | ||
| + | | +225 | 1 | (byte) | ||
| + | | +226 | 1 | (byte) | ||
| + | | +227 | 1 | (byte) | ||
| + | | +228 | 1 | (byte) | ||
| + | | +229 | 1 | (byte) | ||
| + | | +230 | 1 | (byte) | ||
| + | | +231 | 1 | (byte) | ||
| + | | +232 | 1 | (byte) | ||
| + | | +233 | 1 | (byte) | ||
| + | | +234 | 1 | (byte) | ||
| + | | +235 | 1 | (byte) | ||
| + | | +236 | 1 | (byte) | ||
| + | | +237 | 1 | (byte) | ||
| + | | +238 | 1 | (byte) | ||
| + | | +239 | 2 | (word) | ||
| + | | +241 | 2 | (word) | ||
| + | ===== Sample headers ===== | ||
| + | |||
| + | ^ Offset | ||
| + | | ? | ||
| + | | | ||
| + | | | ||
| + | | +12 | ||
| + | | +13 | ||
| + | | +14 | ||
| + | | +15 | ||
| + | | +16 | ||
| + | | +17 | ||
| + | | +18 | ||
| + | |||
| + | __Sample data:__ | ||
| + | {{tablelayout? | ||
| + | ^ Offset | ||
| + | | ? | ? | ||
| + | |||
| + | <code pascal> | ||
| + | old=0; | ||
| + | for i=1 to len | ||
| + | new=sample[i]+old; | ||
| + | sample[i]=new; | ||
| + | old=new; | ||
| + | </ | ||
| + | ===== Pattern format ===== | ||
| + | |||
| + | The patterns are stored as ordinary MOD patterns, except that each note is stored as 5 bytes: | ||
| + | {{tablelayout? | ||
| + | ^ Offset | ||
| + | | ? | ||
| + | | +1 | 1 | ||
| + | | +2 | 1 | ||
| + | | +3 | 1 | ||
| + | | +4 | 1 | ||
| + | |||
| + | A simple packing scheme is also adopted, so that the patterns not become TOO large: Since the MSB in the note value is never used, if is used for the compression. | ||
| + | |||
| + | If the bit is set, then the other bits are interpreted as follows: | ||
| + | |||
| + | |||
| + | ^ bit ^ description | ||
| + | | | ||
| + | | | ||
| + | | | ||
| + | | | ||
| + | | | ||
| + | |||
| + | It is very simple, but far from optimal. If you want a better, you can always repack the patterns in your loader. | ||
| + | |||
| + | ===== Volumes and envelopes ===== | ||
| + | |||
| + | ==== The volume formula ==== | ||
| + | |||
| + | <WRAP round box> | ||
| + | |||
| + | <m 13> | ||
| + | |||
| + | </ | ||
| + | |||
| + | |||
| + | |||
| + | |||
| + | ==== The panning formula: ==== | ||
| + | |||
| + | <WRAP round box> | ||
| + | |||
| + | <m 13> | ||
| + | |||
| + | </ | ||
| + | |||
| + | |||
| + | ==== Envelope ==== | ||
| + | |||
| + | The envelopes are processed once per frame, instead of every frame where no new notes are read. | ||
| + | |||
| + | This is also true for the instrument vibrato and the fadeout. Since I am so lazy and the tracker is rather self-explaining I am not going to write any more for the moment. | ||
| + | |||
| + | ===== Periods and frequencies ===== | ||
| + | |||
| + | <WRAP round box> | ||
| + | <m 13> | ||
| + | |||
| + | <color # | ||
| + | |||
| + | <m 13> | ||
| + | |||
| + | <color # | ||
| + | |||
| + | <m 13> | ||
| + | |||
| + | <color # | ||
| + | |||
| + | <m 13> | ||
| + | |||
| + | <color # | ||
| + | </ | ||
| + | ==== Linear frequence table ==== | ||
| + | |||
| + | <code pascal> | ||
| + | Period = 10*12*16*4 - Note*16*4 - FineTune/2; | ||
| + | Frequency = 8363*2^((6*12*16*4 - Period) / (12*16*4)); | ||
| + | </ | ||
| + | |||
| + | ==== Amiga frequence table: ==== | ||
| + | |||
| + | <code pascal> | ||
| + | Period = (PeriodTab[(Note MOD 12)*8 + FineTune/ | ||
| + | </ | ||
| + | |||
| + | (The period is interpolated for finer finetune values) | ||
| + | |||
| + | <code pascal> | ||
| + | Frequency = 8363*1712/ | ||
| + | |||
| + | PeriodTab = Array[0..12*8-1] of Word = ( | ||
| + | 907, | ||
| + | 808, | ||
| + | 720, | ||
| + | 640, | ||
| + | 570, | ||
| + | 508, | ||
| + | </ | ||
| + | |||
| + | ====== Standard effects ====== | ||
| + | {{tablelayout? | ||
| + | ^ Code ^ Note ^ Description | ||
| + | | 0 | ||
| + | | 1 | ||
| + | | 2 | ||
| + | | 3 | ||
| + | | 4 | ||
| + | | 5 | ||
| + | | 6 | ||
| + | | 7 | ||
| + | | 8 | ||
| + | | 9 | ||
| + | | A | ||
| + | | B | ||
| + | | C | ||
| + | | D | ||
| + | | E1 | (*) | Fine porta up | | ||
| + | | E2 | (*) | Fine porta down | | ||
| + | | E3 | | Set gliss control | ||
| + | | E4 | | Set vibrato control | ||
| + | | E5 | | Set finetune | ||
| + | | E6 | | Set loop begin/ | ||
| + | | E7 | | Set tremolo control | ||
| + | | E9 | | Retrig note | | ||
| + | | EA | (*) | Fine volume slide up | | ||
| + | | EB | (*) | Fine volume slide down | | ||
| + | | EC | | Note cut | | ||
| + | | ED | | Note delay | | ||
| + | | EE | | Pattern delay | | ||
| + | | F | ||
| + | | G | ||
| + | | H | ||
| + | | K | ||
| + | | L | ||
| + | | P | ||
| + | | R | ||
| + | | T | ||
| + | | X1 | (*) | Extra fine porta up | | ||
| + | | X2 | (*) | Extra fine porta down | | ||
| + | |||
| + | (*) = If the command byte is zero, the last nonzero byte for the command should be used. | ||
| + | |||
| + | ====== Effects in volume column ====== | ||
| + | |||
| + | All effects in the volume column should work as the standard effects. | ||
| + | The volume column is interpreted before the standard effects, so some standard effects may override volume column effects. | ||
| + | {{tablelayout? | ||
| + | ^ Value ^ Meaning | ||
| + | | 0 | Do nothing | ||
| + | | $10-$50 | ||
| + | | : | : : | | ||
| + | | $60-$6f | ||
| + | | $70-$7f | ||
| + | | $80-$8f | ||
| + | | $90-$9f | ||
| + | | $a0-$af | ||
| + | | $b0-$bf | ||
| + | | $c0-$cf | ||
| + | | $d0-$df | ||
| + | | $e0-$ef | ||
| + | | $f0-$ff | ||
| + | |||
| + | <WRAP round info> | ||
| + | This should be just about everything (I hope?). You will probably need | ||
| + | some information about the MOD format and maybe about S3M. | ||
| + | |||
| + | Have fun! | ||
| + | |||
| + | Fredrik Huss / Mr.H of Triton | ||
| + | </ | ||
| + | |||