The \single prefix

Suppose we wanted to emphasize particular note heads by coloring them red and increasing their size, and to make it easy suppose also we have defined a function to do this:

emphNoteHead = {
  \override NoteHead.color = "red"
  \override NoteHead.font-size = 2
}
\relative {
  c''4 a \once \emphNoteHead f d |
}

[image of music]

The \once prefix works fine to emphasize single notes or complete chords, but it cannot be used to emphasize a single note within a chord. Earlier we have seen how \tweak can be used to do this, see The \tweak and \offset commands. But \tweak cannot be used with a function; that’s where \single comes in:

emphNoteHead = {
  \override NoteHead.color = "red"
  \override NoteHead.font-size = 2
}
\relative {
   <c'' a \single \emphNoteHead f d>4
}

[image of music]

In summary, \single converts overrides into tweaks so when there are several objects at the same point in musical time (like note heads in a chord), \single will only affect a single one, the one generated by the immediately following music expression, in contrast to \once which will affect all of those objects.

By using \single in this way any shorthand function containing just overrides may be applied to individual notes in a chord. However, \single does not convert \revert, \set or \unset into tweaks.

参见

Learning Manual: The \tweak and \offset commands, Using variables for layout adjustments.


LilyPond 学习手册 v2.25.22 (development-branch).