MP3 to MIDI: when to shift an octave and when to stop
Shift an MP3-to-MIDI phrase by an octave only after confirming that its matched notes all have the same signed octave error. If some pitches are already right, or the phrase has missing or split attacks, stop the bulk shift and repair those events separately. A lower or higher sound alone does not establish the error.
Convert your audio · Check the phrase · Inspect the controls
Decide whether the whole selection has one error
Before shifting converted MIDI by an octave, match the intended part to the source attack by attack and check whether the pitch difference is the same signed 12 semitones throughout that selected phrase. A correct first note is not enough: a later correct note would be damaged by the same global shift. Apply the inverse shift only to a duplicate of the confirmed part, then compare it at the original speed and alignment without quantizing or stretching it. Stop the global repair if the offsets vary, another instrument shares the selection, a source attack has no note, or one attack has been split into several notes. Correct those events individually or make a clearer conversion input; transposition cannot supply missing attacks or merge split ones. If you cannot establish the source pitches, leave the bulk edit uncommitted rather than treating a plausible register as proof.
- Keep the original MIDI and source audio. Choose one intended instrument and the same phrase in both. If several instruments share the selected notes, separate the target part before judging a single pitch offset.
- Line up the phrase without changing tempo. Identify the audible attacks and the MIDI notes that represent them. Repeated pitches still need separate attack matches; do not match by pitch name alone.
- Establish the source pitch for each matched event using a reliable reference or careful note-by-note checking. Compare note numbers rather than octave labels that may differ between applications. Record detected minus reference pitch. A positive 12 means the detected note is an octave higher; the trial correction is minus 12.
- Continue through the phrase, including notes that sound correct. If the differences are not constant, do not apply a global shift. Select only a separately verified group, or edit pitches individually.
Make one reversible edit, then verify what it did
Duplicate the clip or save a separate file. Shift only the verified note selection by the inverse offset. Leave timing, duration and velocity alone during this check: combining transposition with quantization or stretching makes it harder to identify what changed. If your application also has a track-level transpose setting, check it before adding a second clip-level correction. Judge one correction at a time.
Play the corrected part against the original interval at the original speed, using a simple sustained sound with no deliberate octave doubling. Check the beginning, middle and end of the selected phrase. If the repair only makes it sound more plausible but you cannot establish the source pitches, keep it as an unconfirmed arrangement choice rather than a verified transcription repair.
Stop when pitch editing cannot fix the event structure
A missing attack needs a note to be added or a new transcription attempt. A single attack split into two MIDI notes needs a boundary decision. Moving their pitches by 12 does neither. Do not merge every same-pitch pair automatically: two repeated attacks in the source may be intentional. Compare the audio onset before deleting or joining notes.
Stop the bulk repair as soon as you find mixed pitch offsets, an unmatched source attack, an extra event, or a different instrument inside the selection. Keep the useful verified segment and handle the unresolved section individually. If you cannot reliably separate the target in a dense mix, use a clearer isolated part or a shorter well-defined phrase for the next conversion. That is a change of input, not proof the octave shift was correct.
Three controls that distinguish a repair from a plausible register
For this page we freshly ran our CLI transcription path on an explicitly reused owned five-second MP3, containing eight authored attacks. The fresh output returned eight notes with pitches 60,62,64,65,67,65,64,62. It did not exhibit the octave errors described below. We deliberately introduced those errors into copies to test the editing rule. These are editing controls, not claimed model failures.
- Uniform shift: add 12 to every detected pitch, then subtract 12. The resulting event pitches and start/end ticks match the original export.
- Mixed shift: add 12 only to the first note. Subtracting 12 from the entire phrase repairs that first note but moves the other seven notes away from their original pitches. Matching the first note is an insufficient bulk-edit test.
- Split attack: divide the first exported note into two adjacent events, then shift up and down. The result still has nine events. Restoring pitch does not undo the introduced split.
The first control confirms an inverse edit, not perfect conversion. The detected boundaries already differ slightly from the authored audio envelope. All controls retain that distinction; no transposition is claimed to validate timing, note count or source accuracy.
Fresh run, raw MIDI verification and reproducible controls
Run start 2026-11-26T05:52:55.775Z; completion 2026-11-26T05:53:01.846Z UTC. This was a fresh CLI execution, not an online-browser run. It uses BasicPitch1.0.1, TensorFlow.js WASM3.21.0, onset0.5, frame0.3, minimum11frames,22050Hz analysis; FFmpeg decoding replaces the online WebAudio preparation. The input is reused from our earlier owned stereo experiment; the output was recomputed and its identical deterministic hash is disclosed.
Input SHA256 9cea69dc4d2cc11556a398e64502777e0f316d44901f8c514ee656aea6804c7b; actual MIDI SHA256 ac40958097bfa192129ee9b9150ead87f56fbb84bf53b97464eebfa566d94cf1. The input is 81127 bytes; actual MIDI is 150 bytes, with 480 PPQ. The original report and raw MIDI note-on/off events were independently cross-checked before applying controlled edits.
| Controlled copy | Events | Pitches match fresh export | Start/end ticks match |
|---|---|---|---|
| global-up | 8 | false | true |
| global-repaired | 8 | true | true |
| mixed-up | 8 | false | true |
| mixed-wrong-global-repair | 8 | false | true |
| split-up | 9 | false | false |
| split-after-pitch-repair | 9 | false | false |
For the split control, the first note spans ticks 290–591; the inserted boundary is tick 440. Full event lists and hashes are in verified-results.json. No threshold sweep or accuracy percentage is claimed.
- convert-cli-evidence.mjs
- global-repaired.mid
- global-up.mid
- mixed-up.mid
- mixed-wrong-global-repair.mid
- reader-difference.txt
- reproduce-edit-controls.mjs
- source-conversion.json
- source.mid
- source.mp3
- split-after-pitch-repair.mid
- split-up.mid
- verified-results.json
Within the existing project, run convert-octave-repair.mjs with the FFmpeg executable, public/examples/octave-repair and source; then run build-octave-repair.mjs. The supplied reproduction file contains the raw-event edits and assertions. It requires the project's existing dependencies and source-conversion.json/source.mid. Each derived file is labelled as edited, not a new audio conversion.
What the current converter pages already explain
Jukeblocks describes editable MIDI and transposition; CraftMusic explicitly advises octave, timing and note-length cleanup; Basic Pitch tells users to fine-tune exported MIDI in a DAW. Those shared editing concepts are credited background. The added guide here is the attack-matched eligibility check, reversible isolated edit and explicit stop conditions for a global repair.
Reader questions
Does the same note count prove an octave shift is safe?
No. The mixed-offset control has eight notes before and after the wrong bulk edit. Check corresponding pitches and attacks, not just the total.
Should I shift a whole track after fixing its first note?
No. Verify the rest of the intended selection first. An already-correct later note is a counterexample to that global correction.
When should I stop trying octave shifts?
When the offset is inconsistent, the target cannot be matched to the source, or the problem is missing, extra or split attacks. Keep the original and switch to event-level review or clearer input.