Repository navigation
fix(musicxml): import string indications on notation staves as string number annotations - #2913
Merged
Merged
Conversation
String numbers on notes without a fret (e.g. classical guitar string indications on a standard notation staff) were never painted because the annotation required a stringed note. The string number glyph also mapped the string through the staff tuning which is empty on such staves. Introduce Note.getStringCount which falls back to a standard 6 string instrument for staves without tuning and use it for the annotation. Refs #2822
Extend the string note property with an overload accepting the string
number (1 is the highest string) to describe string number annotations
on pitched notes, e.g. 'a4{string 1}'. The exporter writes this form for
pitched notes so the model roundtrips.
The value is only allowed on pitched notes (new diagnostic AT221);
fretted notes keep specifying their string via 'fret.string'.
Refs #2822
…annotation A <technical><string> on a staff without tuning was converted using an empty tuning which resulted in invalid string values (0 or negative). In combination with a <fret> the note became a stringed note with wrong pitch and invalid MIDI ticks, silencing the playback. On staves without tuning the string is now treated as string number annotation on the pitched note (assuming a standard 6 string instrument), frets are ignored. Strings without fret on tuned staves are annotations too. Strings outside the available strings are dropped. Fixes #2822
Adds a MusicXML visual test with string number annotations on a standard notation staff and verifies the alphaTex roundtrip of it. Updates the 32a-Notations reference which now shows the string number. Refs #2822
To write string and fret information for pitched staves, the GPIF writer assigns fingerings to the notes and temporarily sets a default tuning on the staff. Only the tuning was restored afterwards, leaving notes with string and fret on staves without tuning. This resulted in wrong pitches on playback after an export and broken files on repeated exports. The exporter now works on a copy of the score created via the JSON serializer. Refs #2822
Bars are created with an initial voice, but the first MusicXML voice mapped on a staff inserted an additional voice instead of using it, leaving an empty trailing voice in every bar. Refs #2822
The folder roundtrips listed MusicXML files individually as exceptions because they differ too much from the Guitar Pro data model. Only include supported Guitar Pro file extensions instead. Refs #2822
…piled targets Refs #2822
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 #2822
Proposed changes
A
<technical><string>on a staff without tuning is a string indication for the player (e.g. a circled string number in classical guitar music), not a tab position. The importer converted it using the empty staff tuning, which stored invalid strings (0 or negative). Combined with a<fret>, the note became a stringed note with a wrong pitch and NaN MIDI ticks, which silenced playback.alphaTab now treats a string without a usable tab position as an annotation on the pitched note. Playback and standard notation keep using the written pitch, and no tab is created.
MusicXML import
note.string) andnote.showStringNumberis set. A<fret>is ignored with a warning because it has no meaning without a tuning.<string>without<fret>: string number annotation.<string>+<fret>: tab position as before.Rendering
Note.getStringCount(staff): the tuning length, or 6 for staves without tuning. The importer, the glyph and alphaTex all use it, so conversions agree.alphaTex
stringnote property gets an overload with a value for pitched notes, e.g.a4{string 1}(1 = highest string, same numbering asfret.string). This keeps the new model state roundtrip-safe.AT221, since their string comes fromfret.string. Out-of-range values reportAT211.string Nfor pitched notes. The language definitions are regenerated frompackages/alphatex.Related fixes found while testing
GpifWriterassigns fingerings to the notes and temporarily sets a default tuning. Only the tuning was restored. Afterwards the score played wrong pitches, and a second export wrote a file without tuning and with wrong MIDI values.Gp7Exporternow exports a copy of the score created via the JSON serializer; the backing track audio is shared with the copy because it is not serialized..gp3,.gp4,.gp5,.gpx,.gp). This replaces the individual MusicXML exclusions, since MusicXML differs too much from the Guitar Pro model for a full roundtrip.Known limitations (not addressed here)
Tests
{string N}on pitched notes,AT211/AT221diagnostics, export roundtrip.string-numbers-pitched(MusicXML) plus a dedicated alphaTex roundtrip of it.32a-Notations.pngnow shows the string number of the note marked "string".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