FamiTracker instrument file format. This document is created through analysis
of the FT 0.4.6 source code, in order to support this format in the FTplug.

There is a few format versions, the latest one is 2.4, it is the only one
documented here.



Common header for all instrument types:

6 - signature FTI2.4
1 - instrument type (0..6, none/2A03/VRC6/VRC7/FDS/N163/S5B)
4 - name length in bytes
N - instrument name up to the name length bytes (not a null-terminated string)



2A03 and VRC6 specific body (stores a normal instrument):

1 - sequence count (fixed to 5)

 five sequence blocks follows:

1 - 0 or 1, sequence enabled or disabled; if 0, next sequence block follows immediately
4 - sequence length in bytes (X items)
4 - loop point, -1 (ff ff ff ff) if no loop point set
4 - release point, -1 if no release point set
4 - settings (not clear what it is, normally 0)
X - sequence items as signed byte values



2A03 specific part (each file also contains full DPCM setup):

4 - number of keys assigned to DPCM samples

 for each of 8*12 keys that has a DPCM sample assigned:
 
1 - key number (octave*12+semitone)
1 - sample index
1 - sample pitch
1 - sample delta value

 after that:
 
4 - number of samples

 for each sample:
 
4 - sample index
4 - sample name length
N - sample name
4 - sample data size in bytes
X - sample data
