[icon]

GNU LilyPond

-- --

What is LilyPond
Home
Examples
Templates
Download
GNU/Linux binaries
Windows binaries
Source code
Documentation
Tutorial
Manual
Glossary
Index

Support
Mailing lists
Search
WikiWiki

External sites
lilypond.org/stable
lilypond.org/development
savannah.gnu.org
ftp.lilypond.org
Mutopia
Other music online

Using the predefined accidental macros

The constructs for describing the accidental typesetting rules are quite hairy, so non-experts should stick to the macros defined in ly/property-init.ly.

The macros operate on the "Current" context (see Context properties). This means that the macros shuold normally be invoked right after the creation of the context in which the accidental typesetting described by the macro is to take effect. I.e. if you want to use piano-accidentals in a pianostaff then you issue \pianoAccidentals first thing after the creation of the piano staff:

     \score {
         \notes \relative c'' <
             \context Staff = sa { cis4 d e2 }
             \context GrandStaff <
                 \pianoAccidentals
                 \context Staff = sb { cis4 d e2 }
                 \context Staff = sc { es2 c }
             >
             \context Staff = sd { es2 c }
         >
     }
     
[picture of music]

The macros are:

\defaultAccidentals
This is the default typesetting behaviour. 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.
\voiceAccidentals
The normal behaviour is to remember the accidentals on Staff-level. This macro, however, typesets accidentals individually for each voice. Apart from that the rule is similar to \defaultAccidentals.

Warning: This leads to some weird and often unwanted results because accidentals from one voice DO NOT get cancelled in other voices:

              \context Staff <
                  \voiceAccidentals
                  \context Voice=va { \voiceOne es g }
                  \context Voice=vb { \voiceTwo c, e }
              >
          
[picture of music]
Hence you should only use \voiceAccidentals if the voices are to be read solely by individual musicians. if the staff should be readable also by one musician/conductor then you should use \modernVoiceAccidentals or \modernVoiceCautionaries instead.
\modernAccidentals
This rule should correspond to the common practice in the 20th century. The rule is a bit more complex than \defaultAccidentals: You get all the same accidentals, but temporary accidentals also get cancelled in other octaves. Further more, in the same octave, they also get cancelled in the following measure:
                \modernAccidentals
                cis' c'' cis'2 | c'' c'
          
[picture of music]

\modernCautionaries
This rule is similar to \modernAccidentals, but the "extra" accidentals (the ones not typeset by \defaultAccidentals) are typeset as cautionary accidentals (i.e. in reduced size):
                \modernCautionaries
                cis' c'' cis'2 | c'' c'
          
[picture of music]

\modernVoiceAccidentals
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 cancelled across voices in the same Staff .

\modernVoiceCautionaries
The same as \modernVoiceAccidentals, but with the extra accidentals (the ones not typeset by \voiceAccidentals) typeset as cautionaries. Notice that even though all accidentals typeset by \defaultAccidentals ARE typeset by this macro then some of them are typeset as cautionaries.
\pianoAccidentals
20th century practice for piano notation. Very similar to \modernAccidentals but accidentals also get cancelled across the staves in the same GrandStaff or PianoStaff .
\pianoCautionaries
As \pianoAccidentals but with the extra accidentals typeset as cautionaries.
\noResetKey
Same as \defaultAccidentals but with accidentals lasting "forever" and not only until the next measure:
                \noResetKey
                c1 cis cis c
          
[picture of music]

\forgetAccidentals
This is sort of the opposite of \noResetKey: 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:
                \forgetAccidentals
                \key d\major c4 c cis cis d d dis dis
          
[picture of music]
Go back to index of LilyPond.

Please send GNU LilyPond questions and comments to lilypond-user@gnu.org.

Please send comments on these web pages to (address unknown)

Copyright (c) 1997--2002 Han-Wen Nienhuys and Jan Nieuwenhuizen.

Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved.


This page was built from LilyPond-1.7.14 (development-branch) by

Buchan Milne <(address unknown)>, Thu Mar 6 21:11:35 2003 CET.