don't click here

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
    6,308
    486
    63
    italy
    PLEASE NOTE: ValleyBell improved the midi to vgm converter, and he released it just a few posts below.

    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.
    ---------------------------------------------------
    Download here. 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 (use ValleyBell's converter for that one), 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:
    LBZ1 PC
    Unused S&KC song
    Proof of concept of pitch bend

    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.
     
  2. LordOfSquad

    LordOfSquad

    bobs over baghdad Member
    5,199
    239
    43
    Winnipeg, MB
    making cool music no one gives a shit about
    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!

    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 Member
    246
    25
    28
    researching PC-98/X68000 sound drivers
    Nice tool! And it works quite well.
    Here is S&K PC - CNZ1: VGM, Source MIDI (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
    6,308
    486
    63
    italy
    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, work computer.
     
  7. nineko

    nineko

    I am the Holy Cat Tech Member
    6,308
    486
    63
    italy
    Make sure you have MSVBVM50.DLL and COMCTL32.OCX 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 other obvious one. 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
    6,308
    486
    63
    italy
    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. 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.)
     
  11. Shadow Hog

    Shadow Hog

    "I'm a superdog!" Member
  12. MaliceX

    MaliceX

    hi i code and quack. Oldbie
  13. nineko

    nineko

    I am the Holy Cat Tech Member
    6,308
    486
    63
    italy
    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.
     
  14. ValleyBell

    ValleyBell

    Tech Member
    246
    25
    28
    researching PC-98/X68000 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 mid2vgm 2612.
    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 fmmidi. 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!
     
  15. Meat Miracle

    Meat Miracle

    Researcher
    1,664
    5
    18
    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).
     
  16. nineko

    nineko

    I am the Holy Cat Tech Member
    6,308
    486
    63
    italy
    Excellent work as always, ValleyBell.
     
  17. Mr Lange

    Mr Lange

    A wise guy eh. I know how to DEAL with wise guys. Member
    1,286
    11
    18
    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.
     
  18. ValleyBell

    ValleyBell

    Tech Member
    246
    25
    28
    researching PC-98/X68000 sound drivers
    Does Shiru's vgm tracker support DAC samples at 48KHz or higher? And mid2mod means quantization (good bye, Pitch Bends).
    Btw: I thought vgm2mid is already well known.

    There is an SEQ2MID. 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.
     
  19. Meat Miracle

    Meat Miracle

    Researcher
    1,664
    5
    18
    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.