Skip to content

Add the ability to correct audio offset for individual songs#1535

Open
asimard1 wants to merge 19 commits into
YARC-Official:devfrom
asimard1:feature/song-calibration
Open

Add the ability to correct audio offset for individual songs#1535
asimard1 wants to merge 19 commits into
YARC-Official:devfrom
asimard1:feature/song-calibration

Conversation

@asimard1

@asimard1 asimard1 commented Jun 30, 2026

Copy link
Copy Markdown

Adds a button on the score screen that applies the average hit-timing offset (ScoreScreenStats.AverageOffset, computed from non-bot players) to the song's delay value in song.ini. The button toggles between "Add Song Offset" and "Remove Song Offset" so the change can be undone with a second press. Also adds AverageOffset to ScoreScreenStats, populated as the mean GetAverageOffset() across non-bot players.
Bound to the Select action.

@asimard1 asimard1 force-pushed the feature/song-calibration branch from 0021feb to 4df7780 Compare June 30, 2026 21:45
@asimard1

asimard1 commented Jul 1, 2026

Copy link
Copy Markdown
Author

What I'll do next is:

  • Load this .json file and actually use the offset as a delay when loading the song so it affects gameplay (this could eventually be hidden behind a setting, but I don't know how to do that yet)
  • Move some code to new files, as I don't want to clutter ScoreScreenMenu.cs
    Now works for CON and SNG packages as well :)

@wyrdough

wyrdough commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

I was going to reply to your question from the other PR about where to save the JSON file, but it seems you have it well in hand. Normally things go in a subdirectory, but there's not really any place it obviously fits, so where you have it now is fine.

As for how to add a toggle setting, the general idea is to define the settings in SettingsManager.Settings.cs, then expose it to the user in SettingsManager.cs where ever in the DisplayedSettingsTabs list makes sense for it to live. You can then access the value of the setting with something like SettingsManager.Settings.YourSettingName.Value.

I hate adding other stuff that you'll have to figure out, but it would probably be best to make the button require a long press to activate so people won't be as prone to hitting it accidentally. It's not the most helpful pointer since it is large and spread out over several files, but MusicLibraryMenu should have an example of how to make a navigation button require a long press in there somewhere.

@asimard1

asimard1 commented Jul 2, 2026

Copy link
Copy Markdown
Author

This still requires just a bit of testing, but if anyone could test this with more than one player it would be great. Appart from that everything should be done. (Tested, works fine except when playing online because of the delay.)

edit: Thank you wyrdough for your help with finding the necessary files, everything was easy to adapt :)

edit: Tested with more than one player and it works perfectly

@asimard1

asimard1 commented Jul 2, 2026

Copy link
Copy Markdown
Author

The last bug that I see is that YargLogger.LogFormatInfo doesn't seem to make anything appear, but that might just be on my side. Anyway, I don't think it came from my code.

Also when doing a setlist, buttons won't fit on screen :(
image

Also really important to do when Online gets added to the game (conclusions after testing with the online alpha from pythonology): Only consider local players for the average, or else some horrible delays are considered from the online delay. I added a comment for this and tested it with the onlive dev build available, works perfectly.

Added TODO comments for future online functionality.
@asimard1 asimard1 changed the title Add song offset calibration button to score screen Add the ability to correct audio offset for individual songs Jul 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants