Skip to content

The mid2vgm topic

with updated versions of the tools you know

Technical discussion about the VGM format, and all the software you need to handle VGM files.

Moderator: Staff

  • User avatar
  • ValleyBell Offline
  • Posts: 4767
  • Joined: 2011-12-01, 20:20:07
  • Location: Germany

The mid2vgm topic

Post by ValleyBell »

May I present: The mid2vgm series.

There are 3.5 tools: PSG (SN76489), OPLL (YM2413), 2612 (YM2612 obviously) and the new RF (RF5C68, alpha state).
All of them got a few updates since the last release (some minor, some major).
The full source code (Visual Basic 6) is available for all of the tools.


mid2vgm PSG v1.2 Win32 Binary and Source
old topic on SMSPower, old version from 2012
Since the last release, it received some bugfixes and a few features requested by Aly James.
E.g. you can disable the panning volume compensation now. And the panning calculation works now properly.


mid2vgm OPLL v1.1 Win32 Binary and Source, Example Files
old topic on SMSPower, old version from 2012
Aside from a few minor bugfixes for edge cases, I added some new features:
  • optional Normalization (was always enabled before)
  • improved drum frequencies for Toms
  • RPN support for Pitch Bend Ranges (00 00), Corase (00 02) and Fine Tuning (00 01)
I stopped working on it in 2012 though, so it's the only tool that doesn't support the Loop Controller 111.
You need to set a Winamp-style Marker Meta Event to make VGMs loop.

Note: Channel mapping is fixed.
MIDI channels 1-9 go to FM channel 1-9.
MIDI channel 10 goes to the OPLL's rhythm channel, which replaces channels 7-9 if enabled.
Other channels are ignored.


mid2vgm 2612 v0.3.1 Win32 Binary (exe/gyb only), Win32 Binary (incl. 2612edit and example files) and Source
old topic on Sonic Retro, old version from 2013
There were many bugfixes since the last release, thanks to Aly James who did lots of tests with mid2vgm 2612.
All the few new features (like support for GenMDM MIDI controllers) were requested by him, too.


mid2vgm RF alpha v1 Win32 Binary + Source
mid2vgm RF alpha v2 (2021 fix) Win32 Binary + Source
This tool never left the alpha state since 2013, so it is "useable" but not "nice to use".

In order to convert a MIDI to a VGM, you will be asked for an additional instrument definition file.
This specifies, which WAV files are used by which MIDI instrument. Samples must be 8-bit or 16-bit mono.
Loop points can be set in the instrument file. (It's the 3rd column - my documentation is wrong on that.)

It will then generate the contents of the PCM RAM (and it will complain, if there is too much sample data).
So far it is intelligent enough to ignore unused samples (unlike mid2vgm 2612 =P), but it can not swap samples dynamically during the song.

Anyway, have fun with what it does.

Note: Channel mapping is fixed. MIDI channels 1-8 go to PCM channel 1-8. Other channels are ignored.
  • Tom Offline
  • Ragequit Member
    Ragequit Member
  • Posts: 496
  • Joined: 2011-11-30, 17:26:44
  • Location: Italy
  • Contact:

Post by Tom »

I am extremely happy to see how far you've been going with the development of my old 2612 converter, it all started out as a buggy piece of software, and now its code really looks much more polished and professional, I never had doubts you had the skills to make the miracle happen, every time you touch some code you never miss a chance to prove the world you're an awesome programmer. I am glad you still mentioned me in the credits, it shows once more how correct and respectful you are, but new revision after new revision there's less and less of my code still being used and I soon won't feel right to call it "my" 2612 converter anymore.

Nostalgia aside, I like it, really. I like it enough to break my semi-permanent hiatus and make an occasional post here.

Just two minor things:
  • the Log2 variable now seems to be unused (it was used in the obsoleted volume calculation routine), you might want to remove it altogether;
  • I see you took a "Const" approach to the dual chip idea, though that would make it accessible only to people who can compile the source by themselves, which might feel complicated (or impossible) to most people, I'd suggest to either move that setting to a checkbox in the main form, or you can look at how I approached it (warning to everyone else: I did it for private use in an extremely old build, do NOT attempt to copy code from it unless you really know what you're doing).
What you've been doing with these makes me still hope you'll do something with my xm2vgm converter as well, such as targeting other similar chips (e.g. QSound). I reuploaded the source here since it was lost after the Digilander failure (and I fixed a wrong comment while I was at it).
Also known as nineko.
  • User avatar
  • ValleyBell Offline
  • Posts: 4767
  • Joined: 2011-12-01, 20:20:07
  • Location: Germany

Post by ValleyBell »

I actually dropped the idea of dual chip support within mid2vgm 2612 itself entirely when I made vgmmerge able to merge two 1xYM2612 VGMs into one 2xYM2612 VGM. The approach with the constant is just a leftover and should be removed to clean the code. vgmmerge does the thing with the DAC data blocks a lot better than mid2vgm would be able to.
  • zzo38 Offline
  • Posts: 51
  • Joined: 2013-02-18, 3:17:44
  • Contact:

Post by zzo38 »

There seems no YM3812 output? If you want to do this anyways, one thing you can try is to first convert it to BAM with MIDI2BAM, and then BAM to VGM with BAMTOVGM. Note that I have not tried this, although I believe that it would work. Also, MIDI2BAM is a DOS program, and BAM does not support percussion so you won't get any percussion in the output file if you use this. MIDI2BAM uses an interactive user interface and uses DOS (you could try running it in DOSBox), while BAMTOVGM is a filter program and is cross-platform (doesn't require DOS). I cannot provide support for MIDI2BAM since I did not write that program. (Perhaps eventually mid2vgm might do this itself)
  • User avatar
  • MaliceX Offline
  • Posts: 226
  • Joined: 2012-09-29, 11:45:48
  • Location: Australia
  • Contact:

Post by MaliceX »

zzo38: Theoretically, mid2vgm OPL2 is already possible by use of another previous tool with some modifications.
eg (made it last year): https://dl.dropboxusercontent.com/u/128 ... rimmed.vgz

Current downside is that it's only loggable in real-time using a modified version of ValleyBell's MidiPlay (might have to google for it). That being said, modifying the mid2vgm OPLL converter to use YM3812 commands, as well as incorporating a patch bank system shouldn't be too hard to do since similar register structure.
-dj.tuBIG/MaliceX
  • zzo38 Offline
  • Posts: 51
  • Joined: 2013-02-18, 3:17:44
  • Contact:

Post by zzo38 »

MaliceX:Both of those ways may also allow percussion to be used (so they have those advantages); the way I mentioned above won't work with percussion.
  • SeregaZ Offline
  • Posts: 98
  • Joined: 2015-08-08, 13:56:52

Post by SeregaZ »

i am just start study this vgm and i have vgm music maker. this programm have instrument creation tab, where is a many switchers. as i can undestand by this tool can be sintezed any instrument. where i can take this tables of this switchers for emulate all 128 midi's sound? i mean like they sounds on PC. maybe some one make this tables? it can make converting midi2vgm more closer midi's sounds.

Can't use mid2vgm ym2612

Post by zackoftrades333 »

Hello, nearly 1 year old thread...

Anyways, I used ValleyBell's mid2vgm ym2612 from this thread (not sure if there are any newer versions out there).

After figuring out the whole comctl32.ocx compatibility issue with windows 8.1 (no offense, but people use visual studio now instead of visual basic), I got to actually run the software, but I'm still having some issues.

I have this giant collection of various GM/2,GS,XG MIDI files, and selecting any of them gives me an error stating they aren't MIDI files because no MThd chunk was found, even though I can play them perfectly fine in other software.

I'd really like to use mid2vgm, because making MD chiptunes from MIDI files is really hard to do from lack of good software. There are a few VSTs and then there's tracker software (which I'd also like to figure out even though MIDI is way easier), but none of those seem like they would have the ease of use and the accuracy together that mid2vgm has. I have already tried the opll ym2413 version and liked it, but it still doesn't compare to ym2612 chip.

Would really appreciate it if somebody could help me out with this.
  • User avatar
  • ValleyBell Offline
  • Posts: 4767
  • Joined: 2011-12-01, 20:20:07
  • Location: Germany

Post by ValleyBell »

Can you post one of those MIDIs? The MIDIs I have work, so I need a test case.

(Also: I usually avoid ActiveX controls, but I didn't write the initial version of mid2vgm 2612. The original version even required a Visual Basic 5 DLL, btw.)
  • Tom Offline
  • Ragequit Member
    Ragequit Member
  • Posts: 496
  • Joined: 2011-11-30, 17:26:44
  • Location: Italy
  • Contact:

Post by Tom »

The comctl32 is only used for the volume slider, btw. If you replace it with a scrollbar (which is part of the default controls), you can drop the comctl32 requirement.
Also known as nineko.

Post by zackoftrades333 »

Here's six random MIDI files that I used with it but didn't work:
https://www.dropbox.com/s/dy9ciycdazbnj ... le.7z?dl=0

Here's my collection that has many more, just in case:
https://www.dropbox.com/s/55m0uh87ne30c ... on.7z?dl=0

Post by zackoftrades333 »

OK, I feel really stupid now, lol :lol: .

After reading another thread, I realized you're supposed to have the MIDI files in the same folder as the program...

I was just dragging the file I wanted to use onto the program :roll: .


Is there a way you could make it not require the MIDI files in the same folder, seeing how I have over 3000 MIDIs or so? :lol:

(Also, 2xYM2612 support?)
Last edited by zackoftrades333 on 2016-05-03, 17:17:38, edited 1 time in total.
  • Tom Offline
  • Ragequit Member
    Ragequit Member
  • Posts: 496
  • Joined: 2011-11-30, 17:26:44
  • Location: Italy
  • Contact:

Post by Tom »

That, too, is something I should apologise for. I wrote the very first revision of the YM2612 mid2vgm, and some of the bad things I did haven't been overhauled yet. Don't fear, anyway. Now that the code is in the hands of good programmers (unlike me) I'm sure more features and better functionality are on their way.
Also known as nineko.

Post by 1983parrothead »

Any way to play vgz/vgm to the PC Engine/TG-16?

Post by Kaminari »

It depends on what you want to play.

You can try VGM2HES, but it only supports SN76489.

Deflemask would be a great option... if it could directly export HES files (as it does with NSF).
Post Reply