At extreme rate adjustments, rubberband is counting samples inaccurately

Bug #1285450 reported by Owen Williams
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mixxx
New
Medium
Unassigned

Bug Description

I have a track that is slow, around 87bpm, and another that is around 104bpm. If I turn on master sync and treat the 104bpm track as master, I should be able to click and drag and have both tracks be locked together. This works with the linear stretcher, but when I turn keylock on the 87bpm track they no longer stay in sync. This is probably because rubberband is not properly advancing the track the right number of samples. Given the large rate delta needed to match the tracks, is it reasonable to expect rubberband to handle this case?

Revision history for this message
Phillip Whelan (pwhelan) wrote :

According to the homepage librubberband should be able to do sample exact time stretching: http://breakfastquay.com/rubberband/why.html.

  "Rubber Band is designed to satisfy the need for a sanely licensed time-stretching library that sounds good enough for general musical use and also meets the many other requirements that make it useful in practical applications.... These include: Sample-exact time-stretching;"

It's right there on the webpage. I also read in their code that their algorithm is designed specifically for that. It might be worth checking all the parameters we are setting for it.

Revision history for this message
Owen Williams (ywwg) wrote :

From the .h file:

/**
     * Tell the stretcher exactly how many input samples it will
     * receive. This is only useful in Offline mode, when it allows
     * the stretcher to ensure that the number of output samples is
     * exactly correct. In RealTime mode no such guarantee is
     * possible and this value is ignored.
     */
    void setExpectedInputDuration(size_t samples);

Maybe we should keep track of the amount of error and try to correct for it in subsequent calls to the scaler?

Revision history for this message
Owen Williams (ywwg) wrote :

Interestingly the problem is worse in reverse.

Revision history for this message
Owen Williams (ywwg) wrote :

Hm, it's very weird, because rubberband falls back to linear stretching at high speeds (which makes sense), so you'd expect problems with sync in linear mode too. But no, I only get issues with sync when keylock is enabled, even when it's falling back to linear.

Owen Williams (ywwg)
Changed in mixxx:
milestone: none → 1.12.0
importance: Undecided → High
Revision history for this message
Owen Williams (ywwg) wrote :

I plotted rate and position information when doing this, and it looks like on the master deck the rate change is instantaneous, whereas on the slave deck the rate change ramps from the old value to the new. This causes a de-sync at the moment of rate change.

There is still a lot of drift in master sync when I hold down FF or REW with keylock on, though.

Revision history for this message
Owen Williams (ywwg) wrote :

Ah, this is probably because when we FF or REW, the scaler changes, and that resets the scaler, and that erases previous rate information so there's no ramp (instantaneous rate change). But on the slave side, nothing has changed so there is a ramp. A way to solve this might be to not clear out the scalers on change, or manually set the old rate after clearing.

Revision history for this message
Owen Williams (ywwg) wrote :

I don't think this should block 1.12.

Changed in mixxx:
importance: High → Medium
milestone: 1.12.0 → 2.1
Be (be.ing)
Changed in mixxx:
milestone: 2.1.0 → none
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/7327

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.