Impulse tracker is a type of music tracker format that was created by Jeffery Lim in 1998. It was based off the scream tracker 3 format but added addition features such as instruments, 16-bit sample, stereo sample support and new note actions. Songs of this format are saved under the extension (.it)
Format[]
The impulse tracker is written in Little Endian byte order
The impulse tracker format is split into five main parts. these include
- Header
- Edit history
- MIDI macros
- Pattern names (OMPT only)
- Channel names (OMPT only)
- Plug-ins (OMPT only?)
- Message
- Instrument
- Envelope/s
- Sample Header
- Pattern data
- Sample Data
- Author (OMPT only)
Header:[]
Name | Length | Discription |
---|---|---|
Song name | 26 bytes
(including nulls) |
Name of song |
Pattern hilight | 2 bytes | Byte 1 is rows per beat
Byte 2 is rows per mesaure (Only used in editing) |
Order Number | 1 short
(2 bytes) |
Number of sequenced patterns in song |
Instrument Number | 1 short
(2 bytes) |
Number of instruments in song |
Sample Number | 1 short
(2 bytes) |
Number of samples in song |
Pattern Number | 1 short
(2 bytes) |
Number of patterns in song |
Created with tracker | 1 short
(2 bytes) |
ID of tracker that made this
(Impulse tracker is 1.0 to 2.17) encoded as hexadecimal so 1.0 becomes 0x0100 |
Compatible with tracker | 1 short
(2 bytes) |
1.0 to 2.17
(encoded as hexadecimal) |
Flags | 1 short
(2 bytes) |
Bit 8-15 are reserved (Bit 15 is extended filter range in Open MPT) |
Special | 1 short
(2 bytes) |
Bit 4-15 are reserved *Some versions of Schism tracker set this off even if there is embedded history. |
Global volume | 1 byte | Global volume of song (0-128) |
Mix volume | 1 byte | Mixing volume of song (0-128) |
Initial speed | 1 byte | Starting tick speed of song |
Initial tempo | 1 byte | Starting beats Per minute of song |
Pan separation | 1 byte | Panning separation between channels (0-128) |
Pitch wheel depth | 1 byte | Pitch wheel depth for MIDI controllers |
Message Length | 1 short
(2 bytes) |
Length of attached message |
Message offset | 1 int
(4 bytes) |
Offset of message in file |
Reserved | 4 bytes | Open MPT writes "OMPT" here if it is an interpreted
Mod Plug file |
Initial channel pan | 64 bytes | Each byte is a pan value (examples: 0 is left pan, 32 is center pan
and 64 is right pan) (0-64) |
Initial channel volume | 64 bytes | Each byte is a channel volume (0-64) |
Orders | Length is order
number |
0-199 are valid patterns,
254 is seperator and 255 is song end. |
Instrument offsets | Length is instrument
number * 4 |
Each offset is an integer offset to Instrument in file |
Sample Header offsets | Length is sample
number * 4 |
Each offset is an integer offset to sample header in file |
Pattern offsets | Length is pattern
number * 4 |
Each offset is an integer offset to pattern in file |
Edit history:[]
Name | Length | Discription |
---|---|---|
Edit History number | short
(2 bytes) |
Number of contained edit histories |
Edit histories | 8 bytes per history | Explained below |
Name | Length | Discription |
---|---|---|
Fat date | short
(2 bytes) |
Date of edit in Microsoft Fat date format |
Fat time | short
(2 bytes) |
Time of edit in Microsoft Fat date format |
Run time | int
(4 bytes) |
Runtime in MS-DOS ticks
(1/18.2 of a second) |
MIDI macros[]
There are three groups of MIDI macros an IT file can contain. These are only present if either bit 7 of flags or bit 3 of special flags are on.
- 9 Global (9 * 32 bytes)
- 16 Parametric and (16 * 32 bytes)
- 128 Fixed (128 * 32 bytes)
Name | Length | Discription |
---|---|---|
Macro String | 32 byte | Holds 32 characters |
MIDI macros are a total of 4896 bytes long.
Pattern Names[]
Name | Size | Discription |
---|---|---|
Length | int
(4 bytes) |
Length of pattern names
(Name count is Length / 32) |
Pattern name | 32 bytes
per name |
Name of pattern |
Channel Names[]
Name | Size | Discription |
---|---|---|
Length | int
(4 bytes) |
Length of pattern names
(Name count is Length / 20) |
Channel name | 32 bytes
per name |
Name of channel |
Plug-ins[]
todo
Message[]
Name | Size | Discription |
---|---|---|
Message | defined in message length | The message string |
Messages usually use CR for line endings but Chibi Tracker uses LF instead.
Instruments[]
Pre 2.0 instrument[]
Name | Length | Discription |
---|---|---|
DOS fie name | 12 bytes
(including nulls) |
Name of DOS file |
Reserved | 1 byte | Reserved for future use |
Flags | 1 byte |
|
Volume loop start | 1 byte | Number of loop start node of envelope |
Volume loop end | 1 byte | Number of loop end node of envelope |
Sustain loop start | 1 byte | Number of sustain loop start node of envelope` |
Sustain loop end | 1 byte | Number of sustain loop end node of envelope |
Reserved | 2 bytes | Reserved for future use |
Fadeout | Short
2 bytes |
0-64 but the count is by 512 |
New note action | 1 byte |
|
Duplicate note check | 1 byte | 0 = false, 1 = true |
Tracker version | 2 bytes | Only used in instrument files |
Number of samples | 1 byte | Only used in instrument files |
Reserved | 1 byte | Reserved for future use |
Instrument name | 26 bytes
(including nulls) |
Name of instrument |
Reserved | 6 bytes | Reserved for future use |
Note Sample
Keyboard table |
240 bytes
(120 2-byte pairs) |
Byte 1 is note (0-119)
Byte 2 is sample |
Pre 2.0 envelopes[]
Volume envelopes | 200 bytes | The volume envelopes
(0-64) FF indicates end of envelope |
---|---|---|
Node points | 25 * 2 bytes | Byte 1 is tick
Byte 2 is magnitude |
Post 2.0 instrument[]
Name | Length | Discription |
---|---|---|
DOS fie name | 12 bytes
(including nulls) |
Name of DOS file |
Reserved | 1 byte | reserved for future use |
New Note Action | 1 byte |
|
Duplicate check
type |
1 byte |
|
Duplicate check
Action |
1 byte |
|
Fade out | (signed) short
(2 bytes) |
0-128 but the count
is 1024 |
Pitch pan seperation | 1 signed byte | -32 to 32 |
Pitch pan centre | 1 byte | note to centre pitch
pan on (0-119) |
Global volume | 1 byte | 0-128 |
Default pan | 1 byte | 0-64. if bit 128 is 1,
don't use. |
Random volume
variation |
1 byte | percentage (0-100) |
Random pan
variation |
1 byte | percentage (0-100) |
Tracker version | Short
(2 bytes) |
Tracker version save as
(only used in instruments files) |
Number of samples | 1 byte | Number of sample used
by this instrument (only used in instrument files) |
Reserved | 1 byte | Reserved for future use |
Instrument name | 26 bytes
(including nulls) |
The name of the instrument |
Initial filter cutoff | 1 (signed) byte | 0-127* |
Initial filter resonance | 1 (signed) byte | 0-127** |
MIDI channel | 1 (signed) byte | The MIDI channel to use for
this instrument (0-16) |
MIDI program | 1 byte | The general MIDI instrument
to use for this instrument (1-128) |
MIDI bank | 2 bytes | 0-16384 |
Note Sample
Keyboard table |
240 bytes
(120 2-byte pairs) |
Byte 1 is note (0-119)
Byte 2 is sample |
* Filter uses the formula 110*2^(0.25+ce/fe), where ce is cutoff * (256 + 256) and fe = 24*512 or 20*512 if using OpenMPT's extended filter range.) Each step is roughly one half of a semitone/half-step for the non-extended filter range. (I guess that the cutoff frequency doubles every 20 increments for the OpenMPT extended filters.)
** Resonance used the formula 10^((-resonance*24.0)/(128.0f*20.0f)) but this usually uses a pre-calculated table.
Post 2.0 Envelopes[]
There are three envelope structures saved in the file. They are as follows:
- Volume Envelope, (82 bytes total)
- Panning envelope, (82 bytes total)
- Pitch and filter envelope, (86 bytes total)
Name | Length | Discription | |
---|---|---|---|
Flags | 1 byte |
(Bit 3 is envelope carry in OpenMPT) |
|
Node count | 1 byte | Number of valid nodes in file. | |
Loop beginning | 1 byte | Beginning node of loop. | |
Loop end | 1 byte | Ending node of loop. | |
Sustain loop
beginning |
1 byte | Beginning node of sustain loop. | |
Sustain loop
end |
1 byte | Ending node of sustain loop. | |
Node points | 3 bytes per node**
(25 nodes/75 bytes) |
Byte 1 is Y position
(0-64 for volume and filter, -32 to 32 for panning and pitch) Short (bytes 2 and 3) used for tick position (0-9999) |
|
Trailing byes* | 7 bytes if version 2.0 to 2.14
4 bytes if 2.14p1 or above |
Some trackers use this for extra hacks like OMPT |
*Only used for the pitch envelope
**There is space for 25 total nodes, regardless of how many are used.
Samples[]
Name | Length | Discription |
---|---|---|
Dos filename | 12 bytes
(including nulls) |
Name of DOS file |
Reserved byte | 1 byte | Reserved for future use |
Global volume | 1 byte | 0-64 |
Flags | 1 byte |
|
Default volume | 1 byte | Default volume for sample (0-64) |
Sample Name | 26 bytes
(including nulls) |
The name of the sample |
Convert flags | 1 byte |
(Bits 6 and 7 are reserved. Bits 1 and 3 to 5 can usually be ignored as the were used for conversion of other formats) |
Default pan | 1 byte | Bits 0-6 are panning value from 0-64.
Bit 7 must be on for panning to be applied. |
Sample Length | Int
(4 bytes) |
Number of sample in file |
Loop beginning | Int
(4 bytes) |
Beginning sample of loop |
Loop end | Int
(4 bytes) |
Sample after the loop end |
C5 (middle C)
speed |
Int
(4 bytes) |
Sample rate for Middle C
(0-9,999,999) |
Sustain
loop beginning |
Int
(4 bytes) |
Beginning sample of sustain loop |
Sustain
loop end |
Int
(4 bytes) |
Sample after the sustain loop end |
Sample pointer | Int
(4 bytes) |
Pointer to sample data in the file
(Usually sample data is written after the patterns) |
Vibrato speed | 1 byte | Changes frequency of vibrato (0-64) |
Vibrato depth | 1 byte | How far the vibrato can go off tune
in each direction (0-64) |
Vibrato Sweep | 1 byte | Delays the gain of the vibrato.
(The higher the number, the faster the vibrato gets to peak depth) 0-64 |
Vibrato waveform | 1 byte |
|
*Stereo samples was not supported in Impulse Tracker, but later trackers added stereo support.
**Samples in version 2.01 and earlier are unsigned, samples in 2.02 and later are signed.
***Compressed data is double delta encoded if this bit is on. IT 2.14p1 and later use this method and IT 2.14 and earlier always sets this off and delta encodes the data just once.
Sample Data[]
PCM data:[]
When not compressed: samples are stored as 1 byte (if 8-bit) or 2 bytes (if 16-bit) samples. The count of bytes is equal to the sample length * the bytes per sample. If the samples are stereo; all the left channel data is read first, then the right channel data is read.
Compressed data;[]
Each block of sample data when uncompressed is never more than 32 Kilobytes (0x8000 bytes) long.
Each block always resets the bitrate to the sample bitrate + 1 (9 for 8-bit and 17 for 16-bit)
Each block is delta decoded once (if convert bit 2 is off) or twice (if convert bit 2 is on)
Name | Length | Discription |
---|---|---|
Compressed data length | Short
(2 bytes) |
The length of the bitstream in bytes |
Compressed data | Above column bytes long | The compressed bitstream of the block of data
(This bitstream is also in little endian format) So 257/-255 "0b100000001" and 65/-63 "0b1000001" wold be stored as byte1[00000001] then byte2[10000011] |
Samples are decoded using 3 decompression types
Type A:[]
Used when length is between 1-6 bits wide. An unsigned value is read of length bits. If only the most signifiant (left most) bit is on and all others are off, 3 (if 8-bit) or 4 (if 16-bit) bits are read as an unsigned value to figure out new bit width. If not, convert value to signed and add to list for decoding.
Type B:[]
Used when length is between 7-bitrate (8 or 16) bits wide. An unsigned value is read of length bits. If value is equal or greater than leftmost bit + negative b value (-4 if 8-bit and -8 if 16-bit) or value is equal to or less than leftmost bit - b value (3 if 8-bit and 7 if 16-bit); subtract leftmost bit - negative b value from value and use it to figure out new bit width. If not, convert value to signed and add to list for decoding.
Type C:[]
Used when width is one bit greater than bit width (9 for 8-bit or 17 for 16-bit) An unsigned value is read of length bits. If the value is greater or equal to the left most bit, The value is limited to the lowest 8 bits (and value by 255 for example) and then become the new bit width. If not, get all bits but the leftmost bit, make a signed value out of it and add to list for decoding.
Calculating new bit width:[]
New bit width values from type A or type B compressions, need to be processed before becoming the new bit width. The value is first incremented by one, then incremented once more if the value is equal to the old bit width. After that the value is now the new bit width.
Delta decoding:[]
After all bytes from block are read, extracted and stored in a collection; the collection is delta decoded once or twice depending on convert bit 2 being on (twice) or off (once). The samples of this block are now decompressed. This is done by adding the current value onto the previous value and if double delta decoded, adding the previous value onto the earlier value.
Stereo:[]
If a stereo sample; all the right channel data is decompressed after and completely separate from the left channel data.
Patterns[]
Name | Length | Discription |
---|---|---|
Pattern length | short
(2 bytes) |
Length of packed data
- the first 8 bytes |
Row count | (signed) short
(2 byte) |
Row count. IT allows between 32-200
rows but OpenMPT can have more. |
Reserved | 4 bytes | Reserved bytes |
packed data | pattern length
bytes long |
The packed data |
Unpacking the data:[]
for each row
read channelMask byte
while channelMask > 0
channel = (channelMask - 1) & 63
if channelMask bit 7 is 1
read maskVariable byte
else
use last maskVariable from this channel
endif
// note
if maskVariable bit 0 is on
get note byte
else if maskVariable bit 4 is on
use last note byte
endif
// instrument
if maskVariable bit 1 is on
get instrument byte
else if maskVariable bit 5 is on
use last instrument byte
endif
// volume
if maskVariable bit 2 is on
get volume byte
else if maskVariable bit 6 is on
use last volume byte
// effect and effect value
if maskVariable bit 3 is on
get effect byte
get effect value byte
else if maskVariable bit 7 is on
use last effect byte
use last effect value byte
endif
read new channelMask byte
end while
end for
Note:[]
Note ranges between 0 (tracker C0 or MIDI C-1) to 119 (Tracker B9 or MIDI B8). It is advised to increment any value between 0 and 119 by one when reading to distinguish between a note continue event and no note.
254 = note cut (^^)
255 = note off (==)
anything else is fade out (~~)
Volume:[]
- 0-64 Volume (v)
- 65-74 Fine volume up (a)
- 75-84 Fine volume down (b)
- 85-94 Volume slide up (c)
- 95-104 Volume slide down (d)
- 105-114 Pitch slide down (e)
- 115-124 Pitch slide up (f)
- 128-192 Pan 0-64 (p)
- 193-202 Portamento to note (g)
- 203-212 Vibrato (h)
Effect:[]
- A Set Tempo
- B Jump to order pattern
- C Break to row
- D Volume slide
- E Portamento up
- F Portamento down
- G Portamento to note
- H Vibrato
- I tremor
- J Arpeggio
Currently incomplete...