Next: , Previous: Beaming, Up: Notation manual



3.6 Accidentals

This section describes how to change the way that accidentals are inserted automatically before the running notes.

Common rules for typesetting accidentals have been canned in a function. This function is called as follows

       #(set-accidental-style 'modern 'Voice)

The function takes two arguments: a symbol that denotes the style (in the example, modern), and another symbol that denotes the context name (in this example, Voice). If no context name is supplied, Staff is the default.

The following styles are supported

default
This is the default typesetting behavior. It should correspond to 18th century common practice: Accidentals are remembered to the end of the measure in which they occur and only on their own octave.
voice
The normal behavior is to remember the accidentals on Staff-level. This variable, however, typesets accidentals individually for each voice. Apart from that, the rule is similar to code.

This leads to some weird and often unwanted results because accidentals from one voice do not get canceled in other voices

          \context Staff <<
            #(set-accidental-style 'voice)
            <<
              { es g } \\
              { c, e }
          >> >>
     

[image of music]

Hence you should only use voice if the voices are to be read solely by individual musicians. If the staff is to be used by one musician (e.g. a conductor) then you use modern or modern-cautionary instead.

modern
This rule corresponds to the common practice in the 20th century. This rule prints the same accidentals as default, but temporary accidentals also are canceled in other octaves. Furthermore, in the same octave, they also get canceled in the following measure
          #(set-accidental-style 'modern)
          cis' c'' cis'2 | c'' c'
     

[image of music]


modern-cautionary
This rule is similar to modern, but the “extra” accidentals (the ones not typeset by default) are typeset as cautionary accidentals. They are printed in reduced size or with parentheses
          #(set-accidental-style 'modern-cautionary)
          cis' c'' cis'2 | c'' c'
     

[image of music]


modern-voice
This rule is used for multivoice accidentals to be read both by musicians playing one voice and musicians playing all voices. Accidentals are typeset for each voice, but they are canceled across voices in the same Staff.


modern-voice-cautionary
This rule is the same as modern-voice, but with the extra accidentals (the ones not typeset by voice) typeset as cautionaries. Even though all accidentals typeset by default are typeset by this variable then some of them are typeset as cautionaries.
piano
This rule reflects 20th century practice for piano notation. Very similar to modern but accidentals also get canceled across the staves in the same GrandStaff or PianoStaff.
piano-cautionary
As #(set-accidental-style 'piano)' , str) but with the extra accidentals typeset as cautionaries.
no-reset
This is the same as default but with accidentals lasting “forever” and not only until the next measure
          #(set-accidental-style 'no-reset)
          c1 cis cis c
     

[image of music]


forget
This is sort of the opposite of no-reset: Accidentals are not remembered at all—and hence all accidentals are typeset relative to the key signature, regardless of what was before in the music
          #(set-accidental-style 'forget)
          \key d\major c4 c cis cis d d dis dis
     

[image of music]

See also

Program reference: Accidental_engraver, Accidental, and AccidentalPlacement.

Bugs

Simultaneous notes are considered to be entered in sequential mode. This means that in a chord the accidentals are typeset as if the notes in the chord happened once at a time - in the order in which they appear in the input file.

This is only a problem when accidentals in a chord depend on each other. This problem can be solved by manually inserting ! and ? for the problematic notes.

In the default scheme, accidentals only depend on other accidentals with the same pitch on the same staff, so no conflicts are possible.

Read comments on this page, or add one.

This page is for LilyPond-2.2.6 (stable-branch).

Report errors to <bug-lilypond@gnu.org>.