Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Fails CGB_Sound, DMG_Sound, and OAM_Bug accuracy tests #38

Open
ruvaldak opened this issue Nov 7, 2022 · 3 comments
Open

Bug: Fails CGB_Sound, DMG_Sound, and OAM_Bug accuracy tests #38

ruvaldak opened this issue Nov 7, 2022 · 3 comments
Labels

Comments

@ruvaldak
Copy link

ruvaldak commented Nov 7, 2022

GBCC fails the two sound tests as well as oam_bug test from Blargg's accuracy test ROMs. Oam_bug test just explodes, and sound accuracy is very poor for dmg, and somewhat poor for cgb. I've noticed GBCC definitely has some issues with sound already, so I assume that is known.

@philj56 philj56 transferred this issue from philj56/gbcc-android Nov 7, 2022
@philj56 philj56 added the bug label Nov 7, 2022
@philj56
Copy link
Owner

philj56 commented Nov 7, 2022

Yeah, sound's very annoying to get right, and hasn't seen too much love at the moment.

The two sound tests that fail are both to do with the wave channel, and shouldn't really affect much (but obviously it's still a bug). OAM_bug fails all the tests that try to trigger it, because as far as I can remember I haven't attempted to emulate it.

At some point fairly soon, I'll switch from working on the android front end to fixing core emulation for a bit, as there's lots of stuff that needs improving there before I work on more advanced things. I think the most important one is properly separating the behaviour of different gameboy models, as it's currently kind of a weird DMG/GBC hybrid. The whole sound system could use an overhaul as well, but that's a pretty big job.

It should sound fine for most games though, I haven't noticed any particular issues. There are a few things that can affect it:

  • Do you have "Use low-latency audio path" turned on? As long as it doesn't turn your sound into a crackly mess, that should improve quality somewhat. (It's disabled by default because of issues on some phones)
  • How fast is your phone? For example, unlimited turbo on the tutorial rom title screen gets me 1137 FPS on a Pixel 6. Generally, the faster the processor, the fewer audio problems there should be.
  • It's possible disabling vsync will improve things, but I'm not sure.

I've noticed GBCC definitely has some issues with sound already

Do you mean specific game problems or just generally low-quality audio, and do you have some concrete examples? Those would be helpful.

BTW I've moved this to the main repo as it's not just relevant to the Android front-end.

@ruvaldak
Copy link
Author

ruvaldak commented Nov 7, 2022

Just generally lower quality - I've been playing Polished Crystal (a modification of pokemon crystal) lately and compared to emulators like Gambatte or Pizza GBC, it's sound seems to struggle occasionally, especially at sudden changes in sounds (that's the best I can explain it, it's hard to really put into words).

My phone is a Pixel 7, so it's plenty plenty fast, and yes, I do have low latency audio on. I'll try disabling vsync. I also play with Mono audio enabled ingame, could that cause issues?

@philj56
Copy link
Owner

philj56 commented Nov 7, 2022

Ah ok. I don't think mono audio should make a difference.

Regarding generally lower quality, yeah that's not surprising. The way audio sampling is done currently is pretty naive, it's just enough to sound "fine", if you're only listening via phone speakers or such 😛

There are two things I can look into at some point which might help:

  • There's meant to be a capacitor on each channel that acts as a slight low-pass filter, which should smooth out the audio somewhat. This might be enough to make a significant difference.
  • Ideally, I'd capture every audio sample the gameboy produces and do some fairly high-quality downsampling to the correct rate, but it's quite hard to do. I have tried something like that in the past, but ended up with the audio pitch wobbling all over the place 😅 It's also tricky doing something like this on slower devices.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants