Skip to content

GEMSPlay: Is there an easier way to getVGMs to play at 50hz?

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

Moderator: Staff

GEMSPlay: Is there an easier way to getVGMs to play at 50hz?

Post by birdmanager6 »

One of the problem with GEMSPlay is that it always outputs at 60hz. This means that nearly every game music intended for 50hz will sound sped up. Some games (such as Aladdin and Earthworm Jim) actually use a faster tempo in the (E) version ROMs to make the music sound at the intended speed.
When I tried logging music at 60hz (in my case, from Kid Chameleon (W) [!]), I tried to change the speed by hex-editing the VGM header, and it technically made it play at 50hz (the pitch was slightly lower), but it adjusted the tempo to the speed it was originally recorded at. The same happened when I tried to change a VGM logged at 50hz to 60hz. The only way I could get it to play at the 50hz rate was with in_vgm, but it didn't change the pitch, and there's no option to convert to WAV like in foobar2000.
I am working on some music and sound effect rips of several MegaDrive GEMS games to WAV at a 50hz speed, and I would like to know, can you provide a better way of doing this? Such as an option to set GEMSPlay at 50hz or something? I really need help with this!

Also, another problem I am having with ValleyBell's tools is that the Data East converters don't seem to work correctly (I cannot rip any DAC samples no matter which commands I try, nor can I rip MIDIs from Capt'n Havoc or Side Pocket).
  • kirishima Offline
  • Posts: 82
  • Joined: 2015-06-18, 22:26:41

Post by kirishima »

You technically can convert to wav with winamp, however it's usually a direct conversion with no fancy stuff like dsp effects. Also, you need to make sure that you don't have the plugin set to play music infinitely, because winamp will record the output until the file is stopped by the user themselves potentially leading to really large files if you aren't paying attention. To output a wav, go into preferences ->output and select Nullsoft Disc Writer. Make sure that's configured properly before you attempt to convert the desired file to wav. Just play the file as you normally would and winamp will make the file.
  • User avatar
  • ValleyBell Offline
  • Posts: 4768
  • Joined: 2011-12-01, 20:20:07
  • Location: Germany

Post by ValleyBell »

The command line for extracting data from High Seas Havoc is:

Code: Select all

DEExtract.exe all "High Seas Havoc (U) [!].bin" 0
The last parameter doesn't matter and is ignored. It nevertheless wants 3 parameters. (Sorry, I never noticed that bug for some reason.)

Dumping MIDIs:

Code: Select all

de2mid.exe "High Seas Havoc (U) [!].bin" l 0x0D4300
GEMSPlay sadly is hardcoded to 60 Hz using this line:

Code: Select all

BUFFERSIZE = SampleRate / 60 * SAMPLESIZE;
I have to admit, that I had trouble figuring out how it controls the update speed after about 5 years. It's done by controlling the size of the audio buffers, which is weird. (It probably was the way SMPSPlay v1 worked and I just took it.)
Back when I made GEMSPlay I didn't care about 50 Hz support, because a majority of the games were developes for US systems anyway.

A possible way to play the VGMs at 50 Hz is: log the VGM, set the "recorded rate" of the VGM to 60 Hz (GEMSPlay should already do that) and set in_vgm/VGMPlay's "Playback Rate" to 50 Hz.
If you're using VGMPlay, you just edit the "LogSound" line in the .ini file in order to enable WAV logging. For in_vgm you select the "Disk Writer" output plugin in Winamp, just as kirishima already said.

Post by birdmanager6 »

Sorry about the late response, VB, but thank you so much for your input! :D
Yes, the in_vgm trick is a hacky solution, but it works! And I am now able to rip MIDIs and samples from Data East games as I wanted!
Also, I just realized, since you posted that line of code, that I don't have the source code to either GEMSPlay, DEPlay, or DEExtract. Could you please provide those? I might need them for future use.
Something else I've been thinking about (although not very much related to the topic), I know you like reverse-engineering MegaDrive sound engines, so if it's not too much trouble, I have an idea for a sound engine that you should reverse to MIDI in the future. If you're interested in doing such a thing, I'll give you a private message of what this is and some example games using it :)
  • User avatar
  • ValleyBell Offline
  • Posts: 4768
  • Joined: 2011-12-01, 20:20:07
  • Location: Germany

Post by ValleyBell »

In most cases the source code of my tools is either in the same archive as the .exe, or the release post contains a separate link to an archive with the source.
I don't always release the source for preview/beta versions, but I usually include it when I post the final version.

For DEPlay/DEExtract, the post is here. You can view a list of all supported games here.
All GEMS related stuff is here.
The source code for all MIID converters so far is on GitHub.

About reverse-engineering sound engines: You can always ask, but whether or not I actually do it depends on my spare time and mood. (and maybe how much I like the music produced by the sound driver)
Post Reply