don't click here

Curious YM odd frequency shifts.

Discussion in 'Engineering & Reverse Engineering' started by MarkeyJester, Apr 1, 2024.

  1. MarkeyJester

    MarkeyJester

    You smash your heart against the rocks Resident Jester
    2,316
    565
    93
    Japan
    I've been researching some YM2612 quirks for several months now, and have noticed some instruments haven't quite been playing correctly in officially licensed games, not the fault of SEGA or the IP creators, as most hardware functions properly, but there are a few outliers, for instance, the Mega Drive/Genesis 2 (which makes perfect sense, as the MD2 doesn't actually have a YM2612, it's a lesser known stripped down version), however, many emulators have a similar problem.

    So what I've done, is modified this Sonic 1 ROM to auto-correct frequencies by dithering the odd ones. (WARNING: The SEGA sound is loud, it's because of that stupid disassembly bug, so be sure to reduce the volume for this part, sorry, not really had the time to fix these silly things, been more focused on the operator FM stuff).

    I'm certain I can hear a difference, but I might be biased since I know what I'm listening for. Let me know your thoughts.

    Why am I dithering the odd frequencies? Here's why...

    Whilst recording from my MD2, I recorded about 5 hours worth of single operator sinewaves, all with operator MUL 1, unfortunately, I can't exactly post a screenshot of all 3FFF variations, here's the whole thing to get an idea:

    [​IMG]

    You can see where each octave is, all 8 of them.

    ...however, I noticed something strange, all of the odd frequencies are not at the frequency they're supposed to be, they're all slightly slower than they should be. So I've applied dithering by shifting the frequency from odd, to its next even above every 2/3 frames, the slower frequency shift ended up being approximately 23.87%, so it had to be quantised unfortunately.

    ...I might try and do the same for Sonic 2's driver, I'm sure I can generate the Z80 equivalent of the dithering mechanism.

    I mean, it could just be one of those things where, the human ear simply can't tell, and I'm more than ready to accept being wrong and dub this all a bit of a failure.
     
    • Like Like x 7
    • Informative Informative x 4
    • List
  2. Clownacy

    Clownacy

    Tech Member
    1,177
    894
    93
    I just spent the last hour staring at my emulator's FM code and Nuked OPN2's extremely cryptic code trying to find the cause of the bug you're describing, to no avail. I didn't think to try the ROM you'd given until now. But you're right - even I can hear the difference. This is mind-blowing.
     
    Last edited: Apr 1, 2024
  3. DigitalDuck

    DigitalDuck

    Arriving four years late. Member
    5,461
    508
    93
    Lincs, UK
    TurBoa, S1RL
    Can't believe it was such a simple fix. I've always thought the original music sounded a bit discordant.
     
  4. Devon

    Devon

    pfp by @litchui on Twitter Tech Member
    1,582
    1,961
    93
    your mom
    I dunno... for the most part it is indeed improved, but there seems to be this really strange issue with FM4 where it randomly becomes even more discordant... for like a second. Very curious...
     
    Last edited: Apr 2, 2024
    • Informative Informative x 1
    • List
  5. MarkeyJester

    MarkeyJester

    You smash your heart against the rocks Resident Jester
    2,316
    565
    93
    Japan
    I hope you're joking, otherwise I feel rather bad for wasting your time lol
     
  6. Clownacy

    Clownacy

    Tech Member
    1,177
    894
    93
    Unfortunately not. At least it gave me a chance to ensure that my emulator's logic was accurate to real hardware.
     
  7. Chimes

    Chimes

    The One SSG-EG Maniac Member
    1,072
    740
    93
    Playing with the sound IDs... Directly poking FFF009 to value B8 shows some curious behavior with ingame music (although BlastEm did not like it when handled this way).
    Sound ID B0 has some really strange frequency discrepancies when retriggering it. Wonder what's going on there?
     
  8. MarkeyJester

    MarkeyJester

    You smash your heart against the rocks Resident Jester
    2,316
    565
    93
    Japan
    If it makes you feel any better, I'm not lying about the odd frequencies, I just lied about them being MD2 and emulation and having a fix for it.

    The recording is actually from my MD1, and the odd frequencies are still shifted off, it's very subtle and you won't hear it, but if you graph the frequencies it doesn't flow mathematically. It's what stopped me from emulating my own YM2612, I was aiming for strict accuracy, and this put a wedge in my progress so I shelved it.