#427 Expand the functionality of LilyPond Directives

Staff Picks
lilypond (14)
Angus Kerr

I am proposing this as a solution to repeats, first time and second time bars etc.. Lilypond is very intelligent in this regard, it will even insert part bar repeats. If the text field in lilypond directive is a free field, then the user would be able to tell lilypond what to do with repeats, and use other functionality contained within it. For example, for a first and second time bar scenario, at the beginning of the repeated section, the user could enter " \repeat volta 2 {" in the free text field, " } \ alternative { { " at the beginning of the first time bar, " } { " at the end of the first time bar and beginning of second, and " } } " at the end of the second time bar. Granted, Rosegarden would not understand this (and therefore if you're working with audio or MIDI, not repeat what you want), but lilypond would understand it, and it would be very useful for those of use who are more interested in Rosegarden as notation editor and arranging tool.

Currently to get repeats notated right, I have to "hack' the lilypond output with a text editor to manually organise first and second time bar situations, and this is a problem if I want to do another gui edit, this means I have to redo the manual repeats.

Another benefit of this proposed solution is that any other lilypond feature would be available to the user without having to hack the lilypond text file.


  • D. Michael McIntyre

    I'm afraid this just wouldn't work like you wish it would. The fact that these hacks build upon the text tool mechanism is misleading. They came into being that way because it was easier to hijack an existing mechanism than to invent something truly separate. It was a cheap compromise.

    In spite of them hanging off the text tool, they're more like compiler directives than arbitrary texts. They tell the exporter about something you're trying to do, so that it can write things out in a certain way in the future. There is no true "write this here" implied in these directives, and in fact getting "here" into just the right place with these stupid things is already an exercise in frustration.

    I get where you're coming from in terms of how nice it would be to be able to replace one bit of code with some arbitrary user string, but I really don't think there is much potential for that to work out well in general. The relationship between Rosegarden's internal composition representation and the LilyPond export text stream is just too loose and imprecise.

    In my opinion, it would be a complete waste of time to even try to make this work. We're better off investing in a real alternate ending mechanism for Rosegarden that really works, and then getting that to export in due course.

    That won't see the light of day for 11.11. Perhaps never, but there is some hope here. We're still trying to figure out all the interesting potential of using the new linked segments for this sort of thing, and some potential is definitely there.

  • D. Michael McIntyre

    • summary: Make lilypond directive a free text field --> Expand the functionality of LilyPond Directives
    • assigned_to: D. Michael McIntyre
    • Group: --> Staff Picks
  • D. Michael McIntyre

    I've been thinking how Rosegarden is almost a pretty good WYSIWYG score editor for LilyPond, and have started to develop a vision for the future where Rosegarden is the score editor you use to make writing LilyPond code easier. We're already heading that way, but now it's a goal instead of a side effect of our evolution.

    Having the ability to add user-specified code is a very important part of this scheme, but there are a lot of problems with the idea.

    I'm going to start experimenting with this, and you might see this tree bear some fruit by the middle of 2014.


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

Sign up for the SourceForge newsletter:

No, thanks