VGFM Music Format
From ModdingWiki
The Vinyl Goddess From Mars Music Format is an Adlib music format, based on the standard MIDI format. The format has a custom header, but the actual music data is in standard MIDI notation. Despite this, it appears that it was never intended to be played on a MIDI device (the game only supports the OPL2 chip for music.) In this respect it is similar to the CMF Format, which also stores Adlib music in MIDI notation, but unlike CMF this format does not contain any instrument definitions (instead they are stored in separate files.)
File format
The file is arranged like this:
| Data type | Name | Description |
|---|---|---|
| UINT32LE | ? | File header? (always 0x00000001) |
| BYTE[20] | ? | Unknown/padding - all 0x00 |
| UINT16LE | ? | Unsure (0x04F0 in most files) |
| UINT32LE | ? | Unsure (0xB400, 0xE880, etc.) |
| FYI: Next field begins at offset 0x2A | ||
| UINT32LE | iLength | Length of MIDI data in bytes |
| UINT32LE | ? | Unsure (0x1262, 0x0EE9, etc.) |
| UINT32LE | ? | ? (seems to be always zero) |
| UINT32LE | ? | ? (seems to be always zero) |
| BYTE | ? | ? (0x01) |
| FYI: Next field begins at offset 0x3B | ||
| UINT16BE | ? | Timing? Looks like it could be MIDI's "delta-time ticks per quarter note" - note big endian (like MIDI) if so |
| BYTE | ? | ? (0x00) |
| UINT32LE | ? | ? (seems to be always zero) |
| UINT32LE | ? | ? (seems to be always zero) |
| FYI: Next field begins at offset 0x46 | ||
| BYTE[iLength] | cMIDIData | Song data in standard MIDI format (same content as a MIDI MTrk block) |
There are many unknown fields, so hopefully these store information about which instrument sets to use and additional timing information.
One thing to be aware of is that standard MIDI messages for polyphonic key pressure (event 0xA0) contain two data bytes (the key/note and the pressure for that note.) The VGFM music format however only supplies one data byte for an 0xA0 event, so this will confuse a standard MIDI player. These events must either be removed (they don't seem to be used), changed to include an extra data byte (the pressure value is supplied, but the key/note is not) or alternatively they could be changed to event 0xD0 instead, which is a channel pressure message containing only one data byte. All these methods have been tested and there seems to be no audible difference between them, so the easiest method to implement is probably the best choice.
See also
- VGFM Instrument Format - the file format used for storing the instruments used by this format
- http://www.shikadi.net/utils/#vinyl2cmf - utility to convert the VGFM music into CMF Format
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!)
