Conversation
Lyrics following music via \addlyrics were appended as plain lists directly into the barlist of the current part, so iterating the part crashed with "AttributeError: 'list' object has no attribute 'pickup'". Collect \addlyrics into a LyricsSection and merge it into the preceding music when it ends, as is already done for \lyricsto. This also makes the lyrics appear in the exported MusicXML. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A \new Voice placed directly in a StaffGroup (or other group) has an implicit Staff in LilyPond, but the MusicXML export never created a part for it. Its music was dropped, and a \set Staff.instrumentName inside it failed with "'NoneType' object has no attribute 'name'". When a Voice context starts with no part open, create a new part and add the voice to it when the Voice ends. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
Builds on the
\addlyricsfix (#196). This PR is based on that branch, so it also contains that commit; please review #196 first.Problem
A
\new Voiceplaced directly in a group has an implicit Staff in LilyPond:ly musicxmlexports no parts at all for this. In a real four-voice CPDL score,where the Voices use note variables and
\set Staff.instrumentName, it alsoprints
'NoneType' object has no attribute 'name'.Root cause
In
ParseSource.check_context()(ly/musicxml/lymus2musxml.py), theVoicebranch only opens a new section. No part is created unless a
Staffcontextdoes it. Because nothing ever adds the section to a part, the music is dropped,
and
Mediator.set_partname()writes toself.part, which isNone.Fix
When a
Voicecontext starts with no part open, create one withmediator.new_part(). When that Voice ends, add its music to the part withmediator.check_part(), the same way a Staff is handled. A newimplicit_staffstack tracks this for nested Voices.
Tests
tests/test_xml_files/voice_in_group.{ly,xml}andtest_voice_in_group.the full suite gives 20 passed and 2 xfailed. The 2 xfails were already there.
output went from an empty document to 4 parts with notes and lyrics.
Not addressed
LayoutContextandKeywordwarnings: the handlers for\layout/\midiblocks are not implemented. These warnings are harmless.
\cadenzaOn, and bar checks used where there are nobarlines, still produce measures of the wrong length.
🤖 Generated with Claude Code