Skip to content

(YM2612 + SN76489) to YM2610B / YM2608 VGM converter

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

Moderator: Staff

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

Post by ValleyBell »

A high number of E0 commands is okay, actually.
"E0" does not mean "here begins a new sample".
"E0" means "continue playing the data block from position X".

E.g. if the game streams silence for a long period of time, it will seek to [offset with silence], issue about 24 commands 8x, then seek back to that offset, issue 24 times command 8x, etc - until the DAC stream changes.
This is what seems to happen in Mega Turrican a lot.

(trivia: I know that the "Worms" DAC driver does this as well, in order to allow for multichannel software mixing. But I "optimized" those redundant "write sample 0x80" commands out in order to reduce the file size before submitting the pack.)
  • Yarm Offline
  • Posts: 20
  • Joined: 2016-05-09, 0:19:46
  • Location: England

Post by Yarm »

Thanks ValleyBell, that makes sense!

Ive found the issue, there is indeed silence at the start of the data block but I made a copy paste error and was reading the first 8 bytes of sample data as rom size and memory offset (like you do for ADPCM) but the block type 0 dosent have this! so the slience was actually playing the first 8 bytes of the first sample creating the buzz!
  • denjhang Offline
  • Posts: 95
  • Joined: 2021-03-24, 4:44:34
  • Location: hk

Can you share the source code of the hardware part?

Post by denjhang »

Yarm wrote:OMG Ive been doing the exact same thing this weekend!
Got it playing Titan Overdrive II pretty well on a YM2610!
I have used the Delta-T for PCM playback, it only works with the fast call command 0x95 though.
Ive been thinking about ways to translate 0x80 to 0x8F send dac and wait, I have an idea, will work on it this week.
Also to do - is translate the FM clock somehow as my player is 8MHz not the 7.whatever MHz of the Megadrive.
SN to SSG conversion works pretty well apart from when tone + noise is played together then noise has to take on tone volume.

I also made a hardware player using a XC95288XL CPLD and a 4MB RAM!

I'll share the code when Ive done the 2 points above if you're interested, Its in visual basic 2017 though.
  • denjhang Offline
  • Posts: 95
  • Joined: 2021-03-24, 4:44:34
  • Location: hk

lol

Post by denjhang »

I am very interested in the OPNB VGM hardware player project.
Because the chip has enough FM and PCM channels, it can write a lot of amazing music for the chip, such as the music of the Metal Slug or the King of Fighters series is really impressive.
  • Yarm Offline
  • Posts: 20
  • Joined: 2016-05-09, 0:19:46
  • Location: England

Post by Yarm »

All of drr's work is on github as he says in his first post.

My board and software is a bit hacky and not really complete or user friendly so am not comfortable releasing it.
When I've got something decent together with the convertor software I'll post it here when I'm ready.
  • Yarm Offline
  • Posts: 20
  • Joined: 2016-05-09, 0:19:46
  • Location: England

Post by Yarm »

I have managed to get something working now with a fusion of our ideas.

I have created a VGM which uses a 44100 Hz DAC track but its split up into separate blocks and sample play commands based off 0xE0.
It checks each block to see if the values are all the same to detect silence (Thanks ValleyBell for that pointer) and then remove them reducing the file size a little and also having small blocks helps keep sync, seeking and looping.
Not tried on real hardware, it may not work with there being many very short blocks.

Next step is some crazy routine to compare all the blocks to find duplicates and optimise it!
Attachments
MegaTurricanOpeningTheme.zip
(1.98 MiB) Downloaded 222 times
  • Yarm Offline
  • Posts: 20
  • Joined: 2016-05-09, 0:19:46
  • Location: England

Post by Yarm »

Just found out that my YM2610B has a painted on B ! Its not a B, I thought something was missing from the sound.
I found in my component drawers 5 YM2610B's and I've tried them all and they're all dead, all of them. :(

Anyway, I'm attaching the latest version of Overdrive2, I've changed the noise channel pitch, fixed the silly 8 byte sample offset, and its now 8MHz.
Attachments
Overdrive2_YM2610_8MHz.zip
(1.33 MiB) Downloaded 236 times
  • denjhang Offline
  • Posts: 95
  • Joined: 2021-03-24, 4:44:34
  • Location: hk

good!

Post by denjhang »

Yarm wrote:I have managed to get something working now with a fusion of our ideas.

I have created a VGM which uses a 44100 Hz DAC track but its split up into separate blocks and sample play commands based off 0xE0.
It checks each block to see if the values are all the same to detect silence (Thanks ValleyBell for that pointer) and then remove them reducing the file size a little and also having small blocks helps keep sync, seeking and looping.
Not tried on real hardware, it may not work with there being many very short blocks.

Next step is some crazy routine to compare all the blocks to find duplicates and optimise it!
  • drr Offline
  • Posts: 10
  • Joined: 2021-03-14, 10:15:59

Post by drr »

Good to know about the PSG noise usage, thanks ValleyBell. If that covers most use cases then the “real” SSG noise would be a good enough starting point for conversion.

New VGM sounds really good. Titan Overdrive’s a nice demo to exercise this with since it’s much longer than pretty much any game track. I’m side tracked with another hardware project for another day or two but I’ll be back later to write the Python equivalent of this. Looks like all the ideas thought up in this thread have worked out pretty well in practice.
  • Tom Offline
  • Ragequit Member
    Ragequit Member
  • Posts: 496
  • Joined: 2011-11-30, 17:26:44
  • Location: Italy
  • Contact:

Post by Tom »

drr wrote:Titan Overdrive’s a nice demo to exercise this with since it’s much longer than pretty much any game track.
In case you'll ever want another long track for further testing, you can look into Langrisser II.

Green Grove 2 from Sonic 3D is more popular, but it's a bit shorter.

Also:
ValleyBell wrote:Anything based on the GEMS driver can use all 4 PSG channels are once. But on the other hand, GEMS-based soundtracks rarely use the PSG.
The same applies to the Cube driver: it can use all the PSG channels at the same time, but it rarely uses any of them at all.
Attachments
.png
.png (2 KiB) Viewed 5224 times
.png
.png (2 KiB) Viewed 5226 times
Also known as nineko.
  • drr Offline
  • Posts: 10
  • Joined: 2021-03-14, 10:15:59

Post by drr »

Thanks Tom, going to try a few of those when it comes time to optimise this.

Had some time to work on this again. Trimming silence like mentioned above is saving lots of space but it's all I'm doing at the moment. Scanning for repeat sample blocks might be next

I have this Mega Turrican track playing OK on a real YM2610B. I did hear an issue though when testing on vgmplay. When I take this same VGM that sounds OK on hardware and play in vgmplay (as a YM2610B track), I hear what sounds like bad FM notes. Odd thing is the YM2612+PSG original sounds fine in vgmplay and is pretty close to what I get on the real chip. It starts around the 13 second mark and it’s more obvious around 01:05. Is the VGM malformed or is something else going on here?
Attachments
megaturrican_st1_convert.zip
(2.33 MiB) Downloaded 232 times
  • Yarm Offline
  • Posts: 20
  • Joined: 2016-05-09, 0:19:46
  • Location: England

Post by Yarm »

Sounds great and it seeks ok too in winamp.
I wouldnt have noticed if youd hadnt pointed it out at 13 seconds, but yes I can hear it.
I noticed similar issues in Overdrive 2, I ignored it as I thought that track was doing clever things to push the chip and was confusing the winamp plugin.
The only thing I could think of is it could be using SSG-EG, special channel 3 mode, CSM or something along those lines, except that, that sound is on channel 4 so its probably not that.
  • drr Offline
  • Posts: 10
  • Joined: 2021-03-14, 10:15:59

Post by drr »

I wondered about the CHx and CSM modes since it’s called “CH2” instead of CH3 in the 2610 docs, wondering if the channel supported is totally different then. Probably not the issue if it’s CH4 playing it and it does sound OK on real hardware. I didn’t compare overdrive 2 with the original, is there a link to it or did you dump it from an emulator? Bit limited by my options a Mac so not sure which one is best
  • Yarm Offline
  • Posts: 20
  • Joined: 2016-05-09, 0:19:46
  • Location: England

Post by Yarm »

Theres a link in the comments for the demo on pouet.net
http://www.pouet.net/prod.php?which=69648
  • drr Offline
  • Posts: 10
  • Joined: 2021-03-14, 10:15:59

Post by drr »

Thanks, I'll try that one out too. I attached an AAC file with audio captured from one of my YM2610Bs using the previous VGM file. It makes the difference between what I hear in vgmplay and what I hear from the h/w player more obvious. I think it sounds OK all things considered, maybe the SSG pot needs tweaking to match whatever mixer setup Sega used.

Luckily two of my spare chips seem OK. One is completely busted though, it's not fake because I hear 6 FM voices but I also hear it randomly keying on notes when it's not supposed to!
Attachments
mt1-ym2610b-capture.aac.zip
(4.38 MiB) Downloaded 227 times
Post Reply