-
Notifications
You must be signed in to change notification settings - Fork 25
Dn‐FamiTracker module file format specification (.dnm) v4.50
- This text aims to document the binary module file format as of Dn-FamiTracker v0.5.0.1.
- Each section is declared sequentially as it appears in the file.
- Unless specified otherwise, all data is stored in little-endian format.
- Strings are stored in ASCII encoding unless specified otherwise.
-
char
- Signed 8-bit integer. Used for storing bit flags, strings, and other misc. data.
-
unsigned int
- Unsigned 32-bit integer. Seems to be only used in
HEADER
?
- Unsigned 32-bit integer. Seems to be only used in
-
int
- Signed 32-bit integer. Used for storing numerical data.
-
CInstrument
- CInstrument class object.
Data type |
Unit size (bytes) |
Object name |
Typical values |
Description |
Notes |
---|---|---|---|---|---|
char[256] |
Non-padded length of char[] string |
|
|
Identifier string |
In Dn-FT v0.5.0.0, this was changed to |
unsigned int |
4 |
|
0x00000450 |
Module version |
Version number is formatted as BCD (ex. 4.50) |
- Information is based on
DocumentFile.cpp CDocumentFile::BeginDocument()
andFamiTrackerDoc.cpp CFamiTrackerDoc::SaveDocument()
- Modules saved in Dn-FamiTracker v0.5.0.0 and later may save modules with
FILE_HEADER_ID_DN
identifiers, to prevent older FamiTracker versions from reading non-backwards compatible data such asFILE_BLOCK_JSON
andFILE_BLOCK_PARAMS_EMU
.
Each block has a 24-byte header consisting of a block ID, block version, and block size.
Data type |
Unit size (bytes) |
Object name |
Typical values |
Description |
Notes |
---|---|---|---|---|---|
char[16] |
16 |
|
|
Identifier string |
Length is zero-padded to 16 bytes |
int |
4 |
|
0x00000006 |
Block version |
Block version number is ANDed with 0xFFFF, but is still written as 32-bit signed integer |
int |
4 |
|
0x1D000000 |
Block size, not counting the block header |
Block ID: PARAMS
Data type |
Unit size (bytes) |
Repeat |
Object name |
Typical values |
Description |
Notes |
Present in block version |
---|---|---|---|---|---|---|---|
int |
4 |
|
6 |
Song speed of track 0 |
1 |
||
char |
1 |
|
0x00 |
Expansion audio bitmask |
Same format as expansion audio bitmask found in the NSF format |
2+ |
|
int |
4 |
|
5 |
Number of channels added |
Includes the 5 channels from 2A03. |
1+ |
|
int |
4 |
|
0 |
NTSC or PAL |
1+ |
||
int |
4 |
|
0 |
Playback rate type, 0 = default, 1 = custom, 2 = video |
7+ |
||
int |
4 |
|
16639 |
NSF playback rate, in microseconds |
7+ |
||
int |
4 |
|
60 |
Engine refresh rate, in Hz |
1-6 |
||
int |
4 |
|
1 |
0 = old style, 1 = new style |
3+ |
||
int |
4 |
? |
1 |
Hardware sweep pitch reset |
Not implemented? Vanilla 0.5b stuff. Probably boolean type. |
7+ |
|
int |
4 |
|
4 |
1st row highlight |
3-6 |
||
int |
4 |
|
16 |
2nd row highlight |
3-6 |
||
int |
4 |
|
8 |
Number of N163 channels used |
Only written/read when N163 is enabled. |
5+ |
|
int |
4 |
|
32 |
Fxx speed/tempo split-point |
6+ |
||
char |
1 |
|
0 |
Semitone detuning, range from -12 to 12 |
Moved to Tuning block in FT 050B 2020. Also in Extra Parameters block. |
8 |
|
char |
1 |
|
0 |
Cent detuning, range from -100 to 100 |
Moved to Tuning block in FT 050B 2020. Also in Extra Parameters block. |
8 |
- Information is based on
CFamiTrackerDoc::WriteBlock_Parameters()
Block ID: INFO
Data type |
Unit size (bytes) |
Repeat |
Object name |
Typical values |
Description |
Notes |
Present in block version |
---|---|---|---|---|---|---|---|
char[32] |
32 |
|
|
Module name |
Length is zero-padded to 32 bytes |
1+ |
|
char[32] |
32 |
|
|
Module artist |
Length is zero-padded to 32 bytes |
1+ |
|
char[32] |
32 |
|
|
Module copyright |
Length is zero-padded to 32 bytes |
1+ |
- Information is based on
CFamiTrackerDoc::WriteBlock_SongInfo()
Block ID: TUNING
Data type |
Unit size (bytes) |
Repeat |
Object name |
Typical values |
Description |
Notes |
Present in block version |
---|---|---|---|---|---|---|---|
char |
1 |
|
0 |
Semitone detuning, range from -12 to 12 |
Also in Extra Parameters block. |
1+ |
|
char |
1 |
|
0 |
Cent detuning, range from -100 to 100 |
Also in Extra Parameters block. |
1+ |
- Information is based on
CFamiTrackerDoc::WriteBlock_Tuning()
- Added in FamiTracker 0.5.0 beta 2020
Block ID: HEADER
Data type |
Unit size (bytes) |
Repeat |
Object name |
Typical values |
Description |
Notes |
Present in block version |
---|---|---|---|---|---|---|---|
char |
1 |
|
0x06 |
Number of tracks added. |
Stores track count - 1. (i.e. |
2+ |
|
char[] |
Length of zero-terminated char[] string |
Per number of tracks added ( |
|
|
Names of each track |
Each track name is zero terminated, and therefore delineated by a byte of 0. |
3+ |
char |
1 |
Per number of channels added ( |
|
|
Channel ID ( |
1+ |
|
char[] |
Number of tracks added ( |
|
{0x01, 0x02, 0x02, 0x01, 0x01, 0x01, 0x00} |
Number of additional effect columns on a given channel, per track |
On version 1, this was restricted to the first track. |
1+ |
- Information is based on
CFamiTrackerDoc::WriteBlock_Header()
Block ID: INSTRUMENTS
Data type |
Unit size (bytes) |
Repeat |
Object name |
Typical values |
Description |
Notes |
Present in block version |
---|---|---|---|---|---|---|---|
int |
4 |
|
23 |
Instrument count |
Count of existing instruments |
1+ |
|
int |
4 |
Per instrument |
Instrument index |
0 to |
Instrument index |
1+ |
|
char |
1 |
|
0x01 |
Instrument type |
1+ |
||
CInstrument |
size of CInstrument object |
|
(CInstrument object) |
Instrument definition |
See tables below for instrument definitions |
1+ |
|
int |
4 |
|
10 |
Instrument name length |
1+ |
||
char[] |
Instrument name length |
|
|
Instrument name |
1+ |
- If FDS is used then version must be at least 4 or recent files won't load
- v6 adds DPCM delta settings
- This block is only written if any instruments exist
Data type |
Unit size (bytes) |
Repeat |
Object name |
Typical values |
Description |
Notes |
Present in block version |
---|---|---|---|---|---|---|---|
int |
4 |
|
|
Sequence count |
Number of defined sequence types. Volume, Arpeggio, Pitch, Hi-Pitch, Duty cycle |
1+ |
|
char |
1 |
Per sequence count |
|
1 |
0 = sequence is disabled, 1 = sequence is enabled |
1+ |
|
char |
1 |
|
2 |
Sequence index |
1+ |
- This format is shared between 2A03, VRC6, N163, and S5B instruments.
- In 0CC-FamiTracker and its forks, this format was converted into a subclass of
CInstrument
,CSeqInstrument
to deduplicate code.
Instrument type value: 0x01
Data type |
Unit size (bytes) |
Repeat |
Object name |
Typical values |
Description |
Notes |
Present in block version |
---|---|---|---|---|---|---|---|
int |
4 |
|
|
Sequence count |
Volume, Arpeggio, Pitch, Hi-Pitch, Duty / Noise |
1+ |
|
char |
1 |
Per sequence count |
|
1 |
0 = sequence is disabled, 1 = sequence is enabled |
1+ |
|
char |
1 |
|
2 |
Sequence index |
1+ |
||
int |
4 |
|
5 |
DPCM sample count |
7+ |
||
char |
1 |
Per note |
|
0 to |
DPCM sample assignment note index |
Written only when a sample exists at that note. |
7+ |
char |
1 |
|
0x00 |
DPCM sample assignment index |
Written only when a sample exists at that note in version 7+. |
1+ |
|
char |
1 |
|
0x00 |
DPCM sample pitch of a given note |
Written only when a sample exists at that note in version 7+. |
1+ |
|
char |
1 |
|
0xFF |
DPCM delta offset of a given note |
Written only when a sample exists at that note in version 7+. |
6+ |
- Information is based on
CInstrument2A03::Store()
- Only 72 notes are defined in version 1. Version 2+ has all 96 notes defined.
- In version 7, the DPCM format has been changed to only count notes with DPCM assignments.
Instrument type value: 0x02
Data type |
Unit size (bytes) |
Repeat |
Object name |
Typical values |
Description |
Notes |
Present in block version |
---|---|---|---|---|---|---|---|
int |
4 |
|
5 |
Sequence count |
Volume, Arpeggio, Pitch, Hi-pitch, Pulse width. |
2+ |
|
char |
1 |
Per sequence count |
|
1 |
0 = sequence is disabled, 1 = sequence is enabled |
2+ |
|
char |
1 |
|
2 |
Sequence index |
2+ |
- Information is based on
CSeqInstrument::Store()
- Similar to 2A03 instruments but with no special considerations for DPCM
Instrument type value: 0x03
Data type |
Unit size (bytes) |
Repeat |
Name |
Typical values |
Description |
Notes |
Present in block version |
---|---|---|---|---|---|---|---|
int |
4 |
|
12 |
VRC7 patch number |
Hardware patch number of the instrument. |
2+ |
|
char[8] |
8 |
|
{0x01, 0x21, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x0F} |
Custom patch settings |
Patch settings of hardware patch 0. |
2+ |
- Information is based on
CInstrumentVRC7::Store()
Instrument type value: 0x04
Data type |
Unit size (bytes) |
Repeat |
Object name |
Typical values |
Description |
Notes |
Present in block version |
---|---|---|---|---|---|---|---|
char[64] |
64 |
|
<64 byte sequence of a waveform> |
Wave data |
3+ |
||
char[32] |
32 |
|
<32 byte sequence> |
Modulation table |
3+ |
||
int |
4 |
|
0 |
Instrument modulation rate |
3+ |
||
int |
4 |
|
0 |
Instrument modulation depth |
3+ |
||
int |
4 |
|
0 |
Instrument modulation delay |
3+ |
||
char |
1 |
Per sequence count |
|
Sequence length |
3+ |
||
int |
4 |
|
Sequence loop point |
3+ |
|||
int |
4 |
|
Sequence release point |
4+ |
|||
int |
4 |
|
Sequence setting type |
4+ |
|||
char[] |
Sequence length |
|
Sequence data |
3+ |
- Information is based on
CInstrumentFDS::Store()
- FDS instruments stores its own sequences via
CInstrumentFDS::StoreSequence()
, separate fromCSeqInstrument::Store()
- These sequences only store the first 3 types
Instrument type value: 0x05
Data type |
Unit size (bytes) |
Repeat |
Object name |
Typical values |
Description |
Notes |
Present in block version |
---|---|---|---|---|---|---|---|
int |
4 |
|
5 |
Sequence count |
Volume, Arpeggio, Pitch, Hi-pitch, Wave Index. |
2+ |
|
char |
1 |
Per sequence count |
|
1 |
0 = sequence is disabled, 1 = sequence is enabled |
2+ |
|
char |
1 |
|
2 |
Sequence index |
2+ |
||
int |
4 |
|
32 |
Wave data size |
2+ |
||
int |
4 |
|
0 |
Wave data RAM position |
Ignored if automatic wave data ram allocation is enabled |
2+ |
|
int |
4 |
|
0x00 / 0x01 |
Automatic wave data RAM allocation |
?+ |
||
int |
4 |
|
1 |
Wave count |
2+ |
||
char[] |
Wave data size |
Per wave count |
|
<byte sequence of wave data> |
Wave data |
2+ |
- Information is based on
CInstrumentN163::Store()
- Automatic wave data RAM allocation feature is from FT 0.5.0 beta
Instrument type value: 0x06
Data type |
Unit size (bytes) |
Repeat |
Object name |
Typical values |
Description |
Notes |
Present in block version |
int |
4 |
|
5 |
Sequence count |
Volume, Arpeggio, Pitch, Hi-pitch, Noise / Mode. |
2+ |
|
char |
1 |
Per sequence count |
|
1 |
0 = sequence is disabled, 1 = sequence is enabled |
2+ |
|
char |
1 |
|
2 |
Sequence index |
2+ |
- Information is based on
CSeqInstrument::Store()
- Similar to 2A03 instruments but with no special considerations for DPCM