Previous Thread
Next Thread
Print Thread
Page 3 of 6 1 2 3 4 5 6
Joined: May 2005
Posts: 22
Junior Member
Offline
Junior Member
Joined: May 2005
Posts: 22
This is slightly off-topic, but any chance, Richard, of VGM logging being implemented in one of your Genesis emulators? I'd be intererested in logging a few games to submit to this site.

Joined: Dec 1969
Posts: 906
Senior Member
Online Content
Senior Member
Joined: Dec 1969
Posts: 906
Neither has accurate enough sound support at this time to make good quality VGM rips.

Joined: Mar 2001
Posts: 16,612
R
Very Senior Member
OP Online Content
Very Senior Member
R
Joined: Mar 2001
Posts: 16,612
Yeah, even on the PC only Kega Fusion is considered accurate enough to make really good VGM rips.

Joined: Jan 2005
Posts: 154
Senior Member
Offline
Senior Member
Joined: Jan 2005
Posts: 154
Yesterday I looked into the VGM format and found that it has significant problems with PCM samples. Basically the format logs writes to the sound chips. So far so good. But then it rounds the times of the writes to 1/44100 second precision. In the console they occur at something like 1/4000000 second precision. This isn't such a big deal for writes to the FM and PSG chip, but for PCM samples this causes the spacing between them to be ragged, for example 3, 3, 3, 2, 3, 4, 3, 3, etc.

I did a test of encoding a waveform with varying PCM rate and got a lot of aliasing when converting it to VGM. By simply increasing the precision of the VGM format 256 times what it normally is, all the aliasing went away. In my opinion, the format is broken and shouldn't be used for yet more sound chips. The fix is simple: record the time of writes in CPU clocks, thus no information is lost. That it's currently at the (common) output sampling rate is not proof of its accuracy; with sound chips you can arrange it so that a write one CPU clock later will cause a vastly different effect.

As for another format, I'm going to try making a simple convertor that takes a VGM/GYM and outputs one with each sample stored only once. It will be lossless; conversion from VGM to it and back should result in an identical file. Update: After twenty minutes of coding, using Sonic - Green Hill Zone as a test, I was able to reduce in-memory size from 2.4MB to 868K, and gzipped on-disk size from 590K to 28K. The next step is to eliminate the duplicate samples, which will affect in-memory size most.

Joined: Jan 2005
Posts: 154
Senior Member
Offline
Senior Member
Joined: Jan 2005
Posts: 154
I did a full size test using the Sonic 1 set as a test. First off, if they simply eliminated the gzip compression, they'd make the RAR archive 5.5 times smaller! I'll use this new sized archive as a more realistic baseline.

Using my new format, the set uses 1/3 the memory while playing, and an RAR archive of them is four times smaller. Merely gzipping the individual files (no RAR) makes them 2.5 times smaller than the baseline RAR, or 15 times smaller than the originals only gzipped. Here are the raw numbers:

* 5046 KB VGZ.RAR
*23029 KB VGM (no compression)
* 7855 KB MD (my new format)
* 887 KB VGM.RAR (no gzip)
* 247 KB MD.RAR
* 338 KB MD.GZ (each file individually gzipped)

I didn't even bother removing the redundant samples in this test, since gzip and RAR do fine at that (this is all based on the quick algorithm I wrote). At best, completely eliminating the sample data would halve memory requirements, and barely affect the compressed size (gzip or RAR).

As for logging accurate Sega Genesis/Mega Drive music, this should be easy to add to an emulator (and do it right), since it just involves logging sound chip writes.

(Sorry for posting what might not be very interesting to others. I just hate bloated file formats, especially when they're replacing a previously bloated file format.)

Joined: Nov 2005
Posts: 1
-
Junior Member
Offline
Junior Member
-
Joined: Nov 2005
Posts: 1
Quote:
Originally posted by blargg:
Using my new format, the set uses 1/3 the memory while playing, and an RAR archive of them is four times smaller. Merely gzipping the individual files (no RAR) makes them 2.5 times smaller than the baseline RAR, or 15 times smaller than the originals only gzipped. Here are the raw numbers:
Wow. Certainly would save us bandwidth, wouldn't that? laugh You should contact Maxim, the maintainer of the VGM format over at SMS Power . He's been meaning to add that kind of feature to the format for a while but never bothered since he's more into the 8-bit stuff. I'd love to see it added to the official spec. wink

Joined: Dec 1969
Posts: 906
Senior Member
Online Content
Senior Member
Joined: Dec 1969
Posts: 906
To be clear in my mind, this alteration you've made is completely lossless, i.e. you can convert back and forth between VGM and this?

Joined: Jan 2005
Posts: 154
Senior Member
Offline
Senior Member
Joined: Jan 2005
Posts: 154
Correct, you can recover the original VGM from the optimized version. I've just successfully run the optimizer on each track from Sonic the Hedgehog, Ristar, Pulseman, and Langraisser II, and every one verified. The "unoptimizer" used for verification could also be used as a quick way to make a current VGM player work with the format.

The change is trivial: replace the extremely common PCM output sequence 52 2A XX 61 0Y 00, where XX is PCM data and Y is a short delay, with the new command 8Y, and add XX to a PCM area after the logged data. Gzip is then able to compress PCM data greatly.

The huge Pulseman set goes from 29.5MB to 2MB. Memory use while playing is more than halved. I'll be getting this in motion.

Joined: Dec 1969
Posts: 906
Senior Member
Online Content
Senior Member
Joined: Dec 1969
Posts: 906
OK. Let me know when you've got the changes into the official spec and I'll implement it.

Joined: Oct 2004
Posts: 296
S
Senior Member
Offline
Senior Member
S
Joined: Oct 2004
Posts: 296
Can I assume that I can't access the VGM site at the moment because they're making the changes that blargg addressed? smile

Page 3 of 6 1 2 3 4 5 6

Moderated by  R. Belmont, Richard Bannister 

Link Copied to Clipboard
Who's Online Now
2 members (R. Belmont, 1 invisible), 45 guests, and 2 robots.
Key: Admin, Global Mod, Mod
ShoutChat
Comment Guidelines: Do post respectful and insightful comments. Don't flame, hate, spam.
Forum Statistics
Forums9
Topics8,835
Posts116,215
Members4,921
Most Online890
Jan 17th, 2020
Powered by UBB.threads™ PHP Forum Software 7.7.5