Repository navigation
Fix #222, #224 — place notes for the clef in force; apply octave= - #225
Merged
Merged
Conversation
octave= was parsed on V: and ignored, and not parsed on K: at all. It now shifts Note.pitch in the semantic pass, as abcm2ps's get_note does, scoped as abcm2ps scopes it: a header K: covers every voice, a body K: or a V: its own voice, and each lasts until another octave= replaces it. Transposition gains an additive statesOctave flag so octave=0 can reset one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every notehead, stem, ledger line, accidental, tie and slur was placed at its treble-clef position whatever clef the staff carried. Staff position is now counted from the clef's bottom-line pitch (ClefSpec.staffPosition(of:)), the same table the floating-voice split already used, now shared. An octave clef (treble-8) moves nothing, as in abcm2ps. The vertical layout's ledger-line reservation uses the same mapping. The §7 and §14.4 page snapshots are re-recorded: their bass voices are on clef=bass octave=-2, which the treble placement had nearly cancelled out (#224). Both now match abcm2ps -g note for note. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts: # Tests/CeolKitSVGRendererTests/__Snapshots__/CanzonettaConformanceTests/pageMatchesSnapshot.1.txt
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.
Fix #222
Fix #224
Summary
Two bugs that had been hiding each other.
octave=was parsed onV:and ignored, andK:didn't read it at all.Both multi-voice conformance fixtures, §7 Zocharti Loch and §14.4 Canzonetta, put their bass voices on
clef=bass octave=-2. Treble placement drew bass notes 12 diatonic steps too low, and the missingoctave=-2left them 14 steps too high, so the pages looked nearly right. Each fix alone breaks those fixtures, so they land together.How
#224 (
94b38f3)BodyContexttracks theoctave=each voice is under.buildNoteEventandbuildChordEventshiftNote.pitchby it, the way abcm2ps'sget_notedoes.get_key,get_voice):K:it applies to every voice.K:or aV:it applies to that voice.octave=replaces it, andoctave=0resets it.KeyFieldParserreadsoctave=.Transpositiongets an additivestatesOctaveflag (defaulted, so 2.x API is unchanged). It is what tellsoctave=0apart from nooctave=at all.#222 (
bfbed66)ClefSpec.staffPosition(of:)counts from the clef's bottom-line pitch. That table was moved out ofFloatingVoiceAssigner, which now uses the shared copy.configuredForMusic, so notes, chords, stems, ties, slurs, ledger lines and collisions all follow it.VerticalLayoutEnginereserves ledger-line space with the same mapping.clef=treble-8and other octave clefs move no notes, as in abcm2ps.SharedStaffMergerkeeps the treble origin, because it only compares intervals between voices on one staff.Tests
New
OctaveModifierTests(10 tests):K:C clef=bass octave=-1 CDEFgives the same pitches asC,D,E,F,). abcm2ps draws the two identically.K:andV:scope; unstated vs.octave=0.New
ClefNotePositionTests:abcm2ps -g(8.14).V:.Every non-treble case fails on
develop.Re-recorded the Zocharti Loch and Canzonetta page snapshots. Both were compared with
abcm2ps -gfirst, and every bass note lands where abcm2ps puts it.Full suite passes (793 + 704 + 22).
Not covered
middle=still doesn't affect placement. The renderer never receives it, and abcm2ps also redraws the clef on a different line for it.[K:octave=-1]with no key letter isn't read at all (Accept a K: that names a clef but no key (K:bass, [K:clef=bass]) #223).🤖 Generated with Claude Code