VGFM Instrument Format

From ModdingWiki

Jump to: navigation, search

The Vinyl Goddess From Mars Instrument Format is used to store the FM instruments used when playing the game's background music.

File format

The file begins with a header:

Data typeNameDescription
UINT16LEiVersionFile version? (always 0x0001)
UINT16LEiNumInstrumentsNumber of instruments in the file
UINT16LEiOffsetOffset where instrument data begins

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

Data typeNameDescription
BYTE[9]cNameInstrument name - must be NULL-terminated

At this point, the current position should be the same as iOffset. The actual instrument data follows, again repeated once for each instrument. The instrument data is in the following format, which is remarkably similar to the Adlib BNK format (only Vinyl uses two-byte words to store each field instead of a single byte as in the BNK format.)

Data typeNameDescription
OPLREGSoplModulatorRegister values for the Modulator operator
OPLREGSoplCarrierRegister values for the Carrier operator
UINT16LEiModWaveSelModulator wave select (only bits 0-1 recognised, OPL register 0xE0)
UINT16LEiCarWaveSelCarrier wave select (only bits 0-1 recognised, OPL register 0xE0)

The OPLREGS structure is defined as:

Data typeNameDescriptionOPL base registerValue range
UINT16LEiKSLKey scaling level0x40 (bits 6-7)
UINT16LEiMultipleFrequency multiplier0x20 (bits 0-3)iMultiple & 0x0F is sent to OPL register [verify this]
UINT16LEiFeedbackFeedback0xC0 (bits 1-3)Although only bits 1-3 are valid, Vinyl doesn't limit the output to three bits wide.
UINT16LEiAttackAttack rate0x80 (upper four bits)[verify this]
UINT16LEiSustainSustain level0x80 (upper four bits)[verify this]
UINT16LEiEGEnvelope gain (nonzero value is on)0x20 (bit 5)[verify this]
UINT16LEiDecayDecay rate0x60 (lower four bits)[verify this]
UINT16LEiReleaseRateRelease rate0x80 (lower four bits)[verify this]
UINT16LEiTotalLevelTotal output level0x40 (bit 0-5)[verify this]
UINT16LEiAMAmplitude modulation (Tremolo)0x20 (bit 7)[verify this]
UINT16LEiVIBFrequency Vibrato0x20 (bit 6)[verify this]
UINT16LEiKSRKey scaling/envelope rate0x20 (bit 4)[verify this]
UINT16LEiCONoffConnector [OP0 only]0xC0 (bit 0, inverted)0: OPL bit set to 1
other: OPL bit set to 0

Credits

This file format was reverse engineered by Malvineous. 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!)

Personal tools
programming