5

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.

2
  • 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. Commented Jun 20, 2020 at 11:29
  • @BrianTowers Lilypond is LISP-based. The entire language is a macro facility. Commented Jun 21, 2020 at 0:50

2 Answers 2

8

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

5
  • 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) ? Commented Jun 20, 2020 at 17:01
  • Perhaps add \override Flag.stroke-style = #"grace" (and a corresponding \revert)? You can keep using \grace then.
    – Glorfindel
    Commented Jun 20, 2020 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) ? Commented Jun 20, 2020 at 17:12
  • I see here a sample using \slurDashed and \slurSolid, but I have no idea if there's something like \slurInvisible.
    – Glorfindel
    Commented Jun 20, 2020 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 ! Commented Jun 20, 2020 at 17:46
3

Glorfindel's answer was very helpful. I also had the same problem with \slashedGrace though, in that I don't want the slur signs. I was able to solve that problem by altering the syntax slightly, getting rid of <>, resulting in

startSlashedGraceMusic = {
  \override NoteHead.font-size = #-6
  \override Flag.stroke-style = "grace"
}


stopSlashedGraceMusic = {
  \revert NoteHead.font-size
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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