Introduction
A VGM file records the music of a video game as a log of the commands sent to the console’s sound chips, with the waits between them. Played back through an emulation of the same chips, it reproduces the original sound exactly. The format began with the Sega Master System and Mega Drive (Genesis) and now covers many arcade, console and computer sound chips.
Files are often gzip-compressed and then use the extension .vgz.
Structure
A VGM file starts with Vgm (with a trailing space) and a header of
little-endian 32-bit fields: the offset to the end of the file, the version, the clock
rate of each sound chip used (zero when a chip is absent), the offset of the GD3 tag,
the total length in samples at 44100 Hz, and the loop offset and loop length. Later
versions add a data offset and clocks for more chips.
The data is a stream of one-byte commands with their operands: writes to a chip’s
registers (for example 50 for the SN76489 and 52 and
53 for the two ports of the YM2612), waits (61 with a 16-bit
sample count, 62 and 63 for one 60 Hz or 50 Hz frame) and
66 to end. The GD3 tag at the end holds the track, game, system and
composer names in English and Japanese, as UTF-16 text.
0Header Vgm, version, chip clocks, length, loop, GD3 offset64 bytes or more…Command stream chip writes and waits, ending with 66varies…GD3 tag titles and credits in UTF-16varies
Links
Software
- VGMPlay – player that emulates the sound chips logged in VGM files (Windows, Linux)
- foobar2000 – free music player that plays VGM with a VGM input component (Windows)
Reference
- VGM Specification – the full file format, on the vgmrips wiki