Quantise doesn't work when tempos differ

Bug #1777667 reported by Dale
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mixxx
Fix Released
Medium
Daniel Schürmann

Bug Description

First noticed this with tracks of tempo of double/half each other, which is effectively the same speed with double beats on one deck channel.

So when playing these two tracks of exactly half/double tempo I notice that trigger Play or HotCue with Quantise Enabled the beats were not lined up as they should be.

Further investigation, purposely using tracks of differing tempo, which shouldn't matter as the triggered beat should always line up with the nearest beat to when playback of that position is triggered, and I think I've managed to get a little more info which may help. Hopefully you can understand this but it seems that difference in BPM is being taken into account to align the beats when it shouldn't have anything to do with it.

Why I think this:
Load a track in A with lower BPM than in B (10% or more and you can start noticing it fairly easy.)
If A is playing triggering HotCues on B (triggering faster track to slower track) and if triggered late they play late, triggered early they play early.
If B is playing and you trigger A then you get the exact reverse (trigger early and it plays late etc.)
Both of these seem to get more pronounced as the difference in the BPM between the two tracks increases.

So it seems to me there may be some funny code which uses the difference in BPM between the two decks in this function although it should be entirely BPM independent. Even if this is not the cause there is definitely something wrong here!

Tested and observed in 2.1.0 & 2.1.1 & #1715
Always using Ubuntu Studio 18.04

Dale (dj-kaza)
description: updated
Revision history for this message
Owen Williams (ywwg) wrote :

We have special code for handling half/double sync situations, but I think it may have been a bad idea and a mis-feature. I would be supportive of removing that special casing.

Revision history for this message
Dale (dj-kaza) wrote :

Sync needs a special case for x2 BPM differences (I actually would like added and think raised a Bug on it in the past x4, especially when using a third deck to drop in something very slow and quite sparse behind another mix. I may just raise my lowest BPM value at some point.....

Back to this issue. There is no reason BPM should need to be taken into consideration at all. You need to get the absolute time (in samples) of the point being triggered and of the nearest beat marker in the track being synced to, then align the two. Even if each beatgrid marker isn't saved discretely and has to be calculated via the BPM map you are still only calculating the absolute time.

AHHHHH! Could it be that calcuating the beatgrid markers it's using displayed_bpm (IE the changed value) rather than the saved one?? NO! that would put you huge distances off if your pitch control is much off zero.

Is there maybe some special case to try and ensure it works when using Quantise with more than a single other playing deck, so there is more than one beatgrid to try and phase_sync to? Or is there a Master BeatGrid which is worked from? I can only see this really being done correctly with absolute time as well and can't see why it would cause this though...

Revision history for this message
Daniel Schürmann (daschuer) wrote :

I can reproduce the issue.
I think in this case it is correct to have no special 2x code. Just align the two closest beats.

Changed in mixxx:
status: New → Confirmed
importance: Undecided → Medium
assignee: nobody → Daniel Schürmann (daschuer)
Revision history for this message
Daniel Schürmann (daschuer) wrote :

Currently, it does not seek to match two beats, it seeks to match the beat fraction at the playposition. This is the desired behaviour for continuous sync, but it does not work for not synced tracks.

Revision history for this message
Dale (dj-kaza) wrote :

Ahh of course, because it's instant not at the beat, so it does need to take into account current BPM when calculating offset from beat marker. Clearly something is wrong with the maths involved though....

Revision history for this message
Daniel Schürmann (daschuer) wrote :

There is nothing "wrong" in the math, it just behaves unexpected.
if you have a 120 BMP track at 0.5 beat fraction and you seek a 60 BMP track also to 0.5 beat position, the result looks like this:

--|-----------|--- 120 BPM
-----|-----|------ 60 BPM
--------^--------- Phase matches at 0.5% beat fraction

Revision history for this message
Dale (dj-kaza) wrote :

Why is it ever using half beat as the zero phase point? It should always reference to the beatmarker.

What you wan to do is take the position of the nearest beat you are going to sync up to, calculate the real time offset of the play position taking into account the playback rate (and sample rate or is that defined by the audio engine already?) Apply this offset to the trigger play position of the other track (playRate and sample rate adjusted)

Revision history for this message
Daniel Schürmann (daschuer) wrote :
Revision history for this message
Dale (dj-kaza) wrote :

Fix in #1716 confirmed.

Be (be.ing)
Changed in mixxx:
milestone: none → 2.3.0
status: Confirmed → Fix Committed
Changed in mixxx:
status: Fix Committed → Fix Released
Revision history for this message
Swiftb0y (swiftb0y) wrote :

Mixxx now uses GitHub for bug tracking. This bug has been migrated to:
https://github.com/mixxxdj/mixxx/issues/9349

lock status: Metadata changes locked and limited to project staff
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.