Skip to content

fix(importer): read MusicXML jumps from <sound> inside <direction> - #2929

Merged
Danielku15 merged 2 commits into
developfrom
fix/2859-musicxml-direction-sound-jumps
Oct 7, 2026
Merged

Danielku15 merged 2 commits into
developfrom
fix/2859-musicxml-direction-sound-jumps

Conversation

@Danielku15

Copy link
Copy Markdown
Member

Note

AI-authored disclosure (alphatab-ai-authored-v1)

Portions of this content were authored by an AI agent. The agent has read
AGENTS.md and the human submitter accepts responsibility for
compliance with the rules in that document.

Issues

Fixes #2859

Proposed changes

MusicXML allows <sound> both directly in <measure> and inside <direction>. Notation
programs (e.g. MuseScore) write D.C., D.S., To Coda, Coda, Segno and Fine in the
<direction> form. The importer read the jump attributes (coda, tocoda, dacapo,
dalsegno, fine, segno) only from a measure-level <sound>. For a direction-level
<sound> it read only tempo, so these jumps never reached MasterBar.directions.

Both positions now share one mapping (_parseSoundDirections).

MusicXML keeps display (<direction-type>) separate from playback (<sound>). alphaTab has a
single Direction that both renders its own label and drives playback. Within one
<direction> the importer therefore treats <sound> as authoritative and the
direction-types as its visual counterpart. This is the same rule already used for
<sound tempo> vs. <metronome>.

<direction> content Before After
<words>To Coda</words> + <sound tocoda> beat text only JumpDaCoda, no duplicate text
<words>D.C. al Coda</words> + <sound dacapo> beat text only JumpDaCapo ("D.C."), no duplicate text
<words>Fine</words> + <sound fine> beat text only TargetFine, no duplicate text
<coda/> + <sound coda> / <segno/> + <sound segno> Target* unchanged
<coda/> + <sound tocoda> (coda symbol printed next to "To Coda") bogus TargetCoda JumpDaCoda only
<coda/> / <segno/> without jump attributes Target* unchanged
other words next to a jump (e.g. "Andante") beat text jump + beat text kept
<sound dacapo="no"> JumpDaCapo no jump (dacapo is yes-no typed)

Words are dropped only if they are a known label of a jump present on that <sound>.
The match ignores case, dots and whitespace (incl. NBSP), and words split over several
<words> elements are joined first. The list covers MuseScore's default export labels and
the spelled-out forms. Double/numbered segno/coda labels are deliberately left out.

Not changed:

Checklist

  • I consent that this change becomes part of alphaTab under its current or any future open source license
  • This PR is linked to an accepted issue (see above)
  • Changes are implemented
  • New tests were added
  • I have read AGENTS.md if an AI helped draft any part of this PR

AI authorship disclosure

  • No AI agent authored any part of this PR (description, code, tests, or commit messages)
  • An AI agent contributed to this PR. The AI-authored disclosure block
    (alphatab-ai-authored-v1) is present at the top of this body, and I have
    personally reviewed every change and can explain each one

Further details

  • This is a breaking change
  • This change will require update of the documentation/website

Jump and marker attributes (coda, tocoda, dacapo, dalsegno, fine, segno)
were only read from a measure-level <sound>, while notation programs write
them on the <sound> of a <direction>. Both positions now share one mapping.

Within such a direction the <sound> defines the semantic direction:
<segno>/<coda> symbols are only its visual counterpart, and <words> that
are a known label of the jump (e.g. "To Coda", "D.C. al Fine") are not
repeated as beat text since the direction renders its own label. Other
words are kept. dacapo="no" no longer counts as a jump.

Fixes #2859
@Danielku15
Danielku15 merged commit 65713cb into develop Oct 7, 2026
6 checks passed
@Danielku15
Danielku15 deleted the fix/2859-musicxml-direction-sound-jumps branch October 7, 2026 11:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MusicXML: dacapo, tocoda, coda, segno, fine on a <sound> inside <direction> are not imported (only measure-level <sound> is)

1 participant