Note Local

MP3 to MIDI drifts out of time: check alignment before quantizing

If converted MIDI starts together with the MP3 but drifts later, check the tempo and clip time scale before quantizing. Compare matched attacks at the beginning, middle and end. A fixed position shift cannot fix growing drift, and an endpoint fit cannot prove the middle is correct. Stop a global correction if attacks are missing, extra or locally inconsistent.

Convert your audio · Check the timing pattern · Inspect the controls

A constant offset suggests checking position, growing drift suggests inspecting time scale, and a failed middle check means stop a global correction.
Original diagnostic schematic. These are checks to make, not automatic cause labels.

Make the comparison stable first

Before quantizing an MP3-to-MIDI result that drifts against its source, align one clearly matched attack and compare another near the end plus at least one in the middle. If all matched attacks remain late by the same amount, test a clip-position correction on a copy. If the error grows across the phrase, inspect the file tempo, project tempo and any clip stretching before moving individual notes to a grid. Matching the first and last attacks is not sufficient: reject the global correction if an interior attack still disagrees. Stop any bulk timing repair when attacks cannot be matched one to one, local timing varies, or the source performance intentionally changes pace. Keep the source audio unwarped while diagnosing the MIDI; changing both at once destroys the comparison. These patterns guide the next check, not a diagnosis of which program caused the error.

  1. Keep an untouched MIDI export and duplicate the working clip. Use the same source interval and one identifiable part; a similarly pitched note from another instrument is not a valid timing anchor.
  2. Keep the source audio at its original speed. Check whether your DAW has already stretched or warped it. Disable that only on a comparison copy if needed, rather than changing the production arrangement.
  3. Match an actual attack near the start, another near the end, and an interior attack. Record their positions in seconds, not just bar numbers from possibly different tempos. Repeated pitches require matching occurrences.
  4. Compare the offset pattern before choosing an operation. If anchors cannot be matched reliably, do not fit a global shift or time scale to them.

Choose one operation that matches the observed pattern

A constant offset: move a duplicate MIDI clip as a unit, then recheck later attacks. This retains the distances between events. Do not quantize every note merely to compensate for a single late clip placement.

Growing drift: inspect the MIDI file's tempo information, the receiving project's tempo and any time scaling already applied to the clip. Check your application's import behaviour rather than assuming every DAW handles a tempo map identically. Test one tempo or scale change on a copy, with the source audio unchanged. Recheck both endpoints and the middle before keeping it.

Local disagreement: if the beginning and end match but an interior attack does not, reject that global fit as a complete repair. Review local event placement or the source's changing pace. A single global factor can hide the endpoints without repairing the phrase between them.

When to stop and change method

Stop global alignment if you must invent an anchor, pair one source attack with two MIDI notes, skip a source attack with no output note, or match a different instrument to make the numbers fit. Review those events separately, or prepare a clearer source before another conversion. The timing pattern alone does not identify a detector, encoder or DAW as the cause.

Do not force a freely timed or changing-tempo performance onto a fixed grid unless that is the intended arrangement change. Once reliable matches are aligned at the intended pace, quantization can be a separate musical editing decision. Keep note ends and articulation under review; a neat grid does not prove a correct transcription.

A fresh conversion and three deliberately edited timing controls

For this guide we freshly recomputed the CLI transcription of our owned five-second, eight-attack MP3. The input fixture is explicitly reused; no previous conversion output was copied. The fresh export has eight events and a constant120BPM tempo at480PPQ. It is our reference for the following edits, not a claim that its detected attacks perfectly match the authored audio.

We made three labelled copies: offset every note by120ticks (125ms at120BPM); retain all note ticks but change the tempo event to100BPM; or move only the fourth note by120ticks. These are deliberately introduced editing faults, not errors observed from the converter and not tests of any DAW's import defaults.

Controlled copyEventsLast residual after first alignment (s)Endpoint span ratioFourth residual after endpoint fit (s)
offset125ms80.0000000001.0000000.000000000
tempo10080.7014583331.200000-0.000000000
local125ms80.0000000001.0000000.125000000

The constant-offset case aligns after one position correction. The100BPM interpretation expands the time between first and last attacks by a factor1.2; after aligning the first, the last is 0.701458333seconds late relative to the fresh export. The local edit leaves the first and last unchanged but keeps the fourth note125ms late. An endpoint-only check would miss it.

Run, exact events, files and reproduction

Fresh run 2026-11-26T18:06:07.663Z to 2026-11-26T18:06:11.888Z UTC (27November Beijing). BasicPitch1.0.1 / TensorFlow.jsWASM3.21.0; onset0.5,frame0.3,minimum11frames,22050Hz. This is a CLI fallback with FFmpeg decoding, not an online-browser conversion. Local browser initialization returned access denied. Source SHA256 9cea69dc4d2cc11556a398e64502777e0f316d44901f8c514ee656aea6804c7b; MIDI SHA256 ac40958097bfa192129ee9b9150ead87f56fbb84bf53b97464eebfa566d94cf1. The deterministic output matches the earlier run's hash, but the retained current report records a new execution.

Raw note-on/off ticks, pitches, velocities and durations were cross-checked independently against the original conversion report and @tonejs/midi. Only constant-tempo files are handled by this reproduction; it does not implement a general variable-tempo analyser. At480PPQ, tick time is60/(BPM×480)seconds. For the tempo copy, last residual after first alignment is(3657−290)×(1/800−1/960)=0.701458333seconds. Each input comes from the retained raw events and tempo values.

In the existing project, use the converter adapter with your FFmpeg executable, public/examples/tempo-alignment and source, then run build-tempo-alignment.mjs to independently verify and generate the labelled controls. Existing project dependencies are required. No model-threshold sweep or accuracy percentage is claimed.

Public guidance and limits

Jukeblocks describes editable pitch/timing data; CraftMusic discusses timing cleanup; Basic Pitch recommends correction in a DAW. These are credited shared concepts. Ableton's tempo-map import instructions show an explicit tempo-map workflow; consult your application's instructions rather than treating our edited-file controls as an import test.

Watch the alignment checklist

Original slides with AI-synthesized English narration. The timing faults are deliberately edited controls, not observed converter failures. This video was recorded before today's current-ten comparison; its narration reflects that earlier audit status.

Watch this explanation on Note Local MIDI on YouTube.

Reader questions

Does an early match mean the tempo is right?

No. Compare later and interior attacks. A wrong time scale can still match one anchor.

Can I fix the first and last note and stop checking?

No. A local timing error can remain between correct endpoints. Check the interior and expand the review if any match fails.

Does this diagnose the cause of drift in my file?

No. It separates the next checks. Establish tempo interpretation, clip position and source timing before attributing cause.