Skip to content

Conversation

@bdach
Copy link
Collaborator

@bdach bdach commented Jun 27, 2025

Closes #33900. I think. Stable's sample lookup logic is horrible.

The user in the issue claimed they were hearing drum-hitfinish2, but they were really hearing drum-hitfinish, because they're the same .wav file in the beatmap. Now the reason why they were hearing drum-hitfinish is that the sample control point was specifying something like:

23946,-200,4,2,4,40,0,0

To decipher, this is:

  • default sample bank of soft
  • custom sample bank of 4

Taking one of the objects affected, namely 00:23:946 (2) - that's a slider with finish addition and drum addition bank on the slider head. The slider head is thus attempting to play soft-hitnormal4 and drum-hitfinish4.

Neither soft-hitnormal4 or soft-hitnormal exist in the beatmap, so that plays fine via falling back to user skin's soft-hitnormal, but drum-hitfinish4 ends up falling back to drum-hitfinish which does exist in the beatmap skin and thus plays wrongly from the beatmap skin rather than the user skin.

I have no idea how to ensure this is correct across every beatmap and skin out there so my approach is to just spray and pray (and rely on issue reports I guess). I think this matches the stable logic which is nestled within here but honestly even if you put a gun to my head I couldn't be sure if it matches completely in every possible circumstance or not.

…ks if the custom sample bank sample was not found

Closes ppy#33900. I think. Stable's sample
lookup logic is horrible.

The user in the issue claimed they were hearing `drum-hitfinish2`, but
they were really hearing `drum-hitfinish`, because they're the same
`.wav` file in the beatmap. Now the reason *why* they were hearind
`drum-hitfinish` is that the sample control point was specifying
something like:

	23946,-200,4,2,4,40,0,0

To decipher, this is:
- default sample bank of soft
- custom sample bank of 4

Taking one of the objects affected, namely 00:23:946 (2) - that's a
slider with finish addition and drum addition bank on the slider head.
The slider head is thus attempting to play `soft-hitnormal4` and
`drum-hitfinish4`.

Neither `soft-hitnormal4` or `soft-hitnormal` exist in the beatmap, so
that plays fine via falling back to user skin's `soft-hitnormal`, but
`drum-hitfinish4` ends up falling back to `drum-hitfinish` which *does*
exist in the beatmap skin and thus plays wrongly from the beatmap skin
rather than the user skin.

I have no idea how to ensure this is correct across every beatmap and
skin out there so my approach is to just spray and pray (and rely on
issue reports I guess). I *think* this matches the stable logic which is
nestled within
https://github.com/peppy/osu-stable-reference/blob/a5e5fe6ef240505d13526cf32783cad261e9bd8b/osu!/Audio/AudioEngine.cs#L1136-L1230
but honestly if you put a gun to my head I couldn't be sure if it
matches completely in every possible circumstance or not.
@bdach bdach self-assigned this Jun 27, 2025
@bdach bdach added area:beatmap parsing .osu file format parsing type/audio labels Jun 27, 2025
@bdach bdach changed the title Fix beatmap skin sample lookups falling back to non-custom sample banks if the custom sample bank sample was not found Fix beatmap skin sample lookups falling back to non-custom sample banks if the custom bank sample was not found Jun 27, 2025
@pull-request-size pull-request-size bot added size/M and removed size/S labels Jun 27, 2025
@bdach
Copy link
Collaborator Author

bdach commented Jun 27, 2025

I've got to admit that my confidence in this change is even lower given this was failing actual tests, but I'm also not sure how much the tests in question were grounded in reality rather than back-engineered from the code we had at the time they were written, so I mostly just adjusted them to pass. I also added coverage of the apparent fail case here and here.

@peppy peppy self-requested a review June 30, 2025 04:51
Copy link
Member

@peppy peppy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As with any other sample change:

  • Deploy
  • Wait for users to find a new edge case

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incorrect hitsound samples being played

2 participants