File format of MusDump files
============================

*******************************************************
* Offset * Bytes * Description                        *
*******************************************************
*    0   *    4  * "MDMP" -file type identifier       *
*    4   *    4  * Total size of uncompressed data    *
*    8   *    4  * Number of channels                 *
*   12   *    4  * Number of patterns                 *
*   16   *    4  * Length of sequence table           *
*   20   *    8  * Stereo settings, signed 8-bit      *
*   28   *   32  * Name of music file                 *
*   60   *   32  * Name of music author               *
*   92   *    ?  * Sequence table, compressed (LZW)   *
*    ?   *    ?  * Pattern data, compressed           *
*    ?   *    ?  * Sample attributes, compressed      *
*    ?   *    ?  * Sample data, compressed            *
*******************************************************


The uncompressed sequence table is simply a table, !16 bytes long, with each
byte containing the pattern (0 to 63 currently) to play at that position.


Each pattern is compressed separately. The uncompressed format is as
follows, for each of the 64 events per pattern:
 Event 0 channel 1 -4 bytes
 Event 0 channel 2 -4 bytes
 ..
 Event 0 channel n -4 bytes
 Event 1 channel 1 -4 bytes
 ..
where n is the number of channels (!8).
Each channel's data is as follows:
 Byte 3:Note number, 0-36
 Byte 2:Sample number, 0-36
 Byte 1:Effect value
 Byte 0:Effect number, 0-15
The upper limit given for the sample and effect numbers is not binding; they
may increase in future.


The sample attributes are for 36 samples, with 36 bytes describing each:
  Bytes 0-3 : Sample length, in bytes
  Bytes 4-7 : Repeat offset
 Bytes 8-11 : Repeat length
    Byte 12 : Volume, 0 (off) to 127 (loudest)
    Byte 13 : Fine tune value (signed 8-bit)
Bytes 14-35 : Sample name, padded with zero bytes


The sample data is stored as the differences between the bytes of the
original data as it was when it was in linear format.


The compression routine used is a slightly modified version of the LZW
algorithm, with the first four bytes of each compressed chunk holding the
file offset of the end of the following chunk.
