Repository navigation
fix(importer): read MusicXML jumps from <sound> inside <direction> - #2929
Merged
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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>. Notationprograms (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 onlytempo, so these jumps never reachedMasterBar.directions.Both positions now share one mapping (
_parseSoundDirections).MusicXML keeps display (
<direction-type>) separate from playback (<sound>). alphaTab has asingle
Directionthat both renders its own label and drives playback. Within one<direction>the importer therefore treats<sound>as authoritative and thedirection-types as its visual counterpart. This is the same rule already used for
<sound tempo>vs.<metronome>.<direction>content<words>To Coda</words>+<sound tocoda>JumpDaCoda, no duplicate text<words>D.C. al Coda</words>+<sound dacapo>JumpDaCapo("D.C."), no duplicate text<words>Fine</words>+<sound fine>TargetFine, no duplicate text<coda/>+<sound coda>/<segno/>+<sound segno><coda/>+<sound tocoda>(coda symbol printed next to "To Coda")TargetCodaJumpDaCodaonly<coda/>/<segno/>without jump attributes<sound dacapo="no">JumpDaCapodacapois 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 andthe spelled-out forms. Double/numbered segno/coda labels are deliberately left out.
Not changed:
<sound dacapo="yes"/>with a<sound tocoda>elsewhere plays to the end after the da capo instead of jumping to the coda #2860. The issue'srepro now plays
1 2 3 1 2 3 4, the same as with measure-level<sound>today.segno2/coda2),time-onlyandforward-repeatare not handled.<sound>content (pan,<midi-instrument>,<swing>) isstill ignored.
barline is not moved.
Checklist
AI authorship disclosure
(
alphatab-ai-authored-v1) is present at the top of this body, and I havepersonally reviewed every change and can explain each one
Further details