Forums

Sega Master System / Mark III / Game Gear
SG-1000 / SC-3000 / SF-7000 / OMV
Home - Forums - Games - Scans - Maps - Cheats - Credits
Music - Videos - Development - Hacks - Translations - Homebrew

View topic - Is it possible to convert a Genesis VGM file from YM2612 to YM2413?

Reply to topic
Author Message
  • Joined: 10 Dec 2006
  • Posts: 35
Reply with quote
Is it possible to convert a Genesis VGM file from YM2612 to YM2413?
Post Posted: Thu Sep 30, 2010 3:46 am
For example, If I want to convert a genesis game's song:

''Lemmings - Sunsoft Special.vgm''

from YM2612 to the YM2413, Would it be possible with a Hex Editor?

Better yet, Is there an direct assembler/disassembler for VGM files?

Sorry if I am asking any wrong questions!
  View user's profile Send private message
  • Joined: 16 May 2002
  • Posts: 1356
  • Location: italy
Reply with quote
Post Posted: Thu Sep 30, 2010 7:58 am
The 2612 and the 2413 are quite different chips. The 2413 can play more channels than the 2612, but it has a way smaller number of selectable instruments. Similar issues might arise with the drums, as the 2612 can use a dedicated PCM channel while the 2413 uses a fixed drumkit, which fortunately isn't that bad, though.

There might be a way to perform the conversion you're asking for, but don't expect it to be trivial, and keep in mind that it would probably sound considerably different from the original version.
  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 14726
  • Location: London
Reply with quote
Post Posted: Thu Sep 30, 2010 8:52 am
Your easiest method may be to use MIDI as an intermediate format., although that would probably make it sound awful.

You could do this conversion by manually mapping instruments, but there's no tool to do that. The trick is to figure out equivalents for the various changes, e.g. when the YM2612 sets a frequency, emit the equivalent code to set it on the YM2413. Key events are probably similar. Volume envelopes may have some similarities, but may be tricky to convert. More advanced features may just have to be dropped.
  View user's profile Send private message Visit poster's website
  • Joined: 15 Sep 2009
  • Posts: 377
Reply with quote
Post Posted: Thu Sep 30, 2010 11:35 am
I was thinking of a mid2vgm converter for YM2413 some time ago. (I wrote a mid2vgm for PSG that is still unfinished.)
I don't have started to write it yet, but it won't take me more than one day. So there's some distant light.

EDIT: I read that MAME once supported YM2203 (which is similar to YM2612) playback via OPL. Using this core it might be possible to convert YM2612 instruments to YM2413 (or at least "guess" them).
Unfortunately I can't find any sources. (MAME 0.23 source had it only in precompiled form)
  View user's profile Send private message Visit poster's website
  • Joined: 16 May 2002
  • Posts: 1356
  • Location: italy
Reply with quote
Post Posted: Thu Sep 30, 2010 4:43 pm
It's not hard to retrieve all the parameters (such as RS, AM, TL, ...) of the instruments used by the 2612 starting from a vgm file, all you have to do is to look for the involved registers ($30 and so on). I don't know how feasible it would be to find similar 2413 instruments, though, especially because only one of them is customisable, if I remember correctly.
  View user's profile Send private message Visit poster's website
  • Joined: 10 Dec 2006
  • Posts: 35
Reply with quote
Post Posted: Sat Oct 02, 2010 3:21 am
Thanks Guys, I have already known some VGM internals already (as of v1.50)

But The problems are:

#1: Actually Making Instruments for the 2413
#2: Actually Making it Work on Winamp (5,xx)
#3: Is v1.50 really the latest specifications of the regular VGM format? (The one in the Music/VGM Help page)

The final option is (unless stated otherwise or problems are added):

#4: If this doesn't work: Asking Martin of Mod2PSG2, for the next version to have the capability to Edit and Convert Parts of Genesis 2612 to SMS 2413 format along with reformatting and making your own samples (as well as adding 2413 VGM support and editing )
  View user's profile Send private message
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 14726
  • Location: London
Reply with quote
Post Posted: Sat Oct 02, 2010 7:47 am
hamtaro126 wrote
#1: Actually Making Instruments for the 2413
#2: Actually Making it Work on Winamp (5,xx)
#3: Is v1.50 really the latest specifications of the regular VGM format? (The one in the Music/VGM Help page)

#1: Too hard. Ask the user to select from the 15 predefined instruments. Only one channel can have a custom instrument and mapping a YM2612 instrument to YM2413 will be hard and inaccurate.
#2: The VGM file will work with in_vgm if it is valid.
#3: There are some unofficial extensions supporting other chips but 1.50 has everything you need for YM2612 and YM2413.
  View user's profile Send private message Visit poster's website
  • Joined: 01 Aug 2012
  • Posts: 322
  • Location: Porto, Portugal
Reply with quote
Post Posted: Tue Jun 27, 2017 11:39 am
btw, seeing that ym2413 is a kind of simplified version of ym3812, i was trying this from Boriel’s ZX-Basic Compiler, and only got some glitches (i tried with vgm files from arcade Rygar and Flying Shark - i was expecting at least hearing notes, not glitches):

(it’s just a part of the code just for having some idea of what i did)

out $F2,$FF
do
eee=peek(@vgm01+ee0)
  if peek(@vgm01+ee0)=$50 then
    ee0=ee0+1
    eee=peek(@vgm01+ee0)
    out $7F,eee
    end if
  if peek(@vgm01+ee0)=$51 then '- ym2413
    ee0=ee0+1
    eee=peek(@vgm01+ee0)
    out $F0,eee
    ee0=ee0+1
    eee=peek(@vgm01+ee0)
    out $F1,eee
    end if
  if peek(@vgm01+ee0)=$5A then '- ym3812
    ee0=ee0+1
    eee=peek(@vgm01+ee0)
    out $F0,eee
    ee0=ee0+1
    eee=peek(@vgm01+ee0)
    out $F1,eee
    end if
  if peek((@vgm01+ee0) band $70)=$70 then
    ee1=((peek(@vgm01+ee0)) band $F)+1
    smsdelay(ee1*efc)
    end if
  if peek(@vgm01+ee0)=$62 then
    smsdelay(735*efc)
    end if
  if peek(@vgm01+ee0)=$61 then
    ee1=(peek(@vgm01+ee0+2))*256+(peek(@vgm01+ee0+1))
    smsdelay(ee1*efc)
    ee0=ee0+2
    end if
  if peek(@vgm01+ee0)=$66 then
    ee0=48
    end if
ee0=ee0+1
loop


i guess that there would be a kind of registers conversion table, or seeing that converting between one and another seems to be not that impossible?
  View user's profile Send private message Visit poster's website
Reply to topic



Back to the top of this page

Back to SMS Power!