Fix MetronomeMark objects silently dropped from Lilypond output - #1993
Merged
mscuthbert merged 2 commits intoAug 7, 2026
Merged
Conversation
The Lilypond translator's element dispatch never recognized
MetronomeMark, so tempo markings were dropped entirely when writing
to lily. Also fixes LyTempoEvent.stringOutput(), which ignored a
paired stenoDuration when no tempoRange was given, and its docstring,
which showed an invalid steno duration ('quarter' instead of '4').
Fixes cuthbertLab#1852
This PR is AI-assisted (>10 lines).
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Emerson936
marked this pull request as draft
August 3, 2026 02:33
Member
|
great PR. fix lint; move the "New in v.11 to the end of the docstring", and I'll be happy to merge. Thanks! |
pylint flagged the test-local `from music21 import key` as a reimport of the module-level import (W0404/W0621); `meter` is not imported at module level, so that one stays. AI-assisted (Claude)
mscuthbert
marked this pull request as ready for review
August 7, 2026 02:11
Member
|
Thanks for the good first contribution, @Emerson936 . There are some remaining issues that will be addressed in a followup PR. good luck in your AI contribution class. |
mscuthbert
added a commit
that referenced
this pull request
Aug 7, 2026
Folds in Emerson936's MetronomeMark work from PR #1993, adapted to the isinstance dispatch and the annotations on this branch, and finishes the job that branch started: bringing the emitted syntax up from the v2.14 grammar the module was written against to LilyPond 2.24 (December 2022). State the target version. lilyObjects' module docstring now says output is written for and checked against 2.24, that constructs from the linked v2.14 grammar are not necessarily still valid, and that convert-ly's convertrules.py is the authoritative list of what changed. Policy: support back about four years from a release, so raise the target when 2.24 falls outside that. Remaining pre-2.24 syntax, found by running LilyPond's own convert-ly over generated output declared as \version "2.10.0" and confirmed against a 2.24.4 run: - \times n/d -> \tuplet d/n (rule 2.17.11). The fraction inverts: \times 2/3 is \tuplet 3/2. setContextForTimeFraction's arguments are correspondingly swapped to (actual, normal), which is also the more natural direction for music21, whose tuplets already carry tupletActual and tupletNormal. - OctavateEight -> ClefModifier in the ossia context mods (rule 2.17.18). LilyPond does not complain about an \override on an unknown grob name, so this had been silently doing nothing. - Drop \consists "Default_bar_line_engraver" (rule 2.23.8); the engraver no longer exists and 2.24 warns twice per ossia staff. - define-music-function (parser location ...) -> (...) in fictaDef and colorDef (rule 2.19.22). 2.24 still accepts the old form, but convert-ly rewrites it. Not taken: convert-ly's 2.23.11 rule rewrites \bar ".|" and ".|:" to ".|-|" and ".|:-|", restoring the implicit end-of-line "|" those names lost in 2.23. The plain names are what 2.24 itself uses for startRepeatBarType and endRepeatBarType in engraver-init.ly, so the new behavior is the intended one and the suffixed forms are a compatibility shim for older files. convert-ly from 2.10 to 2.24 now reports no changes for generated output. AI-assisted (Claude)
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.
Fixes MetronomeMark objects being silently dropped from LilyPond output.
Changes:
MetronomeMarkdispatch branch toLilypondConverter.appendM21ObjectToContext(previously it fell through unhandled and was dropped).lyEmbeddedScmFromMetronomeMark(), which converts aMetronomeMark's referent/number into aLyTempoEvent.LyTempoEvent.stringOutput(), which ignored a pairedstenoDurationwhen notempoRangewas given, producing invalid syntax.LyStenoDurationdocstring example, which showed an invalid steno duration ('quarter'instead of'4').Fixes #1852
AI-assisted with Claude (>10 lines).