BizHawk icon indicating copy to clipboard operation
BizHawk copied to clipboard

GBA audio briefly glitches out after loading a savestate in certain scenarios

Open InfoManiac742 opened this issue 4 years ago • 2 comments

Summary

Occasionally, loading savestates can glitch out the audio, causing high-pitched beeps and similar sounds. This appears to happen across many different GBA games, but it's very finicky to reproduce. The core is mGBA (the only GBA core for BizHawk).

Repro

As mentioned before, this is a very finicky bug to reproduce, but I found a way to reproduce it semi-consistently in Pokémon Emerald (SHA1:F3AE088181BF583E55DAF962A92BB46F4F1D07B7, although I don't think the version matters). Note that this has happened to me before in a lot of other scenarios and in other games - Pokémon Emerald is just the game I happen to be playing right now.

  1. Begin surfing such that the surfing music plays
  2. Save a state (I've provided a state that should work)
  3. Press the Start button to pause the game
  4. Unpause the game with the Start or B button
  5. Very shortly after unpausing the game (4 frames seems to always work for me, you can use frame advance), load the state made in Part 2.
  6. You should hear a high pitched beep for a bit.

Host env.

  • Bizhawk 2.6.1 (and a bunch of earlier ones); Windows 10 Home 20H2; AMD Ryzen 7 3750H with Radeon Vega Mobile Gfx 2.30 GHz

gba_audio_glitch.zip

InfoManiac742 avatar May 23 '21 16:05 InfoManiac742

The "close issue" button should really have a confirmation dialog

InfoManiac742 avatar Jun 06 '21 21:06 InfoManiac742

More general bug:

Reproduces in 2.8. Tested on Castlevania Harmony of Dissonance

  1. Play a game
  2. Save a state
  3. Open the Hex Editor
  4. Start changing values around until you crash your game.
  5. Load the savestate

You'll find that sometimes, the music remains corrupted (half the instruments missing, sounds distorted, etc). Loading a second time often clears the issue.

Meerkov avatar Sep 24 '22 21:09 Meerkov

You'll find that sometimes, the music remains corrupted (half the instruments missing, sounds distorted, etc). Loading a second time often clears the issue.

I'm aware of an mGBA core audio bug on that seems to mute certain channels when loading a state immediately after restarting the core, but I can't reproduce it on 2.9 anymore. I can consistently reproduce it on 2.6.2-2.8 by loading Mega Man Battle Network (USA) SHA1:A4FBAE389654A6611D0597B1E9109CBBD32A132F, making a state during the Capcom logo, turning on "Autload last Slot" and rebooting the core.

The previous comment doesn't mention any specific timing for when to load the states, so I don't know for sure if loading the state right after the core reboots just makes it more likely to happen, or if this is a different issue.

kalimag avatar Jan 23 '23 14:01 kalimag

I can try testing the newest version once I get around to it, but I find that Castlevania: Harmony of Dissonance is the game where this is the most noticeable, since the music ~is terrible~ primarily uses the Game Boy sound channels.

Edit: AppVeyor is giving me an error, and I'm too lazy to build BizHawk from source.

InfoManiac742 avatar Jan 23 '23 17:01 InfoManiac742

It seems to work perfectly on HoD at least, which is a good sign that this is probably fixed on 2.9.

InfoManiac742 avatar Jan 24 '23 04:01 InfoManiac742

And never mind I spoke too soon: it looks like there's still some weirdness going on, even though the channels aren't muted.

Here are two examples of audio from Harmony of Dissonance: one is normal, the other is immediately after loading a savestate. https://user-images.githubusercontent.com/26778801/214214523-d4a91a56-9ca7-4210-a830-ed94e5cea761.mp4 https://user-images.githubusercontent.com/26778801/214214553-48bda8c6-2a9c-4bdc-a8b2-ec9da2a8cbf2.mp4

InfoManiac742 avatar Jan 24 '23 04:01 InfoManiac742

Is this still present in 2.9 RC3?

YoshiRulz avatar Mar 25 '23 12:03 YoshiRulz

I couldn't find the RC3 tag on Gitlab (I'm not very familiar with all of this), but the audio still glitches out for a short time on 10423abdf, which is the latest build I could find on GitLab.

Just as a clarification, there are/were two similar but slightly different problems with GBA audio and savestates:

  1. When loading a savestate immediately after resetting the core (it also happened to me randomly on other occassions, but resetting the core reproduces it all the time), a bunch of the audio channels either become extremely quiet or mute completely. The muted channels do not unmute; the problem is persistent. This problem was fixed, and is not present in the most recent master.
  2. When loading a savestate, some channels will not have the same pitch as when the savestate was saved, but instead the same pitch as just before the savestate was loaded. This is temporary, and the problem will go away as soon as the channel is updated normally by the game, lasting a few seconds at most. This problem was not fixed, and is still present in the most recent master.

Additionally, from my testing, it seems like the only channels that are affected by this are the four original Game Boy channels (Square, Wave, and Noise) and not the two new Direct Sound channels.

InfoManiac742 avatar Mar 25 '23 17:03 InfoManiac742