Give the flat-side accidentals their own unicode spellings (AI) - #2021
Merged
mscuthbert merged 1 commit intoSep 1, 2026
Merged
Conversation
unicodeFromModifier mapped three flat-side accidentals to glyphs that belong to something else, so Accidental.unicode could not tell them apart: triple-flat U+266D -> same string as flat half-flat U+1D132 -> QUARTER TONE SHARP one-and-a-half-flat U+266D U+1D132 -> flat + QUARTER TONE SHARP Thirteen accidental names collapsed to eleven distinct spellings. The sharp side was already right: '###' is sharp + double sharp, '~' is QUARTER TONE SHARP. The flat entries now mirror it, using U+1D133 MUSICAL SYMBOL QUARTER TONE FLAT (unused until now) and U+266D + U+1D12B for the triple flat. AI-assisted (Claude).
Member
|
Great -- in the future we might also allow for SMuFL output (since there's actually more support for that), but this is a good fix. Thanks! |
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.
unicodeFromModifier(music21/pitch.py:115) gives three flat-side accidentals a glyph that belongs to something else, soAccidental.unicodecannot tell them apart:triple-flatU+266DflatU+266D U+1D12Bhalf-flatU+1D132QUARTER TONE SHARPhalf-sharpU+1D133QUARTER TONE FLATone-and-a-half-flatU+266D U+1D132U+266D U+1D133Thirteen accidental names produce eleven distinct spellings. The sharp side is already right (
###is sharp + double sharp,~isU+1D132), andU+1D133 MUSICAL SYMBOL QUARTER TONE FLATis in the Unicode Musical Symbols block but unused here.Nothing internal reads these entries:
graph.utilities.accidentalLabelToUnicodeiterates the table but skips every modifier except-and#, so the flat-side values reach users only throughAccidental.unicode,Pitch.unicodeNameandunicodeNameWithOctave.Measurement, same venv both legs:
uv run pytest music21/pitch.py music21/graph music21/roman.py213 -> 214. Mutants, each verified in the file before running: (A) restore the three shipped values -> the new test fails with11 != 13; (B) make all three distinct but by the lazy route (♭♭♭, andU+1D12CFLAT UP for the quarter tones) -> uniqueness passes, the value assertion fails, which is what pins the test to the codepoints rather than to mere distinctness; (C) break###-> the sharp-side assertion fails, so it is not vacuous.uv run ruff check music21,uv run mypy music21anduv run pylint -j0 music21/pitch.pyare clean (10.00/10).Not tested:
testSingleCoreAllwill not start here without lilypond installed, so I ranuv run pytest music21instead — 3747 passed on master and on this branch, with the same 29 lilypond-dependent failures in both legs. No rendering back end was checked for glyph coverage;U+1D133is astral-plane like the double sharp and double flat already in the table.AI-assisted (Claude). (Entirely AI written)