libretro / SameBoy

Gameboy and Gameboy Color emulator written in C
https://sameboy.github.io/
MIT License
19 stars 20 forks source link

Sound Stutters During Specific Screen Transitions (LCD On/Off Scenarios?) #85

Open Awakened0 opened 1 year ago

Awakened0 commented 1 year ago

Certain screen transitions cause some sound stuttering that doesn't happen in stand alone. Here's an example in Link's Awakening:

https://user-images.githubusercontent.com/4565863/194731475-0c00ef96-5ad6-44da-973b-4987298ae043.mp4

Very noticeable on going from the Nintendo BIOS screen to opening cutscene, then again to the title screen.

This issue was originally fixed with 431f1f8199166578b051651e6ff1c0cbd48766ab but popped up again in the last year or so. @LIJI32 thinks it's related to how the core handles extra frames in LCD on/off scenarios.

I reopenned the original issue report upstream, but people have asked to open an issue here as well to try to get more libretro experienced eyes on it. The original issue (with more info in comments) is here: https://github.com/LIJI32/SameBoy/issues/161

nfp0 commented 1 year ago

I can also reproduce this issue. I've recorded a bit of gameplay on Link's Awakening DX with Mangohud showing disturbances in frame pacing when the GameBoy changes screens in the game. The crackling is audible too, both on the menus and when entering and exiting the house.

This audio issue does not seem to be happening on standalone SameBoy.

https://user-images.githubusercontent.com/11202422/194920556-45ed44ab-37cf-4ec7-b7ee-5b8b115b6276.mp4

nfp0 commented 1 year ago

I've tested this recently and I cannot reproduce the audio crackling anymore. The only crackling remaining is the same present on the standalone version and on other emulators and GB cores, so I assume it's accurate.

Can anyone verify if it's also fixed for them? I'm testing on RetroArch 1.15.0 If no one can reproduce the issue anymore I guess we can close this.

nfp0 commented 11 months ago

Listening again, the crackling is still there after all. I've also noticed it sometimes occurs when pressing Start on Super Mario Land's start screen to begin the game.

Awakened0 commented 11 months ago

Yeah, checking after just building the core again I don't hear any improvement with Link's Awakening. I can hear the slight crackle when a stage starts after selecting it from the map screen in SMB Deluxe too.

nfp0 commented 11 months ago

I'm reposting this here, as this seems to be a Libretro specific issue:

I've made quite an interesting find. This crackling only manifests when I play on a 60hz screen. I cannot hear it when I play on my 180hz monitor. Just moving the window between monitors and resetting Zelda Link's Awakening makes the issue reproduce every time.

How to reproduce: 1) Load Link's Awakening on SameBoy core on 60hz monitor 2) Listen to crackle right after the GB boot logo 3) Move window to 180hz monitor 4) Press 'h' to reset the game 5) The crackle is gone

I've tried this more than 10 times, moving the window between monitors and it always reproduces consistently. Can I help debug this?

Awakened0 commented 11 months ago

I exclusively use a single screen running at 120hz. That is with Gsync active, which will use VRR to go down to ~60hz to match the game's FPS, at least in fullscreen. The crackling is there in fullscreen with Gsync at ~60hz or in a window locked to 120hz.

nfp0 commented 11 months ago

@jdgleaver I've noticed that a few cores got this treatment a while back: https://github.com/libretro/gambatte-libretro/pull/224

Could this issue on SameBoy be related to that? Could you please confirm if SameBoy does not suffer from the same problem as those cores did back then before the fix? The fact that this core outputs at 384000 Hz and that the sound behavior changes based on the screen's Hz raised this suspicion to me.