AdLib Timbre Bank Format

From ModdingWiki
Jump to navigation Jump to search
AdLib Timbre Bank Format
Format typeMusical Instrument
HardwareOPL
Number of instruments65535
Instruments named?Yes, 8 chars
Games

The AdLib Timbre Bank Format is used to store the FM instruments used when playing songs in AdLib MIDI Format. The official documentation uses both the .snd and .tim extensions for files in this format.

This format is an early (1988) method of combining individual instrument files into one "bank" file. As this format was only designed to include the instruments needed to play a single song, in 1989 AdLib created the BNK Format, giving it the .bnk extension. The differences are minor - compared to the Timbre format, the later Bank format includes a signature in the header, indicators for percussive vs melodic patches, and halves the capacity used for storing instruments by placing them in bytes instead of 16-bit integers.

File format

The file begins with a header:

Data type Name Description
UINT8 majorVersion Always 1
UINT8 minorVersion Always 0
UINT16LE nrTimbre Number of instruments in the file
UINT16LE offsetDef Offset where instrument data begins

This is followed by a list of instrument names, repeated nrTimbre times:

Data type Name Description
char[9] timbreName Instrument name - must be null terminated

At this point, the current position should be the same as offsetDef. The actual instrument data follows, again repeated once for each instrument. The instrument data is in the following format, which is almost identical to the AdLib Instrument Format.

Data type Name Description
OPLREGS oplModulator Register values for the Modulator (0) operator
OPLREGS oplCarrier Register values for the Carrier (1) operator
UINT16LE iModWaveSel Modulator wave select (only bits 0-1 recognised, OPL register 0xE0)
UINT16LE iCarWaveSel Carrier wave select (only bits 0-1 recognised, OPL register 0xE0)

The OPLREGS structure is defined as:

Data type Name Description OPL base register Value range
UINT16LE iKSL Key scaling level 0x40 (bits 6-7)
UINT16LE iMultiple Frequency multiplier 0x20 (bits 0-3) iMultiple & 0x0F is sent to OPL register [verify this]
UINT16LE iFeedback Feedback 0xC0 (bits 1-3) Although only bits 1-3 are valid, Vinyl doesn't limit the output to three bits wide.
UINT16LE iAttack Attack rate 0x60 (upper four bits) [verify this]
UINT16LE iSustain Sustain level 0x80 (upper four bits) [verify this]
UINT16LE iEG Envelope gain (nonzero value is on) 0x20 (bit 5) [verify this]
UINT16LE iDecay Decay rate 0x60 (lower four bits) [verify this]
UINT16LE iReleaseRate Release rate 0x80 (lower four bits) [verify this]
UINT16LE iTotalLevel Total output level 0x40 (bit 0-5) [verify this]
UINT16LE iAM Amplitude modulation (Tremolo) 0x20 (bit 7) [verify this]
UINT16LE iVIB Frequency Vibrato 0x20 (bit 6) [verify this]
UINT16LE iKSR Key scaling/envelope rate 0x20 (bit 4) [verify this]
UINT16LE iCONoff Connector [OP0 only] 0xC0 (bit 0, inverted) 0: OPL bit set to 1
other: OPL bit set to 0

Percussive instruments

There is no distinction between percussive and melodic instruments. This is controlled at playback time, depending on which channel the instrument is loaded into. This rules for this are described in AdLib MIDI Format.

Tools

The following tools are able to work with files in this format.

Name PlatformPlay? Create new? Modify? Convert/export to other? Import from other? Access hidden data? Edit metadata? Notes
AdLib play.exe DOSYesNoNoNoNoNoNo Only with an associated .mus file. Part of AdLib Programmer's Guide.
AdLib convert.exe DOSNoNoNoNoYes; .insNoNo Loads .ins specified in .rol when producing .mus + .tim. Part of AdLib Programmer's Guide.
Camoto Linux/WinYesNoNoYes; manyNoNoNo Only with an associated .mus file
OPL3 Bank Editor Linux, Windows, macOSYesYesYesYes; manyYes; manyNoNo

Credits

This file format was originally reverse engineered by Malvineous as the Vinyl Goddess From Mars instrument format, until binarymaster discovered it was the same as an early AdLib music format, and supplied the documentation on which this article is now based. If you find this information helpful in a project you're working on, please give credit where credit is due. (A link back to this wiki would be nice too!)