The .MOD Fileformat
-------------------

There are two different versions of the modules - a 15 voice and a 31
voice. The two formats are not compatible, and there are hundreds of
mutant versions. I have chosen to support a version that is called
NoiseTracker 2.0 by M. & K. This is compatible with most 31 voice
versions.

LET'S LOOK AT IT
----------------

The module file is build this way :

typedef struct
     { char mod_name[20];
       INST insts[31];  /* or 15 if a old module                */
       char info[2];    /* info about repeat and nr of patterns */
       char seq[128];   /* the sequence table for the patterns  */
       long id = 'M.K.' /* tells that this is a 31 voice module.*/
       PATT patts[n];
       char insts[m];   /* the samples for each instrument.     */
     } MOD_FILE

An Instrument is declared in a 30 byte descriptor (why not 32??):

typedef struct
     { char name[22];
       UWORD length;  /* offset to image of next instrument */
       UWORD volume;
       UWORD transient_p;
       UWORD loop_p;
     } INST

Each entry in pattern hold information to all 4 channels. The
information for each channel is held in one 32 bit word. (each entry
is then 16 bytes long). The information have been put in entry this
way:

    +          +        +         +        +
    xxx-i-xx-ffffffffff-iiii-cccc-pppppppp *
        |         |        |    |      \______ parameter to command
        |         |        |    \_____________ command
        |         |        \__________________ instrument (lsb's)
        |         \___________________________ frequency (0-$400)
        \_____________________________________ msb of instrument nr.
   - the bits in a pattern entry.


typedef long PAT_ENT; /* look about */

typedef struct
     { PAT_ENT chanl0; /* NO way to make independent tracks! */
       PAT_ENT chanl1;
       PAT_ENT chanl2;
       PAT_ENT chanl3;
     } PATT;

This is the reason I think that we should find a new format. I have a
simple text based music language in mind. I should be possible to
make small loops, for easy and trouble free rhythm tracks. And it
should be possible to convert modules to this (more general)
"language"...


