Engine DJ export drops a tempo marker less than half a beat before the end of a track

Please fill in this bug report template:

Lexicon version: 1.11.15
Operating system (remove one): Mac

Bug description: Lexicon leaves a track’s last tempo marker out of the Engine DJ beat data when that marker starts less than half a beat before the end of the file. Its tempo is applied to the span before it instead, so Engine DJ syncs to the wrong tempo there. Lexicon’s own grid and its rekordbox USB export are correct for the same track. Seen syncing to the Engine DJ 5.1.0 desktop library.

Example: a 57.129 s track whose grid ends with a step from 190 to 95 BPM. The 95 BPM marker has 0.49999 beats of audio after it.

Point in the track Lexicon grid Engine DJ beat data after sync
55.550 s 190 BPM marker marker, 4 beats to the next
56.813 s 95 BPM marker no marker
58.076 s none (track ends at 57.129 s) end marker
55.550 to 56.813 s 190 BPM 95 BPM (4 beats over 2.526 s)

Engine DJ plays the four beats before the step as 95 BPM, and a deck synced to this track halves its tempo four beats early. Two more tracks showed the same thing: another 190 to 95 BPM step 0.49999 beats from the end, and a 150 BPM marker at the end of a tempo ramp, which left the beat before it at 150 instead of 151.7 BPM.

The written beat counts fit `round((start of the next marker, or the track’s duration, minus the marker’s start) / beat length)`, with a marker whose count rounds to 0 left out and the end marker placed using that marker’s beat length. If that is the rule, two tempo markers less than half a beat apart would also cut the grid short at the first. Writing the last marker with at least one beat would fix the case above.

Workaround: a track whose last tempo marker has at least one beat of audio after it exports correctly. I padded the affected files with two beats of silence.

Note: this is probably an unlikely scenario for most tracks, I ran into this while making custom track edits for a set with tempo changes.

Step by step to reproduce:

  1. In Lexicon, give a track a grid whose last tempo marker starts less than half a beat (at that marker’s tempo) before the end of the file. Example: a 57.129 s track with a 190 BPM marker at 55.550 s and a 95 BPM marker at 56.813 s.
  2. Sync to the Engine DJ desktop library.
  3. Load the track in Engine DJ and play the last few seconds.
  4. Result: the BPM readout changes to 95 at 55.550 s, four beats before the marker, and a synced deck follows it. Expected: 190 BPM until 56.813 s, then 95 BPM.

Screenshot:

Deck 1 is the track above, playing as sync lead. Its playhead is several beats before the end of the audio, but it already reads 95.0 BPM, and deck 2 (synced) has been pulled to −50 % speed.

Thanks, I will look into that