Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix typo in makeConstBpm() and improve BPM precison for long tracks #3794

Merged
merged 8 commits into from
May 4, 2021

Conversation

daschuer
Copy link
Member

@daschuer daschuer commented Apr 17, 2021

This fixes two issues in makeConstBpm()

An a obvious typo slipped through my original tests.

Now the https://sanatonrecords.bandcamp.com/track/procs-frigolitpuffens-magiska-trampdyna is detected correctly as 139,98 BPM instead of rounding to 140,00 BPM.
This track is a good example why too aggressive rounding is not always a good solution.

And an issues with long tracks where the number of beats is ambiguous.
Like:
https://sanatonrecords.bandcamp.com/track/already-maged-circle-dance-of-cold-constellations

Now we continue searching until a single number of beats is returned for the whole possible BPM range.

@daschuer daschuer changed the title Fix typo in makeConstBpmFix() Fix typo in makeConstBpmFix() and BPM precison for long tracks Apr 18, 2021
…at two tootal number of beats are valid in between. This fixes a warping beat issue for long track with short const regions.
@daschuer daschuer changed the base branch from main to 2.3 April 18, 2021 10:03
@daschuer daschuer added this to the 2.3.0 milestone Apr 18, 2021
@daschuer daschuer changed the title Fix typo in makeConstBpmFix() and BPM precison for long tracks Fix typo in makeConstBpm() and improve BPM precison for long tracks Apr 18, 2021
@daschuer
Copy link
Member Author

@poelzi This fixes all the tracks you have reported here: #3012
Please test.

This PR should be part of the initial 2.3, to not bother the users (again) with reanalyzing the library again.

@daschuer
Copy link
Member Author

Done.

@Holzhaus Holzhaus requested a review from uklotzde April 19, 2021 19:43
@daschuer daschuer mentioned this pull request Apr 21, 2021
@@ -231,19 +242,31 @@ double BeatUtils::makeConstBpm(
((kMaxSecsPhaseError * sampleRate) / numberOfBeats);
const double maxRoundSamples = constantRegions[i].beatLength +
((kMaxSecsPhaseError * sampleRate) / numberOfBeats);
if (longestRegionLength > minRoundSamples &&
longestRegionLength < maxRoundSamples) {
if (longestRegionBeatLenth > minRoundSamples &&
Copy link
Contributor

Choose a reason for hiding this comment

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

Typo

Copy link
Member

Choose a reason for hiding this comment

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

If you rename the variable anyway, it would be good if you'd append the unit (Samples?) to the variable name.

Copy link
Member Author

Choose a reason for hiding this comment

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

All variables are on a frame base.
I have added an initial comment to clarify this. And took this momentum to unify the variable naming inside the function.

Copy link
Contributor

@uklotzde uklotzde left a comment

Choose a reason for hiding this comment

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

Code looks good so far. There are still implicit roundings using +0.5 in unchanged parts of the code, but we do not need to fix them now.

I am worried about invalidating analysis results once again, but I guess we don't have a choice. Are we sure that this will be the last change for 2.3?

@daschuer
Copy link
Member Author

I like to hear from @poelzi if this is sufficient for his tracks.

@uklotzde
Copy link
Contributor

@poelzi Please test and report.

@Holzhaus
Copy link
Member

Ping @poelzi.

@daschuer Do you expect any negative consequences from this PR? If not, we may even merge this without another test from @poelzi as it seems to fix an obvious issue.

@daschuer
Copy link
Member Author

During my tests I don't see any regressions. The only concern is that this PR does not completely solve the issue and we need to advance the analysis version number once more.

@daschuer
Copy link
Member Author

Not a big issue, so this is merge-able.

@uklotzde
Copy link
Contributor

uklotzde commented May 1, 2021

@poelzi Please respond if you want to participate. Otherwise I'll merge this PR soon.

@Holzhaus
Copy link
Member

Holzhaus commented May 3, 2021

I didn't review this myself, but if both @uklotzde and @daschuer are happy with it, I think we should merge this soon. I'll merge this on Thursday unless @poelzi tests this and finds an issue.

@uklotzde
Copy link
Contributor

uklotzde commented May 4, 2021

RFC period is over. Merging this now. LGTM

@uklotzde uklotzde merged commit f0876e0 into mixxxdj:2.3 May 4, 2021
@daschuer daschuer deleted the makeConstBpmFix branch September 26, 2021 17:39
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.

3 participants