Page 1 of 2

VGM player from SMS on MD or GENESIS

Posted: Wed Aug 13, 2008 4:02 pm
by tinctu
Is there any Sega Master System *.VGM (Texas Instruments soundchip) music player for Sega MEGADRIVE???

Posted: Wed Aug 13, 2008 5:32 pm
by mic_
Any VGM player for the Megadrive should be able to play files that only use the PSG, unless it's ignoring the PSG write commands.

Posted: Wed Aug 13, 2008 5:43 pm
by TmEE co.(TM)
There is a MD VGM player, but it doesn't work on real HW, and the author is too lazy to get it working :(

Posted: Wed Aug 13, 2008 7:15 pm
by mic_
This seemed like a simple enough task, so I decided to write a player (you can get it here).

To create a Megadrive binary from a VGM file, use the following command in a windows commandline window: copy /B /Y vgmplay.bin + filename.vgm output.bin

This appends your (uncompressed) VGM to the player code and creates a binary that you can run on your Megadrive, or in an emulator. The zip includes an example (smurfs.bin) with one of my favorite SMS songs added.

Note that my player ignores all wait commands except 0x62/0x63, so songs that rely on shorter waits will probably sound weird. It still seems to work fairly well, and it runs on HW (at least on my european Megadrive). And the source code is included if you want to improve it in any way.

Posted: Thu Aug 14, 2008 12:52 pm
by tinctu
Thank You _mic I will test it...

Posted: Sun Aug 17, 2008 11:45 pm
by Christuserloeser
Thanks a lot mic_ :D

Posted: Mon Aug 18, 2008 3:57 pm
by mic_
Here's an updated version of the player. It now supports all wait commands, and uses the YM2612 for timing instead of vsync, so it should work better.

Posted: Mon Aug 18, 2008 11:16 pm
by Christuserloeser
Thanks again! :)


- Do you think it can be updated to play MD VGM files too ? Also, I would like to know if it supports GG stereo files ?

Posted: Tue Aug 19, 2008 6:50 pm
by TmEE co.(TM)
GG stereo can't be done on MD's PSG, though if you use YM2612 to do the PSG, you can have that stereo.

Posted: Tue Aug 19, 2008 7:29 pm
by Shiru
TmEE co.(TM) wrote:if you use YM2612 to do the PSG, you can have that stereo.
One small problem. You'll get stereo, but with completely different sound - YM2612 can't generate square tone and can't generate noise which will at least resemble noise of PSG. It's possible to get somewhat resembling 'Enhance PSG' feature of Dega, though.

Posted: Tue Aug 19, 2008 7:36 pm
by TmEE co.(TM)
Noise would stay as PSG... squares aren't difficult at all, only minor tonal difference.

Posted: Wed Aug 20, 2008 5:49 am
by Chilly Willy
With four operators, square waves are easy. Set the first to the center freq, the next to the third harmonic, the next to the fifth harmonic, and the last to the seventh harmonic. That'll make a better square wave than the PSG can make. :lol:

Posted: Wed Aug 20, 2008 8:12 am
by mic_
Set the first to the center freq, the next to the third harmonic, the next to the fifth harmonic, and the last to the seventh harmonic.
You can only set the frequency per operator on channel 3, though.

Posted: Wed Aug 20, 2008 9:22 am
by Nemesis
You can only set independent frequencies for channel 3, but every operator in every channel has a "multiple" register, which allows you to set that operator to a harmonic ratio of the common frequency for that channel. The available settings are 1/2, and 1-15. So, even though the common frequency might be 440, you could set operator 1 to 1*freq, operator 2 to 3*freq, operator 3 to 5*freq, and operator 4 to 7*freq using the separate mul register setting for each operator.

The completely separate frequency registers for each operator which you can set for channel 3 allow you to set frequencies for each operator that are inharmonic, which is actually not that common a thing to require. The separate detune register for each operator can be used to achieve slight inharmonic adjustments for each operator, so the completely separate frequency registers are only needed for more severe detuning, or dissonant sounds.

Here's a really good video that explains what that all means:
http://insidesynthesis.blogspot.com/200 ... chive.html
I don't think I really "got" FM synthesis until I watched this video.

Posted: Wed Aug 20, 2008 2:07 pm
by TmEE co.(TM)
That video Nemesis posted explains everything.

I have an istrument that uses 2 operators, and while what you see on the o-scope screen doesn't really look like square wave, it certainly sounds square. If anyone wants, I can give you the TFI of the instrument.