mamedev / mame

MAME
https://www.mamedev.org/
Other
8.02k stars 1.99k forks source link

YM2608 SSG-EG inaccuracy #4887

Closed jpcima closed 3 years ago

jpcima commented 5 years ago

Hi, the generic FM synthesis core fm.cpp has a defect in SSG-EG generation: the effect is slower, weaker than it must be.

This was confirmed by Rerrah, author of Bamboo Tracker software, by comparison to real YM2608 on one test case. more here https://github.com/rerrahkr/BambooTracker/issues/93

We also found the precise Nuked-OPN2 core to match the real YM2608 recording in its output, when it was running at the identical clock frequency.

The defect can be verified in vgmplay, and various software which use the generic MAME core: BambooTracker, libOPNMIDI, libvgm. I'm pretty sure also, from libOPNMIDI experience, that the independent fm2612.cpp core does not have the defect, it is specific to the multi-chip FM source.

I join a set of VGM captures, and sound samples of MAME vs expected output. It's likely the same problem as this (same core different chip): https://mametesters.org/view.php?id=1066

The files: MAME2608-ssgeg.zip

(note: I would have attempted a report on Mantis but got 500 error on posting; I hope here will be fine instead)

rb6502 commented 5 years ago

Can you provide some sort of executable-in-MAME test case? "Fix this, and you'll know it's right after someone copies it into some other software" is not a compelling bug report :)

jpcima commented 5 years ago

The vgm files provided in the archive run in MAME. I ran these myself in MAME 0.208 Linux self-compiled, by the command mame vgmplay. I obtained the same result sound either in MAME or outside, for what I've tested.

About the original bug report of YM2203 SSG-EG, this has been asked:

The register dump would be much appreciated .... The samples are a good base to start, but the registers would allow easy tracking of code.

This is what I provide with this VGM file set: a register capture + MAME sound output vs. expectation. If you would like me to name a game which exhibits the problem, in this case I'm sorry but I don't know any.

If don't know how I can be of better help than this, but if I can in some other way then let me know.

jpcima commented 5 years ago

For complementary information, I gathered some data which I believe to be relevant by comparing the devices fm and fm2612, as they ran in mame vgmplay at identical clocks.

engine2608.vgm.gz engine2612.vgm.gz

I plotted an output of ch0,slot0 variable out before(1) and after(2) an inverting condition from advance_eg_channel.

https://github.com/mamedev/mame/blob/845984a1e5ce4b2bbab7b9d9a8e047c77ad4cadb/src/devices/sound/fm.cpp#L1254-L1256

YM2612 alternance cycle will be observed twice as frequent. More importantly also, it will be seen that YM2608 will invert (due to ssgn=2) and YM2612 not (ssgn=0).

fmopn

aaronsgiles commented 3 years ago

Suspect this is addressed with the FM rewrite, but need to verify.

aaronsgiles commented 3 years ago

These seem to be fixed with the FM rewrite.