Next: , Up: Automatic notation


9.1.1 Automatic accidentals

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

#(set-accidental-style 'STYLE #('CONTEXT#))

The function can take two arguments: the name of the accidental style, and an optional argument that denotes the context that should be changed. If no context name is supplied, Staff is the default, but you may wish to apply the accidental style to a single Voice instead.

The following accidental styles are supported

default
This is the default typesetting behavior. It corresponds 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 default.

As a result, accidentals from one voice do not get canceled in other voices, which is often an unwanted result

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

[image of music]

The voice option should be used 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 modern or modern-cautionary should be used 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, 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
Same as #(set-accidental-style 'piano) 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 happen one at a time, in the order in which they appear in the input file. This is a problem when accidentals in a chord depend on each other, which does not happen for the default accidental style. The problem can be solved by manually inserting ! and ? for the problematic notes.


Next: , Up: Automatic notation

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

Report errors to http://post.gmane.org/post.php?group=gmane.comp.gnu.lilypond.bugs.