Skip to content

New VGM to MIDI + OPM + SYSEX tool for YM2151

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

Moderator: Staff

  • Yarm Offline
  • Posts: 20
  • Joined: 2016-05-09, 0:19:46
  • Location: England

New VGM to MIDI + OPM + SYSEX tool for YM2151

Post by Yarm »

Hi, I've just spent the last week creating a program to convert VGM into MIDI with voices in SYX for the Yamaha FB-01 that I just bought!
It also creates OPM files for VOPM.

The idea is that the MIDI generated has its instrument numbers match the SYX or OPM voice numbers, so you can simply load the SYX into your FB-01 or import the OPM into VOPM and then play the MIDI file to it and it will simply just work!

It maximises all the voices volumes, it uses the algorithm to determine which operators' TL value to pay attention to (the carriers and not the modulators).
It then finds the lowest TL in this group of carriers and then subtracts that value from all of the carriers.
The cool thing is this amount can then be used for the midi's volume command (with some maths to do db to gain)
It also helps when comparing voices to find duplicates.

I tested my program thoroughly with my FB-01, there were loads and loads of snags on the way.
It's been quite tough to get everything right.

A couple of things I learnt...
1. The operator order of the YM2151 registers is different than the FB-01 (and OPM files too)
2. You must set the modulator/carrier flag on the FB-01, otherwise volume dosent work!

The tool lacks proper Windows style, i.e no menu strip or proper file open dialog, theyre are easy to add, but not done yet.
The tool wont open VGZ files (yet!)
I haven't added support for L/R pan yet.

I am struggling pinning down a problem when converting Street Fighter II - Ken, the bell sounds seem all wrong, but all my other tunes seem spot on, anyone care to test this for me?

I have attached a zip file with source, the exe is in bin\Debug

My thanks to:
Paul Jensen for vgm2mid 0.5 (dunno if this an old version, I downloaded it years ago)
Martin Tarenskeen for TX convert (I found 2 little bugs in this BTW which I have fixed in my code)
Luke McQueen for his arcade OPM collection

Without these people and their hard work, there is no way I could have done this.


09/05/16 Fixed a sysex writing bug and file open bug, zip file re-uploaded
17/05/16 Changed note decoder function to work a different way to try and fix dropped notes, zip file re-uploaded
25/12/17 File re-uploaded
29/12/17 Added the ability to change the BPM and TQN
Attachments
VGM_to_MID.zip
(101.05 KiB) Downloaded 5976 times
Last edited by Yarm on 2017-12-29, 14:06:24, edited 6 times in total.
  • User avatar
  • MaliceX Offline
  • Posts: 226
  • Joined: 2012-09-29, 11:45:48
  • Location: Australia
  • Contact:

Post by MaliceX »

Haven't tried this out yet but whoa the premise of this is NEAT!
-dj.tuBIG/MaliceX

Post by 1983parrothead »

Doesn't seem to work for all arcade VGMs like Power Drift.
  • Yarm Offline
  • Posts: 20
  • Joined: 2016-05-09, 0:19:46
  • Location: England

Post by Yarm »

Whats it doing?
I've just give it very quick try with 2 of the tracks from power drift and it seemed to work for me.
It might be that power drift also uses the Sega PCM chip and uses it for the bulk of the music, my program will ignore anything that isn't YM2151.

Post by 1983parrothead »

After converting Side Street to MIDI, it sounds like it didn't capture all channels when imported to FL Studio or other MIDI studios.
  • Yarm Offline
  • Posts: 20
  • Joined: 2016-05-09, 0:19:46
  • Location: England

Post by Yarm »

I have just tried it again and it sounded like it was dropping notes so I have re-written the note decoder function in a different way and its seems better to me.
I've not used FL Studio before so am not sure if something else is happening too.
Please try it out and let me know if its better.

Edit: It seems to have fixed Street Fighter II - Ken 1 too (as I mentioned in my first post) :)

Post by 1983parrothead »

Still sounds like the piano channel has been multiplied about four times.

Post by 1983parrothead »

Hello again. Please also get other platforms to work, like PC Engine, PC-98 and others.

Post by vampirefrog »

Great job, Yarm.
  • Yarm Offline
  • Posts: 20
  • Joined: 2016-05-09, 0:19:46
  • Location: England

Post by Yarm »

Thanks :)
I hope it proves useful to some people.
It would be nice to hear off anyone that has got some good results from this.

Post by 1983parrothead »

*bump*

I decided to let you know the differences between MDX converters and VGM converters. See if OKI M6295 channels in MIDI form can be converted as well.

MDXPG seems to convert better, so why not look at the structural differences between MDX and VGM files.
  • ctr Offline
  • Posts: 492
  • Joined: 2013-07-17, 23:32:39

Post by ctr »

MDX format uses the MSM6258 (used in the X68000) while VGM files support both the 6258 and MSM6295 (Used in arcade machines). The chips work differently, the 6258 reads streamed APDCM data while the 6295 reads data from a ROM. In the case of the 6295 it would be pretty easy to both rip samples and convert commands to MIDI.

For the 6258 this is much harder, it's hard to detect where a sample begins and where it ends. Fortunately, Valley Bell has spent a lot of effort into optimization and the optimized VGMs should contain at least some data (DAC stream commands) that might help with conversions. But it might not be perfect...

Post by 1983parrothead »

Indeed. There's a tROMbone app that's made to rip OKI6295 samples, but I can't seem to rip from Hotdog Storm nor Hyper Duel.
  • ctr Offline
  • Posts: 492
  • Joined: 2013-07-17, 23:32:39

Post by ctr »

Well if you just want the samples, you can open the VGM file (make sure it's uncompressed first!) in Audacity. Import as raw, when it prompts you for the file format, select VOX ADPCM.

Post by 1983parrothead »

Fails like tROMbone. Perhaps not perfect ROM dumps?
Post Reply