#1187 short bar padder is sometimes wrong

One Of These Days

Discussion in another comment thread lead me to file this independently.

The LilyPond exporter has had a short bar padding function for some time now, as part of Heikki's sweeping and very useful improvements.

I wonder why this exists, and whether it should exist. It is good for getting the "code to compile and build now, even if it has problems" but is it ever right to do this? Is there a common pattern that results in this kind of situation that could instead be addressed in some other way? In the example that brought this to mind, Rosegarden was creating junk rests that didn't add up, and the short bar padder kicked in to produce strange results that helped to uncover the root of the problem. In that case, the LilyPond export was simply getting bad input, and perhaps it should have protested more firmly. Or perhaps this kind of thing comes up so often in files that only barely render that it's something to live with and be grateful for not coming face to face with it more often than we do in practice.

In any event, let's just assume for now that the short bar padder needs to exist. I can agree to that, and leave the more theoretical part of the discussion for later.

However, the short bar padder has one very real bug. Sometimes bars are short quite by design. This is the case with pickup notes, which occur quite frequently in modern music.

The tutorial at


shows one such example from the real world. See the section about pickup notes for an example of how to set up this kind of scenario in detail.

Now skip to the end, and look at the Rosegarden output. The extra 8th rest there comes from the short bar padder, and the only way to fix the file is to hack the LilyPond code by hand.

This phenomenon also prevented me from attempting a challenge I wanted to undertake for the Rosegarden Notation Challenge, which would have involved copying the structure of this demo exercise I have in one of my method books that has a mixture of pickup notes and repeats with alternate endings.

I submit that the answer is simply to avoid padding short bars if the missing time from that segment comes beyond the physical end of the segment. Wouldn't that work, and be a fairly easy oneliner to implement, Heikki?


  • D. Michael McIntyre

    And maybe it wouldn't be, since the exporter looks at the total time available in a composition, and Rosegarden can't have a composition of less than n whole bars. The last beat isn't missing from the composition, but only from the time spanned by actual segments.

    Maybe not such an easy oneliner to solve, but this would be a good improvement to enhance Rosegarden's ability to handle a situation that does come up in the real world rather frequently. I've got some exercise books with 100s of pages of staffs that all start with pickup notes.

  • D. Michael McIntyre

    • milestone: --> One Of These Days

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks