Protracker Module

From MultimediaWiki
Revision as of 22:41, 20 January 2010 by GreaseMonkey (talk | contribs) (still working on this thing, i need some food)
Jump to navigation Jump to search
  • Extension: mod

Originally a 15-sample format, it was used in Ultimate SoundTracker for the Amiga. Since then, it has been used in NoiseTracker and ProTracker, which both use the 31-sample "M.K." version, as well as many other programs on many other platforms; for example, FastTracker 2 for MS-DOS on the PC, which can handle even numbers of channels from 4 to 32.

File Format

The format is big-endian (most significant byte first). A "byte" is 8 bits, and a "word" is 16 bits. Hex values will be denoted with a $ sign.

Amiga limits for periods are 113 <= x <= 856. The lower the period, the higher the pitch.

  • 20 bytes: Module name, padded with NULs.
  • 31 samples (or 15 if we're dealing with a SoundTracker file):
    • 22 bytes: Sample name, padded with NULs.
    • Word: Length of sample in words - multiply by 2 to get length in bytes.
    • Byte: Finetune value ranging from $00 to $0F as a signed nybble. $01 is 1/8 of a semitone up, $0F is 1/8 of a semitone down, $08 is 8/8 of a semitone down (that is, a whole semitone). Periods should be clamped to within Amiga limits.
    • Byte: Default volume of sample ranging from 0 to 64 ($00 to $40).
    • Word: Loop start in words.
    • Word: Loop length in words. If set to 1, don't loop. Allegedly, a value of 0 will crash an Amiga.
  • Byte: Order list length.
  • Byte: Traditionally $78 in SoundTracker. Was used in NoiseTracker as a restart point. ProTracker uses $7F. FastTracker uses it as a restart point, whereas ScreamTracker 3 uses $7F like ProTracker. You can use this to roughly detect which tracker made a MOD, and detection gets more accurate for more obscure MOD types.
  • 128 bytes: Order list. Only the first order list length orders are actually used when playing; however, we scan the WHOLE order list to find out what the highest-indexed pattern is, and that's how many patterns we load.
  • 4 bytes (31-sample version only): Sample tag. If this contains any non-ASCII ($20 to $7E (32 to 126) inclusive) characters, then we probably loaded a 15-sample MOD. The best way to detect this is to seek to this position (it's $438 / 1080) and check before you actually load any data (may not work for streams where you can't seek). Otherwise, it's probably a 31-sample MOD. Values include:
    • M.K. - standard 4-channel, 64-pattern-max MOD.
    • M!K! - ProTracker will write this if there's more than 64 patterns,
    • 6CHN, 8CHN - 6-channel and 8-channel MODs, respectively. These are common extensions, and many trackers will write these. Basically, you read like a 4 channel mod, but with 6 or 8 channels per row.
    • CD81, OKTA, OCTA - other 8-channel MOD tags. First two are probably Oktalyzer for the Atari ST, the third is possibly OctaMED.
    • xxCH - a 10+ channel MOD, xx being a decimal number. FastTracker will deal with these as long as x is an even number no greater than 32.
    • xxCN - another 10+ channel MOD, xx being a decimal number. Allegedly TakeTracker writes these.
    • TDZ1, TDZ2, TDZ3 - allegedly this is a TakeTracker extension for 1, 2, and 3 channels respectively.
    • 5CHN, 7CHN, 9CHN - allegedly this is a TakeTracker extension for 5, 7, and 8 channels respectively.
    • FLT4 - StarTrekker 4-channel MOD.
    • FLT8 - StarTrekker 8-channel MOD. Load patterns in like a normal 4-channel MOD, and then play two patterns at the same time (e.g. if 8 appears on the order list, play patterns 8 and 9). You'd probably be best to merge the patterns together if you want to be consistent.
    • M&K! - only sighted on echobea3.mod. This is just a standard MOD, but with a weird tag. I cannot find the tracker it's referring to ("fleg's module train-er"), so it was probably only used once or something, and never released.

under construction

  • Signed 8-bit mono sample data.

Playback notes

Amiga base clock is roughly 70ns, yielding an audio base clock of 280ns.

When a looped sample is played, the whole sample plays through once, and then, if it has a loop, the loop is repeated.

Optimisation tips

Try unrolling your sample loops. 2500 bytes of padding should be fine if you're operating within Amiga limits; otherwise, you'll want (largest frequency

under construction