Hello friends, I’ve found that one of the more cumbersome tasks in Lilypond is engraving chromatic music for concert harp. When entering markups manually for each pedal change, it’s difficult to achieve clean and consistent formatting, and very easy to make errors. I’d like to share my solution to this problem.
The user only needs to enter pedal settings at the beginning of a passage, which looks like: <>\setHarpPedals { d c b e f g a } Harp_pedal_engraver then listens for notes and automatically prints pedal changes when new accidentals occur. Manually entered pedal changes (using the same function as above) are only needed if a pedal must be changed early. Warnings are triggered if contradictory accidentals are entered. There is support for graphical pedal diagrams with and without circles, and the format of text pedal charts can be customized. The engraver creates two new grobs, HarpPedalChart and HarpPedalChange, which will typically belong to the PianoStaff or GrandStaff. I extended side-position-interface::move-to-extremal-staff to allow for placement of grobs below the top staff if direction is set to CENTER. The style options and default grob positioning are based on Elaine Gould’s book and examples I’ve seen of harpists marking up their parts. I’ve included in the file a fairly complete set of tests and examples. I’d welcome feedback and I’d be happy to submit this as a pull request for either OLL or Lilypond itself if there is interest. Some technical comments: 1. I’ve duplicated with minor changes several functions from chord-name.scm. IMO note-name->string should be changed to accept an integer instead of ly:pitch, to be consistent with accidental->text-accidental-markup. I’ve also duplicated note-name->markup, because the original implementation doesn’t allow for printing naturals, and also because for some reason it inserts a space between the note name and the flat sign, which IMO is quite ugly (this is a general issue I see on both Mac and Windows when entering flat signs in markups, not just with that function). 2. I haven’t tested localization to other language note names. 3. I would love to provide a cleaner interface for users to customize the formatting of text pedal markings or add enclosures around graphical pedal diagrams. For example, it would be nice to let users do something like \override HarpPedalChart.enclosure = \markup\box\etc instead of having to create a whole Scheme function accepting the grob as an argument. It would also be nice to have the user be able to simply write something like \override HarpPedalChart.format-pedal-text = #my-custom-format instead of #(const my-custom-format). (Naturally, this relates to which logic and properties belong to the engraver vs. the grobs – I think my choices were sensible, but perhaps there is a better design?) 4. Right now, overrides only work with the context name specified. I’d love to know how to make these work with just the grob name. 5. It would be nice to have the engraver ignore notes created by \cueDuring, but as far as I can tell, these notes are indistinguishable from ordinary notes by translation time. To workaround this, it’s necessary to turn automatic pedal changes off during cues. Not a big deal but slightly ugly. 6. The grob definitions are based on TextScript but I removed properties that didn’t seem to do anything in my test examples. I have no idea if they should be added back in or values adjusted to deal with situations my tests didn’t cover.
harp-pedal-engraver.ily
Description: Binary data