I am trying to change the size of all grace notes within a staff (or within the score, both would work) while engraving with Lilypond. The documentation on the grace engraver is not the most explanatory x__x I know how to change the size of one grace note, but I'm engraving a score with like, tens and tens, so, not looking forward to do it by hand. Plus, if I suddenly decide to change the size to something else, it won't be very agreeable.

  • I'm not familiar with Lilypond, but is there a macro facility? In other words can you define a macro, X = a,b,c, etc., such that every time it comes across #X it replaces it with "a,b,c"? If so then you need to macroize from the start. – Brian Towers Jun 20 '20 at 11:29
  • @BrianTowers Lilypond is LISP-based. The entire language is a macro facility. – chrylis -cautiouslyoptimistic- Jun 21 '20 at 0:50

You can define global defaults for grace notes with startGraceMusic and stopGraceMusic. The following code:

startGraceMusic = {
  \override NoteHead.font-size = #3

stopGraceMusic = {
  \revert NoteHead.font-size

\new Staff {
  \relative c'' {
    \grace { b16 } c4
    \grace { b16 } c4
    \grace { b16 } c4
    \grace { b16 } c4

produces extremely large notes (but I've included it here to see the effect); you probably want #-3 or something.

enter image description here

  • Actually, I ran into a problem after I accepted that answer. I'm not actually using grace notes (\grace), but rather \slashedGrace (because they are barred and are not slurred). So I just wrote startSlashedGraceMusic and stopSlashedGraceMusic instead of startGraceMusic and stopGraceMusic. But now, my \slashedGrace notes are not longer barred, and they are slurred. Any idea how I revert to "normal" behavior (minus note head size) ? – JambonSama Jun 20 '20 at 17:01
  • Perhaps add \override Flag.stroke-style = #"grace" (and a corresponding \revert)? You can keep using \grace then. – Glorfindel Jun 20 '20 at 17:05
  • Thanks, it work (for the slash). Do you know off the top of your head, the override for the slur (to remove it) ? – JambonSama Jun 20 '20 at 17:12
  • I see here a sample using \slurDashed and \slurSolid, but I have no idea if there's something like \slurInvisible. – Glorfindel Jun 20 '20 at 17:19
  • \slurInvisible doesn't work, but the doc says that the global defaults are defined in ly/grace-init.ly so I gave it a try (to no avail). In that file, it seems that <>\stopGraceSlur and <>\startGraceSlur are used; defined as startGraceSlur = #(make-music 'SlurEvent 'span-direction START 'spanner-id 'grace) and stopGraceSlur = #(make-music 'SlurEvent 'span-direction STOP 'spanner-id 'grace); but I couldn't make anything of it. It's okay, though. I'll stick with the default size of slashed grace notes (if nothing else). Thanks for your time ! – JambonSama Jun 20 '20 at 17:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.