Skip to content

Conversation

@bdach
Copy link
Collaborator

@bdach bdach commented Nov 27, 2025

Closes #35807.

The reason this closes the aforementioned issue is as follows:

Taking https://osu.ppy.sh/beatmapsets/1236180#osu/4650477 as the example, we have:

minBeatLength = 342.857142857143
maxBeatLength = 419.58041958042003
mostCommonBeatLength = 342.85700000000003

Note that mostCommonBeatLength < minBeatLength here.

Taking the inverse of that to compute BPM, we get

minBpm = 174.99999999999991
maxBpm = 142.99999999999986
mostCommonBpm = 175.00007291669704

which without DT present doesn't do anything bad, but when DT is engaged (and thus BPM is multiplied by 1.5), midpoint rounding causes the min BPM to become 262, and the most common BPM to become 263.

…length smaller or larger than the actual limits

Closes ppy#35807.

The reason this closes the aforementioned issue is as follows:

Taking https://osu.ppy.sh/beatmapsets/1236180#osu/4650477 as the
example, we have:

```
minBeatLength = 342.857142857143
maxBeatLength = 419.58041958042003
mostCommonBeatLength = 342.85700000000003
```

Note that `mostCommonBeatLength < minBeatLength` here.

Taking the inverse of that to compute BPM, we get

```
minBpm = 174.99999999999991
maxBpm = 142.99999999999986
mostCommonBpm = 175.00007291669704
```

which without DT present doesn't do anything bad, but when DT is
engaged (and thus BPM is multiplied by 1.5), midpoint rounding causes
the min BPM to become 262, and the most common BPM to become 263.
@bdach bdach requested a review from a team November 27, 2025 12:11
@bdach bdach self-assigned this Nov 27, 2025
@bdach bdach moved this from Ready for work to Pending Review in @peppy's untitled project Nov 27, 2025
@bdach bdach added the quick fix Tasks which were taken on because they take no time to fix label Nov 27, 2025
Comment on lines +120 to +121
double minBeatLength = ControlPointInfo.TimingPoints.Min(t => t.BeatLength);
double maxBeatLength = ControlPointInfo.TimingPoints.Max(t => t.BeatLength);
Copy link
Contributor

Choose a reason for hiding this comment

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

Just to be safe, I'd do .Select(t => t.BeatLength).DefaultIfEmpty(0).Min/Max() otherwise these throw exceptions on empty arrays.

Copy link
Collaborator Author

@bdach bdach Nov 27, 2025

Choose a reason for hiding this comment

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

The theory here was that these cannot throw because the preceding mostCommon.beatLength == 0 guard would catch that scenario.

@smoogipoo smoogipoo merged commit 8f927ea into ppy:master Nov 27, 2025
9 checks passed
@github-project-automation github-project-automation bot moved this from Pending Review to Done in @peppy's untitled project Nov 27, 2025
@bdach bdach deleted the most-common-bpm-floating-point-bs branch November 28, 2025 07:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:song-select quick fix Tasks which were taken on because they take no time to fix size/XS

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

BPM gets messed up with dt

2 participants