AdLib Instrument Format

From ModdingWiki
Jump to: navigation, search
AdLib Instrument Format
Format typeMusical Instrument
Number of instruments1
Instruments named?Yes, 19 chars

The AdLib Instrument Format was the original format developed by Ad Lib, Inc. in 1987 to store OPL instruments in individual files with the .ins extension. It went through a number of revisions as hardware capabilities were added to the OPL chip, but ultimately it was replaced by the AdLib Instrument Bank Format, which combined multiple instruments into a single file with a .bnk extension.

For a short time before the BNK format was introduced, there was an early bank format called AdLib Timbre Bank Format which used a .snd or .tim extension. Each instrument in this bank format is stored in a structure almost identical to the structure used in the individual .ins instrument files.

File format

The file is in the following structure:

Data type Name Description
UINT16LE unknown ! Unknown purpose, always 0x0000
OPLREGS oplModulator Register values for the Modulator (0) operator
OPLREGS oplCarrier Register values for the Carrier (1) operator
char[20] timbreName Instrument name - must be null terminated
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)
UINT16LE unknown2 ! Unknown purpose, always 0x0001

The last two fields (iModWaveSel and iCarWaveSel) are not present in early files in this format. Some files are also missing oplCarrier entirely - presumably these are patches for single-operator percussive instruments.

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 apparently no distinction between percussive and melodic instruments. This is controlled at playback time, depending on which channel the instrument is loaded into.


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 bankmng.exe DOSNoYesYesYes; .bnkYes; .bnkNoNo Part of AdLib Programmer's Manual
Camoto Linux/WinNoNoNoYes; manyYes; manyNoYes


This file format was documented by Malvineous from reading code included with the AdLib Programmer's Manual. 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!)