MiSTer-devel / Gameboy_MiSTer

Gameboy for MiSTer
101 stars 48 forks source link

PCM audio buzzing in GBC games #232

Closed l33tr closed 1 year ago

l33tr commented 1 year ago

Similar to issue #143, but is not solved in latest release (20230102)

In games with PCM audio, the original sound can be heard, but there is a loud buzzing on top of it.

I have tested the latest release, as well as "[Gameboy_pcm_20221126.zip]" from #143, but still experience the issue.

Of note, games that were mentioned in #143 appear to work fine (see video examples).

Please see below for examples.

Snoopy Tennis (does not work): https://youtu.be/6RcEycslGHY

LEGO Stunt Rally (does not work): https://youtu.be/mwMY2Hh-DCo

10-pin Bowling (does work, same as #143): https://youtu.be/YqHptwiAAG8

SegaSnatcher commented 1 year ago

Good catch! Interesting that some games with this issue have been fixed, but not all.

maij commented 1 year ago

I can confirm these audio issues exist on the last 3 releases, earliest being Gameboy_20220429.rbf which was before the recent audio changes. Curious that the latest fixes didn't work for these games. It's probably still an underlying issue with the wav channel (maybe how it's buffering samples?).

paulb-nl commented 1 year ago

These games use the wave channel the same way as the fixed games except for one difference. Snoopy Tennis and Lego Stunt Rally additionally disable and enable all channels by writing $00 and $FF to $FF25 (NR51).

l33tr commented 1 year ago

These games use the wave channel the same way as the fixed games except for one difference. Snoopy Tennis and Lego Stunt Rally additionally disable and enable all channels by writing $00 and $FF to $FF25 (NR51).

If this is the root cause, is there a way the core can work around this enabling/disabling?

maij commented 1 year ago

I have a solution to this, but I'm going to try to include it in a larger set of changes. Just need to work out a few kinks.

maij commented 1 year ago

Thanks to Paul for pointing out what the game was actually doing! Made it really easy to pinpoint the problem.

The other stuff I was working on will take more time, but here is a test build that minimises the buzzing sound. Basically when the DACs were enabled/disabled they were being slammed to the maximum voltage. I have set the DAC off output level to be at a 'digital 0' now. There is still some faint buzzing, if you turn the volume up you can hear it. If the real hardware handles these games differently, we'll have to try a slightly different approach.

Gameboy_noise_fix_20230327.zip

paulb-nl commented 1 year ago

I recorded some videos from a Gamecube + Game Boy Player which can be used as a reference to how they sound on a GBA.

I think the core with your fix sounds the same as on these videos so sounds good to me.

Lego Stunt Rally https://youtu.be/4zLVZ2bPlso

Snoopy Tennis https://youtu.be/V89-9OBkgW4