Vgm2Midi
Software to convert VGMs into MIDI sequences.

Download
Download from here [1.0] - requires the .NET 2.0 Framework.
What is it?
This simple program was developed to convert VGM (Video Game Music) files to standard MIDI files (to be used, for example, as a mobile 'phone ringtone).
The conversion is not perfect, and only supports PSG VGM files. I'm a bit of a newbie to the whole MIDI thing, but it all appears to work. I must warn you that the MIDI files outputted use the pitch wheel for fine-tuning (so MIDI synthesizers not supporting pitch wheel adjustments will no doubt sound horribly out of tune). The MIDI files also sound pretty ghastly with the softsynth that comes with Windows, but I can't really help that (after all, every MIDI file sounds pretty ghastly with the softsynth that comes with Windows).
Limitations
MIDI synthesizers and the PSG are two very different systems, and as such you can't derive a MIDI file that sounds exactly like the original VGM file. One example is that instruments simulated by a MIDI synthesizer will have attack, sustain and decay effects. The PSG is limited to outputting square waves at fixed amplitudes, and so the author of the music for the PSG has to implement all these effects manually. Trying to convert these to MIDI sometimes adds surplus key events (so some attacks are duplicated within a short space of time - slow fades or vibrato effects are the worst culprits).
As a result of these extra commands, some MIDI files end up being massive.
Credits
Maxim for the SN79489 (PSG) documentation and VGM file format specification.
Dustin Caldwell for the MIDI file format specification.
Usage
The easiest way is to drag and drop a VGM on top of the executable file - it will output a MIDI file into the same directory as itself, with the same name as the VGM file with .mid replacing .vgz (or .vgm).
It is important to note that the PSG has 4 channels, and each of these channels are mapped onto different MIDI channels. Each channel has an instrument attached to it, as well as a volume limiter and a pan value (to give the MIDI file a fake stereo effect).
The 4th channel of the PSG (channel number 3) operates in two different modes - white noise (used for percussion) or periodic noise (sometimes used as bass). Because of this, anything that affects channel 3 will also affect the percussive effects.
The PSG can produce three different pitches of white noise, so you can pick 3 differently pitched percussive instruments.
Default settings for the program can be found inside the file defaults.txt. This is a text file containing a number of definitions to set a variety of program options. Comments start with a semicolon (;).
The various options are:
- instrument?, where ? is from 0-3: MIDI patch number to attach to a PSG channel. instrument3 only applies for when the PSG is using periodic noise for channel 3. For example, instrument1=22 will make channel 1 sound like an accordian. By default these all use patch 81, Lead 1 (Square) See the appendices for a cheat-sheet of MIDI instrument patch numbers.
- percussion?, where ? is from 0-2: MIDI key used for percussion on PSG channel 3. The PSG can generate 3 different pitches of white noise; for this reason you can set 3 differently pitched drums. Crash cymbals sound rather like the normal white noise of the PSG, so using a crash cymbal or two can sound better than straight drums on certain VGM files. See the appendices again for a cheat-sheet of standard MIDI percussion keys.
- a440: Vgm2Midi converts PSG tone register values to MIDI keys, and to carry out this conversion it needs to know which MIDI key corresponds to 440Hz. By default, key 69 is used (A, octave 5) and appears to be perfectly in tune with the PSG. You can, however, use this setting to transpose the VGM up or down.
- stereo?, where ? is from 0-3: pan offset (move the sound left or right) for a fake stereo effect (regular stereo effects via the Game Gear's stereo extension are added to the effect). Range is from -64 to +63: positive offsets move the sound source right, negative offsets move the sound source left.
- volume?, where ? is from 0-3: volume limiter. Valid values are from 0 (quiet) to 127 (loud). If you specify 0, the channel is muted completely and no MIDI data will be output for it.
- loop: how many times to repeat the looped section of a VGM file. For example, a loop of 1 will play the file through then play the looped part once more. Specifying zero disables all looping effects.
- fadeout: how long (in miliseconds) you wish to fade out for. The fade starts at the same time as the looped section starts - so a loop of 1 and a fadeout of 1000 will play the main piece once, then plays one second of the looped section, fading out as it goes. Specifying zero disables the fade (so the entire looped part would be played). If the fadeout time is longer than the looping section, the looping section will continue to be played until it has completely faded out.
You can override these settings on the command-line. The command-line syntax is:
Vgm2Midi filename [-i i0 i1 i2 i3] [-p p0 p1 p2] [-a a440] [-s s0 s1 s2 s3] [-v v0 v1 v2 v3] [-l loop] [-f fadeout]For example, to convert a file sonic.vgz and to use as percussive instruments a tambourine, a low tom and a set of maracas you would:
Vgm2Midi sonic.vgz -p 54 45 70Standard MIDI Instrument Patches
Prog# Instrument Prog# Instrument (1-8 PIANO) (9-16 CHROM PERCUSSION) 1 Acoustic Grand 9 Celesta 2 Bright Acoustic 10 Glockenspiel 3 Electric Grand 11 Music Box 4 Honky-Tonk 12 Vibraphone 5 Electric Piano 1 13 Marimba 6 Electric Piano 2 14 Xylophone 7 Harpsichord 15 Tubular Bells 8 Clav 16 Dulcimer (17-24 ORGAN) (25-32 GUITAR) 17 Drawbar Organ 25 Acoustic Guitar(nylon) 18 Percussive Organ 26 Acoustic Guitar(steel) 19 Rock Organ 27 Electric Guitar(jazz) 20 Church Organ 28 Electric Guitar(clean) 21 Reed Organ 29 Electric Guitar(muted) 22 Accoridan 30 Overdriven Guitar 23 Harmonica 31 Distortion Guitar 24 Tango Accordian 32 Guitar Harmonics (33-40 BASS) (41-48 STRINGS) 33 Acoustic Bass 41 Violin 34 Electric Bass(finger) 42 Viola 35 Electric Bass(pick) 43 Cello 36 Fretless Bass 44 Contrabass 37 Slap Bass 1 45 Tremolo Strings 38 Slap Bass 2 46 Pizzicato Strings 39 Synth Bass 1 47 Orchestral Strings 40 Synth Bass 2 48 Timpani (49-56 ENSEMBLE) (57-64 BRASS) 49 String Ensemble 1 57 Trumpet 50 String Ensemble 2 58 Trombone 51 SynthStrings 1 59 Tuba 52 SynthStrings 2 60 Muted Trumpet 53 Choir Aahs 61 French Horn 54 Voice Oohs 62 Brass Section 55 Synth Voice 63 SynthBrass 1 56 Orchestra Hit 64 SynthBrass 2 (65-72 REED) (73-80 PIPE) 65 Soprano Sax 73 Piccolo 66 Alto Sax 74 Flute 67 Tenor Sax 75 Recorder 68 Baritone Sax 76 Pan Flute 69 Oboe 77 Blown Bottle 70 English Horn 78 Skakuhachi 71 Bassoon 79 Whistle 72 Clarinet 80 Ocarina (81-88 SYNTH LEAD) (89-96 SYNTH PAD) 81 Lead 1 (square) 89 Pad 1 (new age) 82 Lead 2 (sawtooth) 90 Pad 2 (warm) 83 Lead 3 (calliope) 91 Pad 3 (polysynth) 84 Lead 4 (chiff) 92 Pad 4 (choir) 85 Lead 5 (charang) 93 Pad 5 (bowed) 86 Lead 6 (voice) 94 Pad 6 (metallic) 87 Lead 7 (fifths) 95 Pad 7 (halo) 88 Lead 8 (bass+lead) 96 Pad 8 (sweep) (97-104 SYNTH EFFECTS) (105-112 ETHNIC) 97 FX 1 (rain) 105 Sitar 98 FX 2 (soundtrack) 106 Banjo 99 FX 3 (crystal) 107 Shamisen 100 FX 4 (atmosphere) 108 Koto 101 FX 5 (brightness) 109 Kalimba 102 FX 6 (goblins) 110 Bagpipe 103 FX 7 (echoes) 111 Fiddle 104 FX 8 (sci-fi) 112 Shanai (113-120 PERCUSSIVE) (121-128 SOUND EFFECTS) 113 Tinkle Bell 121 Guitar Fret Noise 114 Agogo 122 Breath Noise 115 Steel Drums 123 Seashore 116 Woodblock 124 Bird Tweet 117 Taiko Drum 125 Telephone Ring 118 Melodic Tom 126 Helicopter 119 Synth Drum 127 Applause 120 Reverse Cymbal 128 Gunshot
Standard MIDI Percussion
MIDI Drum Sound MIDI Drum Sound Key Key 35 Acoustic Bass Drum 59 Ride Cymbal 2 36 Bass Drum 1 60 Hi Bongo 37 Side Stick 61 Low Bongo 38 Acoustic Snare 62 Mute Hi Conga 39 Hand Clap 63 Open Hi Conga 40 Electric Snare 64 Low Conga 41 Low Floor Tom 65 High Timbale 42 Closed Hi-Hat 66 Low Timbale 43 High Floor Tom 67 High Agogo 44 Pedal Hi-Hat 68 Low Agogo 45 Low Tom 69 Cabasa 46 Open Hi-Hat 70 Maracas 47 Low-Mid Tom 71 Short Whistle 48 Hi-Mid Tom 72 Long Whistle 49 Crash Cymbal 1 73 Short Guiro 50 High Tom 74 Long Guiro 51 Ride Cymbal 1 75 Claves 52 Chinese Cymbal 76 Hi Wood Block 53 Ride Bell 77 Low Wood Block 54 Tambourine 78 Mute Cuica 55 Splash Cymbal 79 Open Cuica 56 Cowbell 80 Mute Triangle 57 Crash Cymbal 2 81 Open Triangle 58 Vibraslap