MIDI to VGM converter - YM2612 edition

Discussion in 'Technical Discussion' started by nineko, Dec 21, 2010.

  1. nineko

    nineko

    I am the Holy Cat Tech Member
    <!--sizeo:7--><span style="font-size:36pt;line-height:100%"><!--/sizeo-->PLEASE NOTE:<!--sizec--></span><!--/sizec--> ValleyBell improved the midi to vgm converter, and he released it <a href="http://forums.sonicretro.org/index.php?showtopic=23851&view=findpost&p=604458" target="_blank">just a few posts below</a>.

    What follows below this line is the very old release of my ultra broken beta version. It should not be used, and it's only for archival purposes.
    ---------------------------------------------------
    <!--sizeo:1--><span style="font-size:8pt;line-height:100%"><!--/sizeo--><a href="http://digilander.iol.it/projectchaos/mid2vgm001.rar" target="_blank">Download here</a>. It is highly unfinished but I fail at postponing releases, so I can let you all have some fun with this. Happy early Christmas, I guess :v:

    It imports (almost) any MIDI file in format 0 to output VGM files. No PSG, no YM2413 (<a href="http://www.smspower.org/forums/viewtopic.php?t=12638" target="_blank">use ValleyBell's converter for that one</a>), no YM2151 (yet, but I plan to add it soon, if I can understand the few docs available). Yes, it is technically possible to have 2612 and 2151 in the same vgm file, resulting into 6+8 FM channels at the same time. Neat, isn't it?

    No YM2612 PCM channel, it's 6FM only. I won't make any guarantee about the PCM channel being added anytime soon if at all.

    What works: Volume changes (via the Main Volume Controller), Pitch bends, Pan changes (via the Pan Controller), Instrument changes. Please note that I didn't finalize the instrument interface yet, so I'm relying on a temporary solution for now. Future versions will have a comprehensive instrument editor with parameters and whatnot.

    To achieve the best results you should use this on a MIDI file with strictly monophonic channels; you should get an error message if a MIDI channel tries to play more than one note at the same time, though there is a "cheat mode" which forces a Note Off if a new Note On event is encountered while another note is still playing. Please note that I don't recommend to use that mode, though it will be needed to convert MIDI files which weren't prepared beforehand. Future versions *might* implement a "chord mode" where you can set a MIDI channel to spread on several YM2612 channels. Though I can't confirm this feature yet.

    So yeah there's not much more to say now, this is an early beta just to see if it can gather some interest. Oh by the way the slider on the right sets the maximum volume achievable in the VGM file. Keep in mind that it's logarithmic so you DO NOT WANT to raise it too much.

    Both Andlabs and TmEE gets tons of credit for their invaluable help. If it wasn't for them this converter wouldn't exist.

    Obligatory sample files:
    <a href="http://digilander.iol.it/projectchaos/DATA_70.vgm" target="_blank">LBZ1 PC</a>
    <a href="http://digilander.iol.it/projectchaos/DATA_101.vgm" target="_blank">Unused S&KC song</a>
    <a href="http://digilander.iol.it/projectchaos/PitchBend.vgm" target="_blank">Proof of concept of pitch bend</a>

    edit: this version should not be uploaded on the wiki, as it's an early proof of concept, likely to have dozens if not hundreds of bugs. I will give this a green light when I'll fell comfortable with that.<!--sizec--></span><!--/sizec-->
     
  2. LordOfSquad

    LordOfSquad

    tails is still a girl Member
    4,727
    1
    18
    Winnipeg, MB
    making cool music no one gives a shit about
    <strike>Sexy! Anything that makes music hacking less complicated (and hopefully actually able to work on my computer) is a godsend. Please do keep working on this!</strike>

    HAHAHA WAIT. For some reason I thought this was a MIDI to SMPS converter. Oh well, it's still neat.
     
  3. Shadow Hog

    Shadow Hog

    "I'm a superdog!" Member
    That's pretty awesome, actually. Nice work! Eager to see where this goes.

    Should play around with this, in fact...

    EDIT: doesn't run. Closes instantly.
     
  4. ValleyBell

    ValleyBell

    Tech Members Tech Member
    236
    0
    0
    researching SMPS sound drivers
    Nice tool! And it works quite well.
    Here is S&K PC - CNZ1: <a href="http://www.mediafire.com/?ensnnl3hjo35bk2" target="_blank">VGM</a>, <a href="http://www.mediafire.com/?jnirj09bmpbyxdk" target="_blank">Source MIDI</a> (the MIDI was already patched for mid2vgm YM2413, that's why it's called OPLLpatch)

    Because I've no experience with XMs (and modules in general) and I simply love MIDIs, I'm looking forward for future releases.
     
  5. nineko

    nineko

    I am the Holy Cat Tech Member
    Wow, positive feedback from ValleyBell himself, I'm honoured :)
     
  6. Shadow Hog

    Shadow Hog

    "I'm a superdog!" Member
    Update on the closes-instantly thing: it runs fine on my work laptop (Win XP, pretty sure it's 32-bit). It doesn't even start up on my home computer (Windows 7 x64). Not sure what else to mention... Can't mess around with it much on the computer it does work on, regrettably, considering, well, <I>work computer</I>.
     
  7. nineko

    nineko

    I am the Holy Cat Tech Member
    Make sure you have <a href="http://support.microsoft.com/kb/180071" target="_blank">MSVBVM50.DLL</a> and <a href="http://support.microsoft.com/kb/167121" target="_blank">COMCTL32.OCX</a> installed. I'm not sure about how Vista and 7 handle permissions on external libreries, you might need to be an administrator or something to install them.

    Aside from that I can't think of any reason which would prevent this program from running into any Windows OS from Windows 95 onwards.
     
  8. Shadow Hog

    Shadow Hog

    "I'm a superdog!" Member
    That got it working. Took a while to figure out how to deal with the second file (won't natively install on Win 7 64-bit, see - had to settle for the quick-and-dirty fix of just putting the OCX file in the program's folder instead of properly installing it in System32).

    So yeah, while you guys went with a fairly obvious PC game choice, considering the board, I went with the <a href="http://www.fileden.com/files/2006/11/5/352484/Music/midi2vgmSong1.vgm" target="_blank">other</a> <a href="http://www.fileden.com/files/2006/11/5/352484/Music/midi2vgmSong2.vgm" target="_blank">obvious</a> <a href="http://www.fileden.com/files/2006/11/5/352484/Music/midi2vgmSong3.vgm" target="_blank">one</a>. I think the last one in particular sells me.

    Looking forward to drums working, if they ever do!
     
  9. nineko

    nineko

    I am the Holy Cat Tech Member
    Ironically, I converted your "Song1" too while I was testing this. Nice work, glad to hear you got it to work. I especially like Song3 :o

    edit [several minutes after the original post]: seriously I can't stop listening to Song3, lol :v:
     
  10. Hendricks 266

    Hendricks 266

    Member Member
    I made <a href="http://hendricks266.duke4.net/stuff/Grabbag.vgm" target="_blank">one from the third obvious choice</a>. Neat program!
     
  11. Kiddo Cabbusses

    Kiddo Cabbusses

    Researcher Researcher
    <!--quoteo(post=540312:date=Dec 21 2010, 12:51 PM:name=nineko)--><div class='quotetop'>QUOTE (nineko @ Dec 21 2010, 12:51 PM) <a href="index.php?act=findpost&pid=540312"><img src="public/style_images/retro/snapback.png"></a></div><div class='quotemain'><!--quotec-->Make sure you have <a href="http://support.microsoft.com/kb/180071" target="_blank">MSVBVM50.DLL</a> and <a href="http://support.microsoft.com/kb/167121" target="_blank">COMCTL32.OCX</a> installed. I'm not sure about how Vista and 7 handle permissions on external libreries, you might need to be an administrator or something to install them.

    Aside from that I can't think of any reason which would prevent this program from running into any Windows OS from Windows 95 onwards.<!--QuoteEnd--></div><!--QuoteEEnd-->

    I installed both, but the program is still saying that COMCTL32.OCX is not registered correctly. :(

    (EDIT: Got past that, now get "Unexpected Error". PFfftt.)
     
  12. Shadow Hog

    Shadow Hog

    "I'm a superdog!" Member
    "Sir, the possibility of successfully navigating an <a href="http://www.fileden.com/files/2006/11/5/352484/Music/asteroid.vgm" target="_blank">asteroid field</a> is approximately 3720 to 1!"
    "Never tell me the odds!"

    An attempt at converting piano-only MIDIs to VGM. The results are... <I>okay</I>. <a href="http://www.fileden.com/files/2006/11/5/352484//asteroid.mid" target="_blank">The source MIDI</a> had a few issues which <a href="http://www.fileden.com/files/2006/11/5/352484//asteroid_modified.mid" target="_blank">I worked to correct</a>, but it's still rather inaccurate to <a href="http://www.youtube.com/watch?v=SVycvLAFXmc" target="_blank">the original song</a>.
     
  13. MaliceX

    MaliceX

    I'm back, mofos!!!!! Oldbie
    43
    0
    0
    Laverton, VIC, AU
    Audjoo Helix VSTi Alternate Manual
    This tool is certainly looking promising. Fooled around with it while testing the ability of ValleyBell's vgmmerge (OPNA+PSG+OPLL), and well, obviously it's certainly not intuitive for a beginner without patience. :)

    <a href="http://dl.dropbox.com/u/1287967/cinema-cock.vgm" target="_blank">Second part of Genesis - The Cinema Show</a> (Note: yes notes are wrong, blame the conversion and lazy channel monofication)
    <a href="http://dl.dropbox.com/u/1287967/cinema-convert.mid" target="_blank">initial stolen source (not split-prepared)</a>
     
  14. nineko

    nineko

    I am the Holy Cat Tech Member
    Since this thread was bumped I might as well take this chance to say that while I completely discontinued this converter, and I didn't improve it in any way whatsoever after the first release, a few days ago I sent the source code to ValleyBell, so a decent release (e.g. something without a gigantic "this is a beta version" label) might be on its way. No promises though, for me this project is dead.
     
  15. ValleyBell

    ValleyBell

    Tech Members Tech Member
    236
    0
    0
    researching SMPS sound drivers
    Actually I wanted to bump this thread since some days, but the time passed while I was thinking what bugs could still be in mid2vgm 2612 and 2612edit.

    But here it is: an updated and improved <a href="http://www.mediafire.com/?fhdys05bush5gxi" target="_blank">mid2vgm 2612</a>.
    New features (I hope I didn't forget some):
    - DAC support (via ini-file and vgm v1.60 extensions), if no DAC is used, version is set to v1.50 (for compatibility with foo_gep and other stupid players that refuse reading the file just because of the version tag)
    - loop support (via Controller 111 with value 0/1, like mid2smps, but global)
    - GYB v2 support (new 2612edit is included)
    - vibrato support (MIDI Modulation Wheel -> FMS/LFO Vibrato)
    - fixed a bug with overlapping notes (and some others I don't remember anymore)
    - volume calculation is now 100% GM correct (including L/R panning) and doesn't ignore operator volumes anymore
    - automatic internal midi format 1 -> 0 conversion (midi1to0.exe didn't work on Win7x64 anyway)

    mid2vgm Notes:
    - You can enable the DAC and FM channel 6 at the same time, but they will turn each other off.
    - The drum bank of GYB files is still ignored.
    - If you use the DAC, be sure that you comment out unused sounds in the ini, else your vgm will contain (huge) unused samples.
    - You can adjust the vibrato speed in 2612edit (LFO Freq)
    - mid2vgm is still terribly slooow. (making a 150 KB vgm on a PentiumII takes 2 minutes!)

    I included various DAC samples (the sounds of the most common GM drums) and various FM banks.

    Instruments.gyb is the default bank with all instruments from the old mid2vgm and some new ones.
    Instruments_WinFM.gyb is a conversion of the OPL2 instrument bank Windows FM used. Not all instruments are accurate because I don't know how I need to convert some of the rates correctly. Also all instruments with notes in [brackets] use special OPL2 wave forms the YM2612 doesn't have. (more inaccurateness)
    fmmidi_programs*.gyb are FM patches converted from <a href="http://sugarpot.sakura.ne.jp/yuno/?fmmidi" target="_blank">fmmidi</a>. They were originally stored in some opm-like format, but I was unable to convert them properly because the TL operators seem to behave slightly different from a usual YM2612. The _volfix bank usually sounds better, except for all sounds that use a strong noise.


    New 2612edit features:
    - support for AMS/FMS and global LFO
    - a lot more formats can be imported (amongst others .opm and .gyb, so copying and pasting instruments is now possible)
    - import multiple instruments at once (All button now only marks all instruments)
    - some small bugfixes


    Final note:
    mid2vgm is now quite usable, so I don't think I'll work on it a lot more. (I'll fix bugs if someone finds any)
    When I have a lot of free time I'll maybe rewrite it so that it doesn't use so many string operations anymore (-> huge speedup) and that it will check for used DAC samples.

    I think that's all.
    Enjoy and happy converting!
     
  16. Meat Miracle

    Meat Miracle

    Researcher Researcher
    1,634
    0
    0
    Hey, hey guys, here's a challenge: figure out a way to convert midi or mod files into Saturn SEQ tunes. MOD (or s3m/xm/it) would be even more awesome cause you could then include the sound samples too! In fact, with all the 68k gurus here, it may be feasible to write a straight modplayer for Saturn, that uses the SCSP hardware instead of software decoding/mixing. The 512k sound ram could be the only limitation (and with the ram expansion, that would be little problem too).
     
  17. nineko

    nineko

    I am the Holy Cat Tech Member
    Excellent work as always, ValleyBell.
     
  18. Mr Lange

    Mr Lange

    A wise guy eh. I know how to DEAL with wise guys. Member
    1,286
    0
    16
    The Land of Waldos
    Sonic Utopia, Sonic Overture
    As awesome as this is, I feel like it would be more intuitive to just go from midi to mod, then from mod to vgm using Shiru's vgm tracker. I'm still desperate for the opposite, a vgm2midi tool.
     
  19. ValleyBell

    ValleyBell

    Tech Members Tech Member
    236
    0
    0
    researching SMPS sound drivers
    <!--quoteo(post=604620:date=Jul 12 2011, 07:30 AM:name=Mr Lange)--><div class='quotetop'>QUOTE (Mr Lange @ Jul 12 2011, 07:30 AM) <a href="index.php?act=findpost&pid=604620"><img src="public/style_images/retro/snapback.png"></a></div><div class='quotemain'><!--quotec-->As awesome as this is, I feel like it would be more intuitive to just go from midi to mod, then from mod to vgm using Shiru's vgm tracker. I'm still desperate for the opposite, a vgm2midi tool.<!--QuoteEnd--></div><!--QuoteEEnd-->Does Shiru's vgm tracker support DAC samples at 48KHz or higher? And mid2mod means quantization (good bye, Pitch Bends).
    Btw: I thought <a href="http://www.smspower.org/forums/viewtopic.php?t=12441" target="_blank">vgm2mid</a> is already well known.

    <!--quoteo(post=604523:date=Jul 12 2011, 01:14 AM:name=Meat Miracle)--><div class='quotetop'>QUOTE (Meat Miracle @ Jul 12 2011, 01:14 AM) <a href="index.php?act=findpost&pid=604523"><img src="public/style_images/retro/snapback.png"></a></div><div class='quotemain'><!--quotec-->Hey, hey guys, here's a challenge: figure out a way to convert midi or mod files into Saturn SEQ tunes. MOD (or s3m/xm/it) would be even more awesome cause you could then include the sound samples too!<!--QuoteEnd--></div><!--QuoteEEnd-->There is an <a href="http://www.cyberwarriorx.com/?page_id=4" target="_blank">SEQ2MID</a>. The file reference says that SEQ files are quite similar to MIDIs (most MIDI commands are there), so mid2seq would be a lot easier than mod2seq.
     
  20. Meat Miracle

    Meat Miracle

    Researcher Researcher
    1,634
    0
    0
    I know, but without tone/sample data, a midi2seq app would be of little worth. That's why I thought of mods, where the samples can be possibly converted on top of the music sequence.