MP3 to MIDI: Where a Da Capo Goes When the File Has No Jump
A da capo is one instruction: go back to the beginning. A Standard MIDI File has no instruction to hold it. Its fifteen meta event types include no repeat, and a chart that plays 32 bars then returns to bar 1 for 16 more arrives as 48 bars of notes.
Short answer
- There is no jump instruction to hold it. Not one of the fifteen meta event types names a repeat, a segno or a coda.
- The jump gets written out instead. A da capo al fine on a 32-bar chart with the fine at bar 16 plays 48 bars, and one bar in three is a duplicate.
- Only notation keeps the instruction. Six attributes on the MusicXML sound element do the navigation.
- Audio cannot give it back. Both passes were played, so both are transcribed.
Fifteen meta types, none of them a jump
The list has fifteen codes, FF 00 through FF 7F. Two hold text: FF 06 Marker and FF 07 Cue Point, each a length byte and characters, with no destination field. A marker reading To Coda is a label for a human reader. The words jump, repeat, segno and coda appear zero times in the specification. Its one mention of looping sits in the End of Track entry, which needs an exact ending point for tracks which are looped or concatenated. The loop belongs to the reader.
Six attributes out of eighteen
The MusicXML sound element carries eighteen attributes, and six do nothing but navigation: dacapo, dalsegno, segno, coda, tocoda and fine. A seventh, time-only, says which passes they apply to; an eighth, forward-repeat, declares a repeat sign that is never printed. The other ten are playback settings. One of those ten is dragged in by the jumps: divisions is documented as useful if the segno or coda attributes are used.
Two jumps, two defaults, one ambiguous token
The six do not agree about when they fire. A da capo should occur the first time through; a tocoda should occur the second time through. One score can hold a jump that fires on pass one and a jump that fires on pass two, and a .mid has no field for a pass. The fine attribute is a token whose numeric value is the actual duration of the final note or rest, which can be ambiguous in written notation and different among parts and voices. One slot is either a flag or a duration.
What unrolling does to the bar count
Take a 32-bar chart with a da capo al fine, the fine falling at bar 16. Playback is 32 bars plus 16, so 48 in total, and exactly one bar in three is a duplicate. At a division of 96 in 4/4 a bar is 384 ticks, so the track runs 18,432 ticks against 12,288 written. At 120 beats per minute a bar is two seconds, so 96 seconds replace 64. Nothing marks the copies as copies.
Why the converter cannot put it back
An audio converter hears the performance, not the page. Both passes get transcribed because both were played, and nothing in the audio says bars 33 to 48 are bars 1 to 16 again except the similarity of the sound. Format 2 is the one nod: its tracks are sequentially independent single-track patterns, and Sequence Number lets a song sequence using the Cue message refer to them. The file can name sections but cannot order them.
How to check a converted file
Count the bars first. If the chart is 32 bars and the file plays 48, the repeat was unrolled, which is correct behaviour rather than damage. A marker reading D.C. al Coda is FF 06 text a reader must interpret, and it is the only trace the jump leaves.