]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/notation/pitches.itely
860babdc821d081bef8a96ed4042c699f1fc4683
[lilypond.git] / Documentation / notation / pitches.itely
1 @c -*- coding: utf-8; mode: texinfo; -*-
2 @ignore
3    Translation of GIT committish: FILL-IN-HEAD-COMMITTISH
4
5     When revising a translation, copy the HEAD committish of the
6     version that you are working on.  For details, see the Contributors'
7     Guide, node Updating translation committishes..
8 @end ignore
9
10 @c \version "2.16.0"
11
12
13 @node Pitches
14 @section Pitches
15
16 @lilypondfile[quote]{pitches-headword.ly}
17
18 This section discusses how to specify the pitch of notes.  There
19 are three steps to this process: input, modification, and output.
20
21 @menu
22 * Writing pitches::
23 * Changing multiple pitches::
24 * Displaying pitches::
25 * Note heads::
26 @end menu
27
28
29 @node Writing pitches
30 @subsection Writing pitches
31
32 This section discusses how to input pitches.  There are two
33 different ways to place notes in octaves: absolute and relative
34 mode.  In most cases, relative mode will be more convenient.
35
36 @menu
37 * Absolute octave entry::
38 * Relative octave entry::
39 * Accidentals::
40 * Note names in other languages::
41 @end menu
42
43
44 @node Absolute octave entry
45 @unnumberedsubsubsec Absolute octave entry
46
47 @cindex pitch names
48 @cindex pitches
49 @cindex absolute
50 @cindex absolute octave specification
51 @cindex octave specification, absolute
52 @cindex absolute octave entry
53 @cindex octave entry, absolute
54
55 A pitch name is specified using lowercase letters@tie{}@code{a}
56 through@tie{}@code{g}.  The note names @code{c} to @code{b} are
57 engraved in the octave below middle C.
58
59 @c don't use c' here.
60 @lilypond[verbatim,quote]
61 {
62   \clef bass
63   c4 d e f
64   g4 a b c
65   d4 e f g
66 }
67 @end lilypond
68
69 @cindex octave changing mark
70
71 @funindex '
72 @funindex ,
73
74 Other octaves may be specified with a single quote@tie{}(@code{'})
75 or comma@tie{}(@code{,}) character.  Each@tie{}@code{'} raises the
76 pitch by one octave; each@tie{}@code{,} lowers the pitch by an
77 octave.
78
79 @lilypond[verbatim,quote]
80 {
81   \clef treble
82   c'4 c'' e' g
83   d''4 d' d c
84   \clef bass
85   c,4 c,, e, g
86   d,,4 d, d c
87 }
88 @end lilypond
89
90 @seealso
91 Music Glossary:
92 @rglos{Pitch names}.
93
94 Snippets:
95 @rlsr{Pitches}.
96
97
98 @node Relative octave entry
99 @unnumberedsubsubsec Relative octave entry
100
101 @cindex relative
102 @cindex relative octave entry
103 @cindex octave entry, relative
104 @cindex relative octave specification
105 @cindex octave specification, relative
106
107 @funindex relative
108 @funindex \relative
109
110 When octaves are specified in absolute mode it is easy to
111 accidentally put a pitch in the wrong octave.  Relative octave
112 mode reduces these errors since most of the time it is not
113 necessary to indicate any octaves at all.  Furthermore, in
114 absolute mode a single mistake may be difficult to spot, while in
115 relative mode a single error puts the rest of the piece off by one
116 octave.
117
118 @example
119 \relative @var{startpitch} @var{musicexpr}
120 @end example
121
122 In relative mode, each note is assumed to be as close to the
123 previous note as possible.  This means that the octave of each
124 pitch inside @code{@var{musicexpr}} is calculated as follows:
125
126 @itemize
127 @item
128 If no octave changing mark is used on a pitch, its octave is
129 calculated so that the interval with the previous note is less
130 than a fifth.  This interval is determined without considering
131 accidentals.
132
133 @item
134 An octave changing mark@tie{}@code{'} or@tie{}@code{,} can be
135 added to respectively raise or lower a pitch by an extra octave,
136 relative to the pitch calculated without an octave mark.
137
138 @item
139 Multiple octave changing marks can be used.  For example,
140 @code{''}@tie{}and@tie{}@code{,,} will alter the pitch by two
141 octaves.
142
143 @item
144 The pitch of the first note is relative to
145 @code{@var{startpitch}}.  @code{@var{startpitch}} is specified in
146 absolute octave mode, and it is recommended that it be a octave of
147 @code{c}.
148 @end itemize
149
150 Here is the relative mode shown in action:
151
152 @lilypond[verbatim,quote]
153 \relative c {
154   \clef bass
155   c d e f
156   g a b c
157   d e f g
158 }
159 @end lilypond
160
161 Octave changing marks are used for intervals greater than a
162 fourth:
163
164 @lilypond[verbatim,quote]
165 \relative c'' {
166   c g c f,
167   c' a, e'' c
168 }
169 @end lilypond
170
171 A note sequence without a single octave mark can nevertheless span
172 large intervals:
173
174 @lilypond[verbatim,quote]
175 \relative c {
176   c f b e
177   a d g c
178 }
179 @end lilypond
180
181 When @code{\relative} blocks are nested, the innermost
182 @code{\relative} block applies.
183
184 @lilypond[verbatim,quote]
185 \relative c' {
186   c d e f
187   \relative c'' {
188     c d e f
189   }
190 }
191 @end lilypond
192
193 @code{\relative} has no effect on @code{\chordmode} blocks.
194
195 @lilypond[verbatim,quote]
196 \new Staff {
197   \relative c''' {
198     \chordmode { c1 }
199   }
200   \chordmode { c1 }
201 }
202 @end lilypond
203
204 @code{\relative} is not allowed inside of @code{\chordmode} blocks.
205
206 Music inside a @code{\transpose} block is absolute unless a
207 @code{\relative} is included.
208
209 @lilypond[verbatim,quote]
210 \relative c' {
211   d e
212   \transpose f g {
213     d e
214     \relative c' {
215       d e
216     }
217   }
218 }
219 @end lilypond
220
221
222 @cindex chords and relative octave entry
223 @cindex relative octave entry and chords
224
225 If the preceding item is a chord, the first note of the chord is
226 used as the reference point for the octave placement of a
227 following note or chord.  Inside chords, the next note is always
228 relative to the preceding one.  Examine the next example
229 carefully, paying attention to the @code{c} notes.
230
231 @lilypond[verbatim,quote]
232 \relative c' {
233   c
234   <c e g>
235   <c' e g'>
236   <c, e, g''>
237 }
238 @end lilypond
239
240 As explained above, the octave of pitches is calculated only with
241 the note names, regardless of any alterations.  Therefore, an
242 E-double-sharp following a B will be placed higher, while an
243 F-double-flat will be placed lower.  In other words, a
244 double-augmented fourth is considered a smaller interval than a
245 double-diminished fifth, regardless of the number of semitones
246 that each interval contains.
247
248 @lilypond[verbatim,quote]
249 \relative c'' {
250   c2 fis
251   c2 ges
252   b2 eisis
253   b2 feses
254 }
255 @end lilypond
256
257 One consequence of these rules is that the first note inside
258 @code{@w{\relative f}} music is interpreted just the same as
259 if it was written in absolute pitch mode.
260
261 @seealso
262 Music Glossary:
263 @rglos{fifth},
264 @rglos{interval},
265 @rglos{Pitch names}.
266
267 Notation Reference:
268 @ref{Octave checks}.
269
270 Snippets:
271 @rlsr{Pitches}.
272
273 Internals Reference:
274 @rinternals{RelativeOctaveMusic}.
275
276 @cindex relative octave entry and transposition
277 @cindex transposition and relative octave entry
278
279 @funindex \transpose
280 @funindex transpose
281 @funindex \chordmode
282 @funindex chordmode
283 @funindex \relative
284 @funindex relative
285
286 @c DEPRECATED
287 If no @code{@var{startpitch}} is specified for @code{\relative},
288 then@tie{}@code{c'} is assumed.  However, this is a deprecated
289 option and may disappear in future versions, so its use is
290 discouraged.
291
292
293 @node Accidentals
294 @unnumberedsubsubsec Accidentals
295
296 @cindex accidental
297 @cindex key signature
298 @cindex clef
299
300 @c duplicated in Key signature and Accidentals
301 @warning{New users are sometimes confused about accidentals and
302 key signatures.  In LilyPond, note names are the raw input; key
303 signatures and clefs determine how this raw input is displayed.
304 An unaltered note like@tie{}@code{c} means @q{C natural},
305 regardless of the key signature or clef.  For more information,
306 see @rlearning{Accidentals and key signatures}.}
307
308 @cindex note names, Dutch
309 @cindex note names, default
310 @cindex default note names
311 @cindex sharp
312 @cindex flat
313 @cindex double sharp
314 @cindex sharp, double
315 @cindex double flat
316 @cindex flat, double
317 @cindex natural sign
318 @cindex natural pitch
319
320 A @notation{sharp} pitch is made by adding @code{is} to the note
321 name, and a @notation{flat} pitch by adding @code{es}.  As you
322 might expect, a @notation{double sharp} or @notation{double flat}
323 is made by adding @code{isis} or @code{eses}.  This syntax is
324 derived from Dutch note naming conventions.  To use other names
325 for accidentals, see @ref{Note names in other languages}.
326
327 @lilypond[verbatim,quote,relative=2]
328 ais1 aes aisis aeses
329 @end lilypond
330
331 A natural will cancel the effect of an accidental or key
332 signature.  However, naturals are not encoded into the note name
333 syntax with a suffix; a natural pitch is shown as a simple note
334 name:
335
336 @lilypond[verbatim,quote,relative=2]
337 a4 aes a2
338 @end lilypond
339
340 @cindex quarter tones
341 @cindex semi-flats
342 @cindex semi-sharps
343
344 Quarter tones may be added; the following is a series of Cs with
345 increasing pitches:
346
347 @lilypond[verbatim,quote,relative=2]
348 ceseh1 ces ceh c cih cis cisih
349 @end lilypond
350
351
352
353 @cindex accidental, reminder
354 @cindex accidental, cautionary
355 @cindex accidental, parenthesized
356 @cindex reminder accidental
357 @cindex cautionary accidental
358 @cindex parenthesized accidental
359
360 @funindex ?
361 @funindex !
362
363
364 Normally accidentals are printed automatically, but you may also
365 print them manually.  A reminder accidental can be forced by
366 adding an exclamation mark@tie{}@code{!} after the pitch.  A
367 cautionary accidental (i.e., an accidental within parentheses) can
368 be obtained by adding the question mark@tie{}@code{?} after the
369 pitch.  These extra accidentals can also be used to produce
370 natural signs.
371
372 @lilypond[verbatim,quote,relative=2]
373 cis cis cis! cis? c c c! c?
374 @end lilypond
375
376 @cindex accidental on tied note
377 @cindex tied note, accidental
378
379 Accidentals on tied notes are only printed at the beginning of a
380 new system:
381
382 @lilypond[verbatim,quote,relative=2]
383 cis1~ cis~
384 \break
385 cis
386 @end lilypond
387
388
389 @snippets
390
391 @lilypondfile[verbatim,quote,texidoc,doctitle,ragged-right]
392 {hiding-accidentals-on-tied-notes-at-the-start-of-a-new-system.ly}
393
394 @lilypondfile[verbatim,quote,texidoc,doctitle]
395 {preventing-extra-naturals-from-being-automatically-added.ly}
396
397 @seealso
398 Music Glossary:
399 @rglos{sharp},
400 @rglos{flat},
401 @rglos{double sharp},
402 @rglos{double flat},
403 @rglos{Pitch names},
404 @rglos{quarter tone}.
405
406 Learning Manual:
407 @rlearning{Accidentals and key signatures}.
408
409 Notation Reference:
410 @ref{Automatic accidentals},
411 @ref{Annotational accidentals (musica ficta)},
412 @ref{Note names in other languages}.
413
414 Snippets:
415 @rlsr{Pitches}.
416
417 Internals Reference:
418 @rinternals{Accidental_engraver},
419 @rinternals{Accidental},
420 @rinternals{AccidentalCautionary},
421 @rinternals{accidental-interface}.
422
423 @cindex accidental, quarter-tone
424 @cindex quarter-tone accidental
425
426 @knownissues
427 There are no generally accepted standards for denoting
428 quarter-tone accidentals, so LilyPond's symbol does not conform to
429 any standard.
430
431
432 @node Note names in other languages
433 @unnumberedsubsubsec Note names in other languages
434
435 @cindex note names, other languages
436 @cindex pitch names, other languages
437 @cindex language, note names in other
438 @cindex language, pitch names in other
439
440 There are predefined sets of note and accidental names for various
441 other languages.  Selecting the note name language is usually done
442 at the beginning of the file; the following example is written
443 using Italian note names:
444
445 @lilypond[quote,verbatim]
446 \language "italiano"
447
448 \relative do' {
449   do re mi sib
450 }
451 @end lilypond
452
453 The available languages and the note names they define are:
454
455 @quotation
456 @multitable {@code{nederlands}} {do re mi fa sol la sib si}
457 @headitem Language
458   @tab Note Names
459 @item @code{nederlands}
460   @tab c d e f g a bes b
461 @item @code{catalan}
462   @tab do re mi fa sol la sib si
463 @item @code{deutsch}
464   @tab c d e f g a b h
465 @item @code{english}
466   @tab c d e f g a bf b
467 @item @code{espanol}
468   @tab do re mi fa sol la sib si
469 @item @code{italiano}
470   @tab do re mi fa sol la sib si
471 @item @code{norsk}
472   @tab c d e f g a b h
473 @item @code{portugues}
474   @tab do re mi fa sol la sib si
475 @item @code{suomi}
476   @tab c d e f g a b h
477 @item @code{svenska}
478   @tab c d e f g a b h
479 @item @code{vlaams}
480   @tab do re mi fa sol la sib si
481 @end multitable
482 @end quotation
483
484 In addition to note names, accidental suffixes may
485 also vary depending on the language:
486
487 @quotation
488 @multitable {@code{nederlands}} {-s/-sharp} {-ess/-es} {-ss/-x/-sharpsharp} {-essess/-eses}
489 @headitem Language
490   @tab sharp @tab flat @tab double sharp @tab double flat
491 @item @code{nederlands}
492   @tab -is @tab -es @tab -isis @tab -eses
493 @item @code{catalan}
494   @tab -d/-s @tab -b @tab -dd/-ss @tab -bb
495 @item @code{deutsch}
496   @tab -is @tab -es @tab -isis @tab -eses
497 @item @code{english}
498   @tab -s/-sharp @tab -f/-flat @tab -ss/-x/-sharpsharp
499     @tab -ff/-flatflat
500 @item @code{espanol}
501   @tab -s @tab -b @tab -ss/-x @tab -bb
502 @item @code{italiano}
503   @tab -d @tab -b @tab -dd @tab -bb
504 @item @code{norsk}
505   @tab -iss/-is @tab -ess/-es @tab -ississ/-isis
506     @tab -essess/-eses
507 @item @code{portugues}
508   @tab -s @tab -b @tab -ss @tab -bb
509 @item @code{suomi}
510   @tab -is @tab -es @tab -isis @tab -eses
511 @item @code{svenska}
512   @tab -iss @tab -ess @tab -ississ @tab -essess
513 @item @code{vlaams}
514   @tab -k @tab -b @tab -kk @tab -bb
515 @end multitable
516 @end quotation
517
518 In Dutch, @code{aes} is contracted to @code{as}, but both forms
519 are accepted in LilyPond.  Similarly, both @code{es} and
520 @code{ees} are accepted.  This also applies to
521 @code{aeses}@tie{}/@tie{}@code{ases} and
522 @code{eeses}@tie{}/@tie{}@code{eses}.  Sometimes only these
523 contracted names are defined in the corresponding language files.
524
525 @lilypond[verbatim,quote,relative=2]
526 a2 as e es a ases e eses
527 @end lilypond
528
529
530 @cindex microtones
531 @cindex semi-sharp
532 @cindex semi-flat
533 @cindex sesqui-sharp
534 @cindex sesqui-flat
535
536 Some music uses microtones whose alterations are fractions of a
537 @q{normal} sharp or flat.  The following table lists note names
538 for quarter-tone accidentals in various languages; here the prefixes
539 @notation{semi-} and @notation{sesqui-} respectively
540 mean @q{half} and @q{one and a half}.  Languages that do not
541 appear in this table do not provide special note names yet.
542
543 @quotation
544 @multitable {@code{nederlands}} {@b{semi-sharp}} {@b{semi-flat}} {@b{sesqui-sharp}} {@b{sesqui-flat}}
545 @headitem Language
546   @tab semi-sharp @tab semi-flat @tab sesqui-sharp @tab sesqui-flat
547
548 @item @code{nederlands}
549   @tab -ih @tab -eh @tab -isih @tab -eseh
550 @item @code{deutsch}
551   @tab -ih @tab -eh @tab -isih @tab -eseh
552 @item @code{english}
553   @tab -qs @tab -qf @tab -tqs @tab -tqf
554 @item @code{espanol}
555   @tab -cs @tab -cb @tab -tcs @tab -tcb
556 @item @code{italiano}
557   @tab -sd @tab -sb @tab -dsd @tab -bsb
558 @item @code{portugues}
559   @tab -sqt @tab -bqt @tab -stqt @tab -btqt
560 @end multitable
561 @end quotation
562
563 Most languages presented here are commonly associated with
564 Western classical music, also referred to as
565 @notation{Common Practice Period}.  However, alternate
566 pitches and tuning systems are also supported: see
567 @ref{Common notation for non-Western music}.
568
569 @seealso
570 Music Glossary:
571 @rglos{Pitch names},
572 @rglos{Common Practice Period}.
573
574 Notation Reference:
575 @ref{Common notation for non-Western music}.
576
577 Installed Files:
578 @file{scm/define-note-names.scm}.
579
580 Snippets:
581 @rlsr{Pitches}.
582
583
584 @node Changing multiple pitches
585 @subsection Changing multiple pitches
586
587 This section discusses how to modify pitches.
588
589 @menu
590 * Octave checks::
591 * Transpose::
592 * Inversion::
593 * Retrograde::
594 * Modal transformations::
595 @end menu
596
597 @node Octave checks
598 @unnumberedsubsubsec Octave checks
599
600 @cindex octave correction
601 @cindex octave check
602 @cindex control pitch
603
604 @funindex =
605 @funindex \octaveCheck
606 @funindex octaveCheck
607 @funindex controlpitch
608
609 In relative mode, it is easy to forget an octave changing mark.
610 Octave checks make such errors easier to find by displaying a
611 warning and correcting the octave if a note is found in an
612 unexpected octave.
613
614 To check the octave of a note, specify the absolute octave after
615 the @code{=}@tie{}symbol.  This example will generate a warning
616 (and change the pitch) because the second note is the absolute
617 octave @code{d''} instead of @code{d'} as indicated by the octave
618 correction.
619
620 @lilypond[verbatim,quote]
621 \relative c'' {
622   c2 d='4 d
623   e2 f
624 }
625 @end lilypond
626
627 The octave of notes may also be checked with the
628 @code{\octaveCheck@tie{}@var{controlpitch}} command.
629 @code{@var{controlpitch}} is specified in absolute mode.  This
630 checks that the interval between the previous note and the
631 @code{@var{controlpitch}} is within a fourth (i.e., the normal
632 calculation of relative mode).  If this check fails, a warning is
633 printed, but the previous note is not changed.  Future notes are
634 relative to the @code{@var{controlpitch}}.
635
636 @lilypond[verbatim,quote]
637 \relative c'' {
638   c2 d
639   \octaveCheck c'
640   e2 f
641 }
642 @end lilypond
643
644 Compare the two bars below.  The first and third @code{\octaveCheck}
645 checks fail, but the second one does not fail.
646
647 @lilypond[verbatim,quote]
648 \relative c'' {
649   c4 f g f
650
651   c4
652   \octaveCheck c'
653   f
654   \octaveCheck c'
655   g
656   \octaveCheck c'
657   f
658 }
659 @end lilypond
660
661 @seealso
662 Snippets:
663 @rlsr{Pitches}.
664
665 Internals Reference:
666 @rinternals{RelativeOctaveCheck}.
667
668
669 @node Transpose
670 @unnumberedsubsubsec Transpose
671
672 @cindex transpose
673 @cindex transposing
674 @cindex transposition
675 @cindex transposition of pitches
676 @cindex transposition of notes
677 @cindex pitches, transposition of
678 @cindex notes, transposition of
679
680 @funindex \transpose
681 @funindex transpose
682
683 A music expression can be transposed with @code{\transpose}.  The
684 syntax is
685
686 @example
687 \transpose @var{frompitch} @var{topitch} @var{musicexpr}
688 @end example
689
690 @noindent
691 This means that @code{@var{musicexpr}} is transposed by the
692 interval between the pitches @code{@var{frompitch}} and
693 @code{@var{topitch}}: any note with pitch @code{@var{frompitch}}
694 is changed to @code{@var{topitch}} and any other note is
695 transposed by the same interval.  Both pitches are entered in
696 absolute mode.
697
698 @warning{Music inside a @code{@bs{}transpose} block is absolute
699 unless a @code{@bs{}relative} is included in the block.}
700
701 Consider a piece written in the key of D-major.  It can be
702 transposed up to E-major; note that the key signature is
703 automatically transposed as well.
704
705 @lilypond[verbatim,quote]
706 \transpose d e {
707   \relative c' {
708     \key d \major
709     d4 fis a d
710   }
711 }
712 @end lilypond
713
714 @cindex transposing instruments
715 @cindex instruments, transposing
716
717 If a part written in C (normal @notation{concert pitch}) is to be
718 played on the A clarinet (for which an A is notated as a C and
719 thus sounds a minor third lower than notated), the appropriate
720 part will be produced with:
721
722 @lilypond[verbatim,quote]
723 \transpose a c' {
724   \relative c' {
725     \key c \major
726     c4 d e g
727   }
728 }
729 @end lilypond
730
731 @noindent
732 Note that we specify @w{@code{\key c \major}} explicitly.  If we
733 do not specify a key signature, the notes will be transposed but
734 no key signature will be printed.
735
736 @code{\transpose} distinguishes between enharmonic pitches: both
737 @w{@code{\transpose c cis}} or @w{@code{\transpose c des}} will
738 transpose up a semitone.  The first version will print sharps and
739 the notes will remain on the same scale step, the second version
740 will print flats on the scale step above.
741
742 @lilypond[verbatim,quote]
743 music = \relative c' { c d e f }
744 \new Staff {
745   \transpose c cis { \music }
746   \transpose c des { \music }
747 }
748 @end lilypond
749
750
751 @code{\transpose} may also be used in a different way, to input
752 written notes for a transposing instrument.  The previous examples
753 show how to enter pitches in C (or @notation{concert pitch}) and
754 typeset them for a transposing instrument, but the opposite is
755 also possible if you for example have a set of instrumental parts
756 and want to print a conductor's score.  For example, when entering
757 music for a B-flat trumpet that begins on a notated E (concert D),
758 one would write:
759
760 @example
761 musicInBflat = @{ e4 @dots{} @}
762 \transpose c bes, \musicInBflat
763 @end example
764
765 @noindent
766 To print this music in F (e.g., rearranging to a French horn) you
767 could wrap the existing music with another @code{\transpose}:
768
769 @example
770 musicInBflat = @{ e4 @dots{} @}
771 \transpose f c' @{ \transpose c bes, \musicInBflat @}
772 @end example
773
774 @noindent
775 For more information about transposing instruments,
776 see @ref{Instrument transpositions}.
777
778
779 @snippets
780
781 @lilypondfile[verbatim,quote,texidoc,doctitle]
782 {transposing-pitches-with-minimum-accidentals-smart-transpose.ly}
783
784 @seealso
785 Notation Reference:
786 @ref{Instrument transpositions},
787 @ref{Inversion},
788 @ref{Modal transformations},
789 @ref{Relative octave entry},
790 @ref{Retrograde}.
791
792 Snippets:
793 @rlsr{Pitches}.
794
795 Internals Reference:
796 @rinternals{TransposedMusic}.
797
798 @funindex \transpose
799 @funindex transpose
800 @funindex \chordmode
801 @funindex chordmode
802 @funindex \relative
803 @funindex relative
804
805 @knownissues
806 The relative conversion will not affect @code{\transpose},
807 @code{\chordmode} or @code{\relative} sections in its argument.  To use
808 relative mode within transposed music, an additional @code{\relative}
809 must be placed inside @code{\transpose}.
810
811 Triple accidentals will not be printed if using @code{\transpose}. An
812 @q{enharmonically equivalent} pitch will be used instead (e.g. d-flat
813 rather than e-triple-flat).
814
815
816 @node Inversion
817 @unnumberedsubsubsec Inversion
818
819 @cindex inversion
820 @cindex operation, inversion
821 @funindex \inversion
822
823 A music expression can be inverted and transposed in a single
824 operation with:
825
826 @example
827 \inversion @var{around-pitch} @var{to-pitch} @var{musicexpr}
828 @end example
829
830 The @code{@var{musicexpr}} is inverted interval-by-interval around
831 @code{@var{around-pitch}}, and then transposed so that
832 @code{@var{around-pitch}} is mapped to @code{@var{to-pitch}}.
833
834 @lilypond[verbatim,quote]
835 music = \relative c' { c d e f }
836 \new Staff {
837   \music
838   \inversion d' d' \music
839   \inversion d' ees' \music
840 }
841 @end lilypond
842
843 @warning{Motifs to be inverted should be expressed in absolute form
844 or be first converted to absolute form by enclosing them in a 
845 @code{\relative} block.}
846
847 @seealso
848 Notation Reference:
849 @ref{Modal transformations},
850 @ref{Retrograde},
851 @ref{Transpose}.
852
853
854 @node Retrograde
855 @unnumberedsubsubsec Retrograde
856
857 @cindex retrograde transformation
858 @cindex transformation, retrograde
859 @cindex operation, retrograde
860 @funindex \retrograde
861 @funindex retrograde
862
863 A music expression can be reversed to produce its retrograde:
864
865 @lilypond[verbatim,quote]
866 music = \relative c' { c8. ees16( fis8. a16 b8.) gis16 f8. d16 }
867
868 \new Staff {
869   \music
870   \retrograde \music
871 }
872 @end lilypond
873
874 @knownissues
875 Manual ties inside @code{\retrograde} will be broken and
876 generate warnings.  Some ties can be generated automatically
877 by enabling @ref{Automatic note splitting}.
878
879 @seealso
880 Notation Reference:
881 @ref{Inversion},
882 @ref{Modal transformations},
883 @ref{Transpose}.
884
885
886 @node Modal transformations
887 @unnumberedsubsubsec Modal transformations
888
889 @cindex modal transformations
890 @cindex transformations, modal
891 @cindex operations, modal
892
893 In a musical composition that is based on a scale, a motif is
894 frequently transformed in various ways.  It may be
895 @notation{transposed} to start at different places in the scale or
896 it may be @notation{inverted} around a pivot point in the scale.
897 It may also be reversed to produce its @notation{retrograde}, see
898 @ref{Retrograde}.
899
900 @warning{Any note that does not lie within the given scale will be
901 left untransformed.}
902
903 @subsubsubheading Modal transposition
904
905 @cindex modal transposition
906 @cindex transposition, modal
907 @cindex operation, transposition
908 @funindex \modalTranspose
909 @funindex modalTranspose
910
911 A motif can be transposed within a given scale with:
912
913 @example
914 \modalTranspose @var{from-pitch} @var{to-pitch} @var{scale} @var{motif}
915 @end example
916
917 The notes of @var{motif} are shifted within the @var{scale} by the
918 number of scale degrees given by the interval between @var{to-pitch}
919 and @var{from-pitch}:
920
921 @lilypond[verbatim,quote]
922 diatonicScale = \relative c' { c d e f g a b }
923 motif = \relative c' { c8 d e f g a b c }
924
925 \new Staff {
926   \motif
927   \modalTranspose c f \diatonicScale \motif
928   \modalTranspose c b, \diatonicScale \motif
929 }
930 @end lilypond
931
932 An ascending scale of any length and with any intervals may be
933 specified:
934
935 @lilypond[verbatim,quote]
936 pentatonicScale = \relative c' { ges aes bes des ees }
937 motif = \relative c' { ees8 des ges,4 <ges' bes,> <ges bes,> }
938
939 \new Staff {
940   \motif
941   \modalTranspose ges ees' \pentatonicScale \motif
942 }
943 @end lilypond
944
945 When used with a chromatic scale @code{\modalTranspose} has a
946 similar effect to @code{\transpose}, but with the ability to
947 specify the names of the notes to be used:
948
949 @lilypond[verbatim,quote]
950 chromaticScale = \relative c' { c cis d dis e f fis g gis a ais b }
951 motif = \relative c' { c8 d e f g a b c }
952
953 \new Staff {
954   \motif
955   \transpose c f \motif
956   \modalTranspose c f \chromaticScale \motif
957 }
958 @end lilypond
959
960 @subsubsubheading Modal inversion
961
962 @cindex modal inversion
963 @cindex inversion, modal
964 @cindex operation, modal inversion
965 @funindex \modalInversion
966 @funindex modalInversion
967
968 A motif can be inverted within a given scale around a given pivot
969 note and transposed in a single operation with:
970
971 @example
972 \modalInversion @var{around-pitch} @var{to-pitch} @var{scale} @var{motif}
973 @end example
974
975 The notes of @var{motif} are placed the same number of scale degrees
976 from the @var{around-pitch} note within the @var{scale}, but in the
977 opposite direction, and the result is then shifted within the
978 @var{scale} by the number of scale degrees given by the interval between
979 @var{to-pitch} and @var{around-pitch}.
980
981 So to simply invert around a note in the scale use the same value for
982 @var{around-pitch} and @var{to-pitch}:
983
984 @lilypond[verbatim,quote]
985 octatonicScale = \relative c' { ees f fis gis a b c d }
986 motif = \relative c' { c8. ees16 fis8. a16 b8. gis16 f8. d16 }
987
988 \new Staff {
989   \motif
990   \modalInversion fis' fis' \octatonicScale \motif
991 }
992 @end lilypond
993
994 To invert around a pivot between two notes in the scale, invert around
995 one of the notes and then transpose by one scale degree.  The two notes
996 specified can be interpreted as bracketing the pivot point:
997
998 @lilypond[verbatim,quote]
999 scale = \relative c' { c g' }
1000 motive = \relative c' { c c g' c, }
1001
1002 \new Staff {
1003   \motive
1004   \modalInversion c' g' \scale \motive
1005 }
1006 @end lilypond
1007
1008 The combined operation of inversion and retrograde produce the
1009 retrograde-inversion:
1010
1011 @lilypond[verbatim,quote]
1012 octatonicScale = \relative c' { ees f fis gis a b c d }
1013 motif = \relative c' { c8. ees16 fis8. a16 b8. gis16 f8. d16 }
1014
1015 \new Staff {
1016   \motif
1017   \retrograde \modalInversion c' c' \octatonicScale \motif
1018 }
1019 @end lilypond
1020
1021 @seealso
1022 Notation Reference:
1023 @ref{Inversion},
1024 @ref{Retrograde},
1025 @ref{Transpose}.
1026
1027
1028 @node Displaying pitches
1029 @subsection Displaying pitches
1030
1031 This section discusses how to alter the output of pitches.
1032
1033 @menu
1034 * Clef::
1035 * Key signature::
1036 * Ottava brackets::
1037 * Instrument transpositions::
1038 * Automatic accidentals::
1039 * Ambitus::
1040 @end menu
1041
1042
1043 @node Clef
1044 @unnumberedsubsubsec Clef
1045
1046 @cindex G clef
1047 @cindex C clef
1048 @cindex F clef
1049 @cindex treble clef
1050 @cindex violin clef
1051 @cindex alto clef
1052 @cindex tenor clef
1053 @cindex bass clef
1054 @cindex french clef
1055 @cindex soprano clef
1056 @cindex mezzosoprano clef
1057 @cindex baritone clef
1058 @cindex varbaritone clef
1059 @cindex subbass clef
1060 @cindex clef
1061 @cindex ancient clef
1062 @cindex clef, ancient
1063 @cindex clef, G
1064 @cindex clef, C
1065 @cindex clef, F
1066 @cindex clef, treble
1067 @cindex clef, violin
1068 @cindex clef, alto
1069 @cindex clef, tenor
1070 @cindex clef, bass
1071 @cindex clef, french
1072 @cindex clef, soprano
1073 @cindex clef, mezzosoprano
1074 @cindex clef, baritone
1075 @cindex clef, varbaritone
1076 @cindex clef, subbass
1077
1078
1079 @funindex \clef
1080 @funindex clef
1081
1082 The clef may be altered.  Middle C is shown in every example.  The
1083 following clef names can (but do not need to) be enclosed in quotes.
1084
1085 @lilypond[verbatim,quote,relative=1]
1086 \clef treble
1087 c2 c
1088 \clef alto
1089 c2 c
1090 \clef tenor
1091 c2 c
1092 \clef bass
1093 c2 c
1094 @end lilypond
1095
1096 Other clefs include:
1097
1098 @lilypond[verbatim,quote,relative=1]
1099 \clef french
1100 c2 c
1101 \clef soprano
1102 c2 c
1103 \clef mezzosoprano
1104 c2 c
1105 \clef baritone
1106 c2 c
1107
1108 \break
1109
1110 \clef varbaritone
1111 c2 c
1112 \clef subbass
1113 c2 c
1114 \clef percussion
1115 c2 c
1116
1117 \break
1118
1119 \clef G   % synonym for treble
1120 c2 c
1121 \clef F   % synonym for bass
1122 c2 c
1123 \clef C   % synonym for alto
1124 c2 c
1125 @end lilypond
1126
1127 @cindex transposing clef
1128 @cindex clef, transposing
1129 @cindex octave transposition
1130 @cindex choral tenor clef
1131 @cindex tenor clef, choral
1132
1133 By adding@tie{}@code{_8} or@tie{}@code{^8} to the clef name, the
1134 clef is transposed one octave down or up respectively,
1135 and@tie{}@code{_15} and@tie{}@code{^15} transpose by two octaves.
1136 Other integers can be used if required.  Clef names containing
1137 non-alphabetic characters must be enclosed in quotes
1138
1139 @lilypond[verbatim,quote,relative=1]
1140 \clef treble
1141 c2 c
1142 \clef "treble_8"
1143 c2 c
1144 \clef "bass^15"
1145 c2 c
1146 \clef "alto_2"
1147 c2 c
1148 \clef "G_8"
1149 c2 c
1150 \clef "F^5"
1151 c2 c
1152 @end lilypond
1153
1154 Some special purpose clefs are described in @ref{Mensural clefs},
1155 @ref{Gregorian clefs}, @ref{Default tablatures}, and @ref{Custom
1156 tablatures}.  For mixing different clefs when using cue notes within a
1157 score, see the @code{\cueClef} and @code{\cueDuringWithClef} functions
1158 in @ref{Formatting cue notes}.
1159
1160 @snippets
1161
1162 @lilypondfile[verbatim,quote,texidoc,doctitle]
1163 {tweaking-clef-properties.ly}
1164
1165 @seealso
1166 Notation Reference:
1167 @ref{Mensural clefs},
1168 @ref{Gregorian clefs},
1169 @ref{Default tablatures},
1170 @ref{Custom tablatures},
1171 @ref{Formatting cue notes}.
1172
1173 Snippets:
1174 @rlsr{Pitches}.
1175
1176 Internals Reference:
1177 @rinternals{Clef_engraver},
1178 @rinternals{Clef},
1179 @rinternals{OctavateEight},
1180 @rinternals{clef-interface}.
1181
1182
1183 @node Key signature
1184 @unnumberedsubsubsec Key signature
1185
1186 @cindex key signature
1187
1188 @funindex \key
1189 @funindex key
1190
1191 @c duplicated in Key signature and Accidentals
1192 @warning{New users are sometimes confused about accidentals and
1193 key signatures.  In LilyPond, note names are the raw input; key
1194 signatures and clefs determine how this raw input is displayed.
1195 An unaltered note like@tie{}@code{c} means @q{C natural},
1196 regardless of the key signature or clef.  For more information,
1197 see @rlearning{Accidentals and key signatures}.}
1198
1199 The key signature indicates the tonality in which a piece is
1200 played.  It is denoted by a set of alterations (flats or sharps)
1201 at the start of the staff.  The key signature may be altered:
1202
1203 @example
1204 \key @var{pitch} @var{mode}
1205 @end example
1206
1207 @funindex \major
1208 @funindex major
1209 @funindex \minor
1210 @funindex minor
1211 @funindex \ionian
1212 @funindex ionian
1213 @funindex \locrian
1214 @funindex locrian
1215 @funindex \aeolian
1216 @funindex aeolian
1217 @funindex \mixolydian
1218 @funindex mixolydian
1219 @funindex \lydian
1220 @funindex lydian
1221 @funindex \phrygian
1222 @funindex phrygian
1223 @funindex \dorian
1224 @funindex dorian
1225
1226 @cindex church modes
1227 @cindex modes
1228 @cindex major
1229 @cindex minor
1230 @cindex ionian
1231 @cindex locrian
1232 @cindex aeolian
1233 @cindex mixolydian
1234 @cindex lydian
1235 @cindex phrygian
1236 @cindex dorian
1237
1238 @noindent
1239 Here, @code{@var{mode}} should be @code{\major} or @code{\minor}
1240 to get a key signature of @code{@var{pitch}}-major or
1241 @code{@var{pitch}}-minor, respectively.  You may also use the
1242 standard mode names, also called @notation{church modes}:
1243 @code{\ionian}, @code{\dorian}, @code{\phrygian}, @code{\lydian},
1244 @code{\mixolydian}, @code{\aeolian}, and @code{\locrian}.
1245
1246 @lilypond[verbatim,quote,relative=2]
1247 \key g \major
1248 fis1
1249 f
1250 fis
1251 @end lilypond
1252
1253 Additional modes can be defined, by listing the alterations
1254 for each scale step when the mode starts on C.
1255
1256 @lilypond[verbatim,quote]
1257 freygish = #`((0 . ,NATURAL) (1 . ,FLAT) (2 . ,NATURAL)
1258     (3 . ,NATURAL) (4 . ,NATURAL) (5 . ,FLAT) (6 . ,FLAT))
1259
1260 \relative c' {
1261   \key c\freygish c4 des e f
1262   \bar "||" \key d\freygish d es fis g
1263 }
1264 @end lilypond
1265
1266 Accidentals in the key signature may be printed in octaves other
1267 than their traditional positions, or in multiple octaves, by
1268 using the @code{flat-positions} and @code{sharp-positions}
1269 properties of @code{KeySignature}.  Entries in these properties
1270 specify the range of staff-positions where accidentals will be
1271 printed.  If a single position is specified in an entry, the
1272 accidentals are placed within the octave ending at that staff
1273 position.
1274
1275 @lilypond[verbatim, quote,relative=0]
1276 \override Staff.KeySignature #'flat-positions = #'((-5 . 5))
1277 \override Staff.KeyCancellation #'flat-positions = #'((-5 . 5))
1278 \clef bass \key es\major es g bes d
1279 \clef treble \bar "||" \key es\major es g bes d
1280
1281 \override Staff.KeySignature #'sharp-positions = #'(2)
1282 \bar "||" \key b\major b fis b2
1283 @end lilypond
1284
1285 @snippets
1286
1287 @lilypondfile[verbatim,quote,texidoc,doctitle]
1288 {preventing-natural-signs-from-being-printed-when-the-key-signature-changes.ly}
1289
1290 @lilypondfile[verbatim,quote,texidoc,doctitle]
1291 {non-traditional-key-signatures.ly}
1292
1293 @seealso
1294 Music Glossary:
1295 @rglos{church mode},
1296 @rglos{scordatura}.
1297
1298 Learning Manual:
1299 @rlearning{Accidentals and key signatures}.
1300
1301 Snippets:
1302 @rlsr{Pitches}.
1303
1304 Internals Reference:
1305 @rinternals{KeyChangeEvent},
1306 @rinternals{Key_engraver},
1307 @rinternals{Key_performer},
1308 @rinternals{KeyCancellation},
1309 @rinternals{KeySignature},
1310 @rinternals{key-signature-interface}.
1311
1312
1313 @node Ottava brackets
1314 @unnumberedsubsubsec Ottava brackets
1315
1316 @cindex ottava
1317 @cindex 15ma
1318 @cindex 8va
1319 @cindex 8ve
1320 @cindex octavation
1321
1322 @funindex set-octavation
1323 @funindex \ottava
1324 @funindex ottava
1325
1326 @notation{Ottava brackets} introduce an extra transposition of an
1327 octave for the staff:
1328
1329 @lilypond[verbatim,quote,relative=2]
1330 a2 b
1331 \ottava #-2
1332 a2 b
1333 \ottava #-1
1334 a2 b
1335 \ottava #0
1336 a2 b
1337 \ottava #1
1338 a2 b
1339 \ottava #2
1340 a2 b
1341 @end lilypond
1342
1343 @snippets
1344
1345 @lilypondfile[verbatim,quote,texidoc,doctitle]
1346 {ottava-text.ly}
1347
1348 @seealso
1349 Music Glossary:
1350 @rglos{octavation}.
1351
1352 Snippets:
1353 @rlsr{Pitches}.
1354
1355 Internals Reference:
1356 @rinternals{Ottava_spanner_engraver},
1357 @rinternals{OttavaBracket},
1358 @rinternals{ottava-bracket-interface}.
1359
1360
1361 @node Instrument transpositions
1362 @unnumberedsubsubsec Instrument transpositions
1363
1364 @cindex transposition, MIDI
1365 @cindex transposition, instrument
1366 @cindex transposing instrument
1367 @cindex MIDI
1368 @cindex MIDI transposition
1369
1370 @funindex \transposition
1371 @funindex transposition
1372
1373 When typesetting scores that involve transposing instruments, some
1374 parts can be typeset in a different pitch than the
1375 @notation{concert pitch}.  In these cases, the key of the
1376 @notation{transposing instrument} should be specified; otherwise
1377 the MIDI output and cues in other parts will produce incorrect
1378 pitches.  For more information about quotations, see
1379 @ref{Quoting other voices}.
1380
1381 @example
1382 \transposition @var{pitch}
1383 @end example
1384
1385 The pitch to use for @code{\transposition} should correspond to
1386 the real sound heard when a@tie{}@code{c'} written on the staff is
1387 played by the transposing instrument.  This pitch is entered in
1388 absolute mode, so an instrument that produces a real sound which
1389 is one tone higher than the printed music should use
1390 @w{@code{\transposition d'}}.  @code{\transposition} should
1391 @emph{only} be used if the pitches are @emph{not} being entered in
1392 concert pitch.
1393
1394 Here are a few notes for violin and B-flat clarinet where the
1395 parts have been entered using the notes and key as they appear in
1396 each part of the conductor's score.  The two instruments are
1397 playing in unison.
1398
1399 @lilypond[verbatim,quote]
1400 \new GrandStaff <<
1401   \new Staff = "violin" {
1402     \relative c'' {
1403       \set Staff.instrumentName = #"Vln"
1404       \set Staff.midiInstrument = #"violin"
1405       % not strictly necessary, but a good reminder
1406       \transposition c'
1407
1408       \key c \major
1409       g4( c8) r c r c4
1410     }
1411   }
1412   \new Staff = "clarinet" {
1413     \relative c'' {
1414       \set Staff.instrumentName = \markup { Cl (B\flat) }
1415       \set Staff.midiInstrument = #"clarinet"
1416       \transposition bes
1417
1418       \key d \major
1419       a4( d8) r d r d4
1420     }
1421   }
1422 >>
1423 @end lilypond
1424
1425 The @code{\transposition} may be changed during a piece.  For
1426 example, a clarinetist may switch from an A clarinet to a B-flat
1427 clarinet.
1428
1429 @lilypond[verbatim,quote,relative=2]
1430 \set Staff.instrumentName = #"Cl (A)"
1431 \key a \major
1432 \transposition a
1433 c d e f
1434 \textLengthOn
1435 <>^\markup { Switch to B\flat clarinet }
1436 R1
1437
1438 \key bes \major
1439 \transposition bes
1440 c2 g
1441 @end lilypond
1442
1443 @seealso
1444 Music Glossary:
1445 @rglos{concert pitch},
1446 @rglos{transposing instrument}.
1447
1448 Notation Reference:
1449 @ref{Quoting other voices},
1450 @ref{Transpose}.
1451
1452 Snippets:
1453 @rlsr{Pitches}.
1454
1455
1456 @node Automatic accidentals
1457 @unnumberedsubsubsec Automatic accidentals
1458
1459 @cindex accidental style
1460 @cindex accidental style, default
1461 @cindex accidentals
1462 @cindex accidentals, automatic
1463 @cindex automatic accidentals
1464 @cindex default accidental style
1465
1466 @funindex \accidentalStyle
1467 @funindex voice
1468 @funindex default
1469
1470 There are many different conventions on how to typeset
1471 accidentals.  LilyPond provides a function to specify which
1472 accidental style to use.  This function is called as follows:
1473
1474 @example
1475 \new Staff <<
1476   \accidentalStyle "voice"
1477   @{ @dots{} @}
1478 >>
1479 @end example
1480
1481 The accidental style applies to the current @code{Staff} by
1482 default (with the exception of the styles @code{piano} and
1483 @code{piano-cautionary}, which are explained below).  Optionally,
1484 the function can take a second argument that determines in which
1485 scope the style should be changed.  For example, to use the same
1486 style in all staves of the current @code{StaffGroup}, use:
1487
1488 @example
1489 \accidentalStyle #'StaffGroup "voice"
1490 @end example
1491
1492 The following accidental styles are supported.  To demonstrate
1493 each style, we use the following example:
1494
1495
1496 @lilypond[verbatim,quote]
1497 musicA = {
1498   <<
1499     \relative c' {
1500       cis'8 fis, bes4 <a cis>8 f bis4 |
1501       cis2. <c, g'>4 |
1502     }
1503     \\
1504     \relative c' {
1505       ais'2 cis, |
1506       fis8 b a4 cis2 |
1507     }
1508   >>
1509 }
1510
1511 musicB = {
1512   \clef bass
1513   \new Voice {
1514     \voiceTwo \relative c' {
1515       <fis, a cis>8[ <fis a cis>
1516       \change Staff = up
1517       cis' cis
1518       \change Staff = down
1519       <fis, a> <fis a>]
1520       \showStaffSwitch
1521       \change Staff = up
1522       dis'4 |
1523       \change Staff = down
1524       <fis, a cis>4 gis <f a d>2 |
1525     }
1526   }
1527 }
1528
1529 \new PianoStaff {
1530   <<
1531     \context Staff = "up" {
1532       \accidentalStyle "default"
1533       \musicA
1534     }
1535     \context Staff = "down" {
1536       \accidentalStyle "default"
1537       \musicB
1538     }
1539   >>
1540 }
1541 @end lilypond
1542
1543 Note that the last lines of this example can be replaced by the
1544 following, as long as the same accidental style should be used in
1545 both staves.
1546
1547 @example
1548 \new PianoStaff @{
1549   <<
1550     \context Staff = "up" @{
1551       %%% change the next line as desired:
1552       \accidentalStyle #'Score "default"
1553       \musicA
1554     @}
1555     \context Staff = "down" @{
1556       \musicB
1557     @}
1558   >>
1559 @}
1560 @end example
1561
1562
1563 @c don't use verbatim in this table.
1564 @table @code
1565 @item default
1566
1567 @cindex default accidental style
1568 @cindex accidental style, default
1569
1570 @funindex default
1571
1572 This is the default typesetting behavior.  It corresponds to
1573 eighteenth-century common practice: accidentals are remembered to
1574 the end of the measure in which they occur and only in their own
1575 octave.  Thus, in the example below, no natural signs are printed
1576 before the@tie{}@code{b} in the second measure or the
1577 last@tie{}@code{c}:
1578
1579 @lilypond[quote]
1580 musicA = {
1581   <<
1582     \relative c' {
1583       cis'8 fis, bes4 <a cis>8 f bis4 |
1584       cis2. <c, g'>4 |
1585     }
1586     \\
1587     \relative c' {
1588       ais'2 cis, |
1589       fis8 b a4 cis2 |
1590     }
1591   >>
1592 }
1593
1594 musicB = {
1595   \clef bass
1596   \new Voice {
1597     \voiceTwo \relative c' {
1598       <fis, a cis>8[ <fis a cis>
1599       \change Staff = up
1600       cis' cis
1601       \change Staff = down
1602       <fis, a> <fis a>]
1603       \showStaffSwitch
1604       \change Staff = up
1605       dis'4 |
1606       \change Staff = down
1607       <fis, a cis>4 gis <f a d>2 |
1608     }
1609   }
1610 }
1611
1612 \new PianoStaff {
1613   <<
1614     \context Staff = "up" {
1615       \accidentalStyle "default"
1616       \musicA
1617     }
1618     \context Staff = "down" {
1619       \accidentalStyle "default"
1620       \musicB
1621     }
1622   >>
1623 }
1624 @end lilypond
1625
1626 @item voice
1627
1628 @cindex accidental style, voice
1629 @cindex voice accidental style
1630 @cindex accidental style, modern
1631 @cindex modern accidental style
1632 @cindex accidental style, modern-cautionary
1633 @cindex modern-cautionary accidental style
1634
1635 @funindex voice
1636
1637 The normal behavior is to remember the accidentals at
1638 @code{Staff}-level.  In this style, however, accidentals are
1639 typeset individually for each voice.  Apart from that, the rule is
1640 similar to @code{default}.
1641
1642 As a result, accidentals from one voice do not get canceled in
1643 other voices, which is often an unwanted result: in the following
1644 example, it is hard to determine whether the second@tie{}@code{a}
1645 should be played natural or sharp.  The @code{voice} option should
1646 therefore be used only if the voices are to be read solely by
1647 individual musicians.  If the staff is to be used by one musician
1648 (e.g., a conductor or in a piano score) then @code{modern} or
1649 @code{modern-cautionary} should be used instead.
1650
1651
1652 @lilypond[quote]
1653 musicA = {
1654   <<
1655     \relative c' {
1656       cis'8 fis, bes4 <a cis>8 f bis4 |
1657       cis2. <c, g'>4 |
1658     }
1659     \\
1660     \relative c' {
1661       ais'2 cis, |
1662       fis8 b a4 cis2 |
1663     }
1664   >>
1665 }
1666
1667 musicB = {
1668   \clef bass
1669   \new Voice {
1670     \voiceTwo \relative c' {
1671       <fis, a cis>8[ <fis a cis>
1672       \change Staff = up
1673       cis' cis
1674       \change Staff = down
1675       <fis, a> <fis a>]
1676       \showStaffSwitch
1677       \change Staff = up
1678       dis'4 |
1679       \change Staff = down
1680       <fis, a cis>4 gis <f a d>2 |
1681     }
1682   }
1683 }
1684
1685 \new PianoStaff {
1686   <<
1687     \context Staff = "up" {
1688       \accidentalStyle "voice"
1689       \musicA
1690     }
1691     \context Staff = "down" {
1692       \accidentalStyle "voice"
1693       \musicB
1694     }
1695   >>
1696 }
1697 @end lilypond
1698
1699 @item modern
1700
1701 @cindex accidentals, modern style
1702 @cindex modern style accidentals
1703
1704 @funindex modern
1705
1706 This rule corresponds to the common practice in the twentieth
1707 century.  It omits some extra natural signs, which were
1708 traditionally prefixed to a sharp following a double sharp,
1709 or a flat following a double flat.  The @code{modern} rule
1710 prints the same accidentals as @code{default}, with
1711 two additions that serve to avoid ambiguity: after temporary
1712 accidentals, cancellation marks are printed also in the following
1713 measure (for notes in the same octave) and, in the same measure,
1714 for notes in other octaves.  Hence the naturals before
1715 the@tie{}@code{b} and the@tie{}@code{c} in the second measure of
1716 the upper staff:
1717
1718 @lilypond[quote]
1719 musicA = {
1720   <<
1721     \relative c' {
1722       cis'8 fis, bes4 <a cis>8 f bis4 |
1723       cis2. <c, g'>4 |
1724     }
1725     \\
1726     \relative c' {
1727       ais'2 cis, |
1728       fis8 b a4 cis2 |
1729     }
1730   >>
1731 }
1732
1733 musicB = {
1734   \clef bass
1735   \new Voice {
1736     \voiceTwo \relative c' {
1737       <fis, a cis>8[ <fis a cis>
1738       \change Staff = up
1739       cis' cis
1740       \change Staff = down
1741       <fis, a> <fis a>]
1742       \showStaffSwitch
1743       \change Staff = up
1744       dis'4 |
1745       \change Staff = down
1746       <fis, a cis>4 gis <f a d>2 |
1747     }
1748   }
1749 }
1750
1751 \new PianoStaff {
1752   <<
1753     \context Staff = "up" {
1754       \accidentalStyle "modern"
1755       \musicA
1756     }
1757     \context Staff = "down" {
1758       \accidentalStyle "modern"
1759       \musicB
1760     }
1761   >>
1762 }
1763 @end lilypond
1764
1765 @item modern-cautionary
1766
1767 @cindex accidentals, modern cautionary style
1768 @cindex modern accidental style
1769 @cindex modern cautionary accidental style
1770 @cindex modern style accidentals
1771 @cindex modern style cautionary accidentals
1772
1773 @funindex modern-cautionary
1774
1775 This rule is similar to @code{modern}, but the @q{extra}
1776 accidentals (the ones not typeset by @code{default}) are typeset
1777 as cautionary accidentals.  They are by default printed with
1778 parentheses, but they can also be printed in reduced size by
1779 defining the @code{cautionary-style} property of
1780 @code{AccidentalSuggestion}.
1781
1782 @lilypond[quote]
1783 musicA = {
1784   <<
1785     \relative c' {
1786       cis'8 fis, bes4 <a cis>8 f bis4 |
1787       cis2. <c, g'>4 |
1788     }
1789     \\
1790     \relative c' {
1791       ais'2 cis, |
1792       fis8 b a4 cis2 |
1793     }
1794   >>
1795 }
1796
1797 musicB = {
1798   \clef bass
1799   \new Voice {
1800     \voiceTwo \relative c' {
1801       <fis, a cis>8[ <fis a cis>
1802       \change Staff = up
1803       cis' cis
1804       \change Staff = down
1805       <fis, a> <fis a>]
1806       \showStaffSwitch
1807       \change Staff = up
1808       dis'4 |
1809       \change Staff = down
1810       <fis, a cis>4 gis <f a d>2 |
1811     }
1812   }
1813 }
1814
1815 \new PianoStaff {
1816   <<
1817     \context Staff = "up" {
1818       \accidentalStyle "modern-cautionary"
1819       \musicA
1820     }
1821     \context Staff = "down" {
1822       \accidentalStyle "modern-cautionary"
1823       \musicB
1824     }
1825   >>
1826 }
1827 @end lilypond
1828
1829 @item modern-voice
1830
1831 @cindex accidental style, modern
1832 @cindex accidentals, modern
1833 @cindex accidentals, multivoice
1834 @cindex modern accidental style
1835 @cindex modern accidentals
1836 @cindex multivoice accidentals
1837
1838 @funindex modern-voice
1839
1840 This rule is used for multivoice accidentals to be read both by
1841 musicians playing one voice and musicians playing all voices.
1842 Accidentals are typeset for each voice, but they @emph{are}
1843 canceled across voices in the same @code{Staff}.  Hence,
1844 the@tie{}@code{a} in the last measure is canceled because the
1845 previous cancellation was in a different voice, and
1846 the@tie{}@code{d} in the lower staff is canceled because of the
1847 accidental in a different voice in the previous measure:
1848
1849 @lilypond[quote]
1850 musicA = {
1851   <<
1852     \relative c' {
1853       cis'8 fis, bes4 <a cis>8 f bis4 |
1854       cis2. <c, g'>4 |
1855     }
1856     \\
1857     \relative c' {
1858       ais'2 cis, |
1859       fis8 b a4 cis2 |
1860     }
1861   >>
1862 }
1863
1864 musicB = {
1865   \clef bass
1866   \new Voice {
1867     \voiceTwo \relative c' {
1868       <fis, a cis>8[ <fis a cis>
1869       \change Staff = up
1870       cis' cis
1871       \change Staff = down
1872       <fis, a> <fis a>]
1873       \showStaffSwitch
1874       \change Staff = up
1875       dis'4 |
1876       \change Staff = down
1877       <fis, a cis>4 gis <f a d>2 |
1878     }
1879   }
1880 }
1881
1882 \new PianoStaff {
1883   <<
1884     \context Staff = "up" {
1885       \accidentalStyle "modern-voice"
1886       \musicA
1887     }
1888     \context Staff = "down" {
1889       \accidentalStyle "modern-voice"
1890       \musicB
1891     }
1892   >>
1893 }
1894 @end lilypond
1895
1896 @cindex accidental style, cautionary, modern voice
1897 @cindex accidental style, modern voice cautionary
1898 @cindex accidental style, voice, modern cautionary
1899
1900 @funindex modern-voice-cautionary
1901
1902 @item modern-voice-cautionary
1903
1904 This rule is the same as @code{modern-voice}, but with the extra
1905 accidentals (the ones not typeset by @code{voice}) typeset as
1906 cautionaries.  Even though all accidentals typeset by
1907 @code{default} @emph{are} typeset with this rule, some of them are
1908 typeset as cautionaries.
1909
1910 @lilypond[quote]
1911 musicA = {
1912   <<
1913     \relative c' {
1914       cis'8 fis, bes4 <a cis>8 f bis4 |
1915       cis2. <c, g'>4 |
1916     }
1917     \\
1918     \relative c' {
1919       ais'2 cis, |
1920       fis8 b a4 cis2 |
1921     }
1922   >>
1923 }
1924
1925 musicB = {
1926   \clef bass
1927   \new Voice {
1928     \voiceTwo \relative c' {
1929       <fis, a cis>8[ <fis a cis>
1930       \change Staff = up
1931       cis' cis
1932       \change Staff = down
1933       <fis, a> <fis a>]
1934       \showStaffSwitch
1935       \change Staff = up
1936       dis'4 |
1937       \change Staff = down
1938       <fis, a cis>4 gis <f a d>2 |
1939     }
1940   }
1941 }
1942
1943 \new PianoStaff {
1944   <<
1945     \context Staff = "up" {
1946       \accidentalStyle "modern-voice-cautionary"
1947       \musicA
1948     }
1949     \context Staff = "down" {
1950       \accidentalStyle "modern-voice-cautionary"
1951       \musicB
1952     }
1953   >>
1954 }
1955 @end lilypond
1956
1957 @item piano
1958
1959 @cindex accidental style, piano
1960 @cindex accidentals, piano
1961 @cindex piano accidental style
1962 @cindex piano accidentals
1963
1964 @funindex piano
1965
1966 This rule reflects twentieth-century practice for piano notation.
1967 Its behavior is very similar to @code{modern} style, but here
1968 accidentals also get canceled across the staves in the same
1969 @code{GrandStaff} or @code{PianoStaff}, hence all the
1970 cancellations of the final notes.
1971
1972 This accidental style applies to the current @code{GrandStaff} or
1973 @code{PianoStaff} by default.
1974
1975 @lilypond[quote]
1976 musicA = {
1977   <<
1978     \relative c' {
1979       cis'8 fis, bes4 <a cis>8 f bis4 |
1980       cis2. <c, g'>4 |
1981     }
1982     \\
1983     \relative c' {
1984       ais'2 cis, |
1985       fis8 b a4 cis2 |
1986     }
1987   >>
1988 }
1989
1990 musicB = {
1991   \clef bass
1992   \new Voice {
1993     \voiceTwo \relative c' {
1994       <fis, a cis>8[ <fis a cis>
1995       \change Staff = up
1996       cis' cis
1997       \change Staff = down
1998       <fis, a> <fis a>]
1999       \showStaffSwitch
2000       \change Staff = up
2001       dis'4 |
2002       \change Staff = down
2003       <fis, a cis>4 gis <f a d>2 |
2004     }
2005   }
2006 }
2007
2008 \new PianoStaff {
2009   <<
2010     \context Staff = "up" {
2011       \accidentalStyle "piano"
2012       \musicA
2013     }
2014     \context Staff = "down" {
2015       \musicB
2016     }
2017   >>
2018 }
2019 @end lilypond
2020
2021 @item piano-cautionary
2022
2023 @cindex accidentals, piano cautionary
2024 @cindex cautionary accidentals, piano
2025 @cindex piano cautionary accidentals
2026 @cindex accidental style, piano cautionary
2027 @cindex cautionary accidental style, piano
2028 @cindex piano cautionary accidental style
2029
2030 @funindex piano-cautionary
2031
2032 This is the same as @code{piano} but with the extra accidentals
2033 typeset as cautionaries.
2034
2035 @lilypond[quote]
2036 musicA = {
2037   <<
2038     \relative c' {
2039       cis'8 fis, bes4 <a cis>8 f bis4 |
2040       cis2. <c, g'>4 |
2041     }
2042     \\
2043     \relative c' {
2044       ais'2 cis, |
2045       fis8 b a4 cis2 |
2046     }
2047   >>
2048 }
2049
2050 musicB = {
2051   \clef bass
2052   \new Voice {
2053     \voiceTwo \relative c' {
2054       <fis, a cis>8[ <fis a cis>
2055       \change Staff = up
2056       cis' cis
2057       \change Staff = down
2058       <fis, a> <fis a>]
2059       \showStaffSwitch
2060       \change Staff = up
2061       dis'4 |
2062       \change Staff = down
2063       <fis, a cis>4 gis <f a d>2 |
2064     }
2065   }
2066 }
2067
2068 \new PianoStaff {
2069   <<
2070     \context Staff = "up" {
2071       \accidentalStyle "piano-cautionary"
2072       \musicA
2073     }
2074     \context Staff = "down" {
2075       \musicB
2076     }
2077   >>
2078 }
2079 @end lilypond
2080
2081
2082 @item neo-modern
2083
2084 @cindex neo-modern accidental style
2085 @cindex accidental style, neo-modern
2086
2087 @funindex neo-modern
2088
2089 This rule reproduces a common practice in contemporary music:
2090 accidentals are printed like with @code{modern}, but they are printed
2091 again if the same note appears later in the same measure -- except
2092 if the note is immediately repeated.
2093
2094 @lilypond[quote]
2095 musicA = {
2096   <<
2097     \relative c' {
2098       cis'8 fis, bes4 <a cis>8 f bis4 |
2099       cis2. <c, g'>4 |
2100     }
2101     \\
2102     \relative c' {
2103       ais'2 cis, |
2104       fis8 b a4 cis2 |
2105     }
2106   >>
2107 }
2108
2109 musicB = {
2110   \clef bass
2111   \new Voice {
2112     \voiceTwo \relative c' {
2113       <fis, a cis>8[ <fis a cis>
2114       \change Staff = up
2115       cis' cis
2116       \change Staff = down
2117       <fis, a> <fis a>]
2118       \showStaffSwitch
2119       \change Staff = up
2120       dis'4 |
2121       \change Staff = down
2122       <fis, a cis>4 gis <f a d>2 |
2123     }
2124   }
2125 }
2126
2127 \new PianoStaff {
2128   <<
2129     \context Staff = "up" {
2130       \accidentalStyle "neo-modern"
2131       \musicA
2132     }
2133     \context Staff = "down" {
2134       \accidentalStyle "neo-modern"
2135       \musicB
2136     }
2137   >>
2138 }
2139 @end lilypond
2140
2141 @item neo-modern-cautionary
2142
2143 @cindex neo-modern-cautionary accidental style
2144 @cindex accidental style, neo-modern-cautionary
2145
2146 @funindex neo-modern-cautionary
2147
2148 This rule is similar to @code{neo-modern}, but the extra
2149 accidentals are printed as cautionary accidentals.
2150
2151 @lilypond[quote]
2152 musicA = {
2153   <<
2154     \relative c' {
2155       cis'8 fis, bes4 <a cis>8 f bis4 |
2156       cis2. <c, g'>4 |
2157     }
2158     \\
2159     \relative c' {
2160       ais'2 cis, |
2161       fis8 b a4 cis2 |
2162     }
2163   >>
2164 }
2165
2166 musicB = {
2167   \clef bass
2168   \new Voice {
2169     \voiceTwo \relative c' {
2170       <fis, a cis>8[ <fis a cis>
2171       \change Staff = up
2172       cis' cis
2173       \change Staff = down
2174       <fis, a> <fis a>]
2175       \showStaffSwitch
2176       \change Staff = up
2177       dis'4 |
2178       \change Staff = down
2179       <fis, a cis>4 gis <f a d>2 |
2180     }
2181   }
2182 }
2183
2184 \new PianoStaff {
2185   <<
2186     \context Staff = "up" {
2187       \accidentalStyle "neo-modern-cautionary"
2188       \musicA
2189     }
2190     \context Staff = "down" {
2191       \accidentalStyle "neo-modern-cautionary"
2192       \musicB
2193     }
2194   >>
2195 }
2196 @end lilypond
2197
2198
2199 @item neo-modern-voice
2200
2201 @cindex neo-modern-voice accidental style
2202 @cindex accidental style, neo-modern-voice
2203
2204 @funindex neo-modern-voice
2205
2206 This rule is used for multivoice accidentals to be read both by
2207 musicians playing one voice and musicians playing all voices.
2208 Accidentals are typeset for each voice as with @code{neo-modern},
2209 but they are canceled across voices in the same @code{Staff}.
2210
2211 @lilypond[quote]
2212 musicA = {
2213   <<
2214     \relative c' {
2215       cis'8 fis, bes4 <a cis>8 f bis4 |
2216       cis2. <c, g'>4 |
2217     }
2218     \\
2219     \relative c' {
2220       ais'2 cis, |
2221       fis8 b a4 cis2 |
2222     }
2223   >>
2224 }
2225
2226 musicB = {
2227   \clef bass
2228   \new Voice {
2229     \voiceTwo \relative c' {
2230       <fis, a cis>8[ <fis a cis>
2231       \change Staff = up
2232       cis' cis
2233       \change Staff = down
2234       <fis, a> <fis a>]
2235       \showStaffSwitch
2236       \change Staff = up
2237       dis'4 |
2238       \change Staff = down
2239       <fis, a cis>4 gis <f a d>2 |
2240     }
2241   }
2242 }
2243
2244 \new PianoStaff {
2245   <<
2246     \context Staff = "up" {
2247       \accidentalStyle "neo-modern-voice"
2248       \musicA
2249     }
2250     \context Staff = "down" {
2251       \accidentalStyle "neo-modern-voice"
2252       \musicB
2253     }
2254   >>
2255 }
2256 @end lilypond
2257
2258 @item neo-modern-voice-cautionary
2259
2260 @cindex neo-modern-voice-cautionary accidental style
2261 @cindex accidental style, neo-modern-voice-cautionary
2262
2263 @funindex neo-modern-voice-cautionary
2264
2265 This rule is similar to @code{neo-modern-voice}, but the extra
2266 accidentals are printed as cautionary accidentals.
2267
2268 @lilypond[quote]
2269 musicA = {
2270   <<
2271     \relative c' {
2272       cis'8 fis, bes4 <a cis>8 f bis4 |
2273       cis2. <c, g'>4 |
2274     }
2275     \\
2276     \relative c' {
2277       ais'2 cis, |
2278       fis8 b a4 cis2 |
2279     }
2280   >>
2281 }
2282
2283 musicB = {
2284   \clef bass
2285   \new Voice {
2286     \voiceTwo \relative c' {
2287       <fis, a cis>8[ <fis a cis>
2288       \change Staff = up
2289       cis' cis
2290       \change Staff = down
2291       <fis, a> <fis a>]
2292       \showStaffSwitch
2293       \change Staff = up
2294       dis'4 |
2295       \change Staff = down
2296       <fis, a cis>4 gis <f a d>2 |
2297     }
2298   }
2299 }
2300
2301 \new PianoStaff {
2302   <<
2303     \context Staff = "up" {
2304       \accidentalStyle "neo-modern-voice-cautionary"
2305       \musicA
2306     }
2307     \context Staff = "down" {
2308       \accidentalStyle "neo-modern-voice-cautionary"
2309       \musicB
2310     }
2311   >>
2312 }
2313 @end lilypond
2314
2315 @item dodecaphonic
2316
2317 @cindex dodecaphonic accidental style
2318 @cindex dodecaphonic style, neo-modern
2319
2320 @funindex dodecaphonic
2321
2322 This rule reflects a practice introduced by composers at
2323 the beginning of the 20th century, in an attempt to
2324 abolish the hierarchy between natural and non-natural notes.
2325 With this style, @emph{every} note gets an accidental sign,
2326 including natural signs.
2327
2328 @lilypond[quote]
2329 musicA = {
2330   <<
2331     \relative c' {
2332       cis'8 fis, bes4 <a cis>8 f bis4 |
2333       cis2. <c, g'>4 |
2334     }
2335     \\
2336     \relative c' {
2337       ais'2 cis, |
2338       fis8 b a4 cis2 |
2339     }
2340   >>
2341 }
2342
2343 musicB = {
2344   \clef bass
2345   \new Voice {
2346     \voiceTwo \relative c' {
2347       <fis, a cis>8[ <fis a cis>
2348       \change Staff = up
2349       cis' cis
2350       \change Staff = down
2351       <fis, a> <fis a>]
2352       \showStaffSwitch
2353       \change Staff = up
2354       dis'4 |
2355       \change Staff = down
2356       <fis, a cis>4 gis <f a d>2 |
2357     }
2358   }
2359 }
2360
2361 \new PianoStaff {
2362   <<
2363     \context Staff = "up" {
2364       \accidentalStyle "dodecaphonic"
2365       \musicA
2366     }
2367     \context Staff = "down" {
2368       \accidentalStyle "dodecaphonic"
2369       \musicB
2370     }
2371   >>
2372 }
2373 @end lilypond
2374
2375
2376 @item teaching
2377
2378 @cindex teaching accidental style
2379 @cindex accidental style, teaching
2380
2381 @funindex teaching
2382
2383 This rule is intended for students, and makes it easy to create
2384 scale sheets with automatically created cautionary accidentals.
2385 Accidentals are printed like with @code{modern}, but cautionary
2386 accidentals are added for all sharp or flat tones specified by the
2387 key signature, except if the note is immediately repeated.
2388
2389 @lilypond[quote,staffsize=18]
2390 musicA = {
2391   <<
2392     \relative c' {
2393       cis'8 fis, bes4 <a cis>8 f bis4 |
2394       cis2. <c, g'>4 |
2395     }
2396     \\
2397     \relative c' {
2398       ais'2 cis, |
2399       fis8 b a4 cis2 |
2400     }
2401   >>
2402 }
2403
2404 musicB = {
2405   \clef bass
2406   \new Voice {
2407     \voiceTwo \relative c' {
2408       <fis, a cis>8[ <fis a cis>
2409       \change Staff = up
2410       cis' cis
2411       \change Staff = down
2412       <fis, a> <fis a>]
2413       \showStaffSwitch
2414       \change Staff = up
2415       dis'4 |
2416       \change Staff = down
2417       <fis, a cis>4 gis <f a d>2 |
2418     }
2419   }
2420 }
2421
2422 \new PianoStaff {
2423   <<
2424     \context Staff = "up" {
2425       \key fis \minor
2426       \accidentalStyle "teaching"
2427       \musicA
2428     }
2429     \context Staff = "down" {
2430       \key fis \minor
2431       \accidentalStyle "teaching"
2432       \musicB
2433     }
2434   >>
2435 }
2436 @end lilypond
2437
2438
2439
2440 @item no-reset
2441
2442 @cindex accidental style, no reset
2443 @cindex no reset accidental style
2444
2445 @funindex no-reset
2446
2447 This is the same as @code{default} but with accidentals lasting
2448 @q{forever} and not only within the same measure:
2449
2450 @lilypond[quote]
2451 musicA = {
2452   <<
2453     \relative c' {
2454       cis'8 fis, bes4 <a cis>8 f bis4 |
2455       cis2. <c, g'>4 |
2456     }
2457     \\
2458     \relative c' {
2459       ais'2 cis, |
2460       fis8 b a4 cis2 |
2461     }
2462   >>
2463 }
2464
2465 musicB = {
2466   \clef bass
2467   \new Voice {
2468     \voiceTwo \relative c' {
2469       <fis, a cis>8[ <fis a cis>
2470       \change Staff = up
2471       cis' cis
2472       \change Staff = down
2473       <fis, a> <fis a>]
2474       \showStaffSwitch
2475       \change Staff = up
2476       dis'4 |
2477       \change Staff = down
2478       <fis, a cis>4 gis <f a d>2 |
2479     }
2480   }
2481 }
2482
2483 \new PianoStaff {
2484   <<
2485     \context Staff = "up" {
2486       \accidentalStyle "no-reset"
2487       \musicA
2488     }
2489     \context Staff = "down" {
2490       \accidentalStyle "no-reset"
2491       \musicB
2492     }
2493   >>
2494 }
2495 @end lilypond
2496
2497 @item forget
2498
2499 @cindex forget accidental style
2500 @cindex accidental style, forget
2501
2502 @funindex forget
2503
2504 This is the opposite of @code{no-reset}: Accidentals are not
2505 remembered at all -- and hence all accidentals are typeset
2506 relative to the key signature, regardless of what came before in
2507 the music.
2508
2509 @lilypond[quote]
2510 musicA = {
2511   <<
2512     \relative c' {
2513       cis'8 fis, bes4 <a cis>8 f bis4 |
2514       cis2. <c, g'>4 |
2515     }
2516     \\
2517     \relative c' {
2518       ais'2 cis, |
2519       fis8 b a4 cis2 |
2520     }
2521   >>
2522 }
2523
2524 musicB = {
2525   \clef bass
2526   \new Voice {
2527     \voiceTwo \relative c' {
2528       <fis, a cis>8[ <fis a cis>
2529       \change Staff = up
2530       cis' cis
2531       \change Staff = down
2532       <fis, a> <fis a>]
2533       \showStaffSwitch
2534       \change Staff = up
2535       dis'4 |
2536       \change Staff = down
2537       <fis, a cis>4 gis <f a d>2 |
2538     }
2539   }
2540 }
2541
2542 \new PianoStaff {
2543   <<
2544     \context Staff = "up" {
2545       \accidentalStyle "forget"
2546       \musicA
2547     }
2548     \context Staff = "down" {
2549       \accidentalStyle "forget"
2550       \musicB
2551     }
2552   >>
2553 }
2554 @end lilypond
2555 @end table
2556
2557 @seealso
2558 Snippets:
2559 @rlsr{Pitches}.
2560
2561 Internals Reference:
2562 @rinternals{Accidental},
2563 @rinternals{Accidental_engraver},
2564 @rinternals{GrandStaff},
2565 @rinternals{PianoStaff},
2566 @rinternals{Staff},
2567 @rinternals{AccidentalSuggestion},
2568 @rinternals{AccidentalPlacement},
2569 @rinternals{accidental-suggestion-interface}.
2570
2571 @cindex accidentals and simultaneous notes
2572 @cindex simultaneous notes and accidentals
2573 @cindex accidentals in chords
2574 @cindex chords, accidentals in
2575
2576 @knownissues
2577 Simultaneous notes are not considered in the automatic
2578 determination of accidentals; only previous notes and the key
2579 signature are considered.  Forcing accidentals with@tie{}@code{!}
2580 or@tie{}@code{?} may be required when the same note name occurs
2581 simultaneously with different alterations, as in @samp{<f! fis!>}.
2582
2583 Cautionary cancellation of accidentals is done by looking at previous measure.
2584 However, in the @code{\alternative} block following a @code{\repeat volta N}
2585 section, one would expect the cancellation being calculated using the previous
2586 @emph{played} measure, not previous @emph{printed} measure.
2587 In the following example, the natural @code{c} in the second alternative does
2588 not need a natural sign:
2589
2590 @lilypond[quote]
2591 {
2592   \accidentalStyle "modern"
2593   \time 2/4
2594   \repeat volta 2 {
2595     c'2
2596   }
2597   \alternative {
2598      cis'
2599      c'
2600   }
2601 }
2602 @end lilypond
2603
2604 The following work-around can be used: define a function that locally changes
2605 the accidental style to @code{forget}:
2606
2607 @lilypond[verbatim,quote]
2608 forget = #(define-music-function (parser location music) (ly:music?) #{
2609   \accidentalStyle "forget"
2610   #music
2611   \accidentalStyle "modern"
2612 #})
2613 {
2614   \accidentalStyle "modern"
2615   \time 2/4
2616   \repeat volta 2 {
2617     c'2
2618   }
2619   \alternative {
2620      cis'
2621      \forget c'
2622   }
2623 }
2624 @end lilypond
2625
2626
2627 @node Ambitus
2628 @unnumberedsubsubsec Ambitus
2629
2630 @cindex ambitus
2631 @cindex range of pitches
2632 @cindex pitch range
2633
2634 The term @notation{ambitus} (pl. ambitus) denotes a range of
2635 pitches for a given voice in a part of music.  It may also denote
2636 the pitch range that a musical instrument is capable of playing.
2637 Ambitus are printed on vocal parts so that performers can easily
2638 determine if it matches their capabilities.
2639
2640 Ambitus are denoted at the beginning of a piece near the initial
2641 clef.  The range is graphically specified by two note heads that
2642 represent the lowest and highest pitches.  Accidentals are only
2643 printed if they are not part of the key signature.
2644
2645 @lilypond[verbatim,quote]
2646 \layout {
2647   \context {
2648     \Voice
2649     \consists "Ambitus_engraver"
2650   }
2651 }
2652
2653 \relative c'' {
2654   aes c e2
2655   cis,1
2656 }
2657 @end lilypond
2658
2659
2660 @snippets
2661
2662 @lilypondfile[verbatim,quote,texidoc,doctitle]
2663 {adding-ambitus-per-voice.ly}
2664
2665 @lilypondfile[verbatim,quote,texidoc,doctitle]
2666 {ambitus-with-multiple-voices.ly}
2667
2668 @lilypondfile[verbatim,quote,texidoc,doctitle]
2669 {changing-the-ambitus-gap.ly}
2670
2671 @seealso
2672 Music Glossary:
2673 @rglos{ambitus}.
2674
2675 Snippets:
2676 @rlsr{Pitches}.
2677
2678 Internals Reference:
2679 @rinternals{Ambitus_engraver},
2680 @rinternals{Voice},
2681 @rinternals{Staff},
2682 @rinternals{Ambitus},
2683 @rinternals{AmbitusAccidental},
2684 @rinternals{AmbitusLine},
2685 @rinternals{AmbitusNoteHead},
2686 @rinternals{ambitus-interface}.
2687
2688 @knownissues
2689 There is no collision handling in the case of multiple per-voice
2690 ambitus.
2691
2692
2693 @node Note heads
2694 @subsection Note heads
2695
2696 This section suggests ways of altering note heads.
2697
2698 @menu
2699 * Special note heads::
2700 * Easy notation note heads::
2701 * Shape note heads::
2702 * Improvisation::
2703 @end menu
2704
2705 @node Special note heads
2706 @unnumberedsubsubsec Special note heads
2707
2708 @cindex note heads, special
2709 @cindex note heads, cross
2710 @cindex note heads, diamond
2711 @cindex note heads, parlato
2712 @cindex note heads, harmonic
2713 @cindex note heads, guitar
2714 @cindex special note heads
2715 @cindex cross note heads
2716 @cindex diamond note heads
2717 @cindex parlato note heads
2718 @cindex harmonic note heads
2719 @cindex guitar note heads
2720 @cindex note head styles
2721 @cindex styles, note heads
2722
2723 @funindex cross
2724
2725 The appearance of note heads may be altered:
2726
2727 @lilypond[verbatim,quote,relative=2]
2728 c4 b
2729 \override NoteHead #'style = #'cross
2730 c4 b
2731 \revert NoteHead #'style
2732 a b
2733 \override NoteHead #'style = #'harmonic
2734 a b
2735 \revert NoteHead #'style
2736 c4 d e f
2737 @end lilypond
2738
2739 To see all note head styles, see @ref{Note head styles}.
2740
2741 The @code{cross} style is used to represent a variety of musical
2742 intentions.  The following generic predefined commands modify the
2743 note head in both staff and tablature contexts and can be used to
2744 represent any musical meaning:
2745
2746 @lilypond[verbatim,quote,relative=2]
2747 c4 b
2748 \xNotesOn
2749  a b c4 b
2750 \xNotesOff
2751 c4 d
2752 @end lilypond
2753
2754 The music function form of this predefined command may be used
2755 inside and outside chords to generate crossed note heads in both
2756 staff and tablature contexts:
2757
2758 @lilypond[verbatim,quote,relative=2]
2759 c4 b
2760 \xNote { e f }
2761 c b < g \xNote c f > b
2762 @end lilypond
2763
2764 As synonyms for @code{\xNote}, @code{\xNotesOn} and @code{\xNotesOff},
2765 @code{\deadNote}, @code{\deadNotesOn} and @code{\deadNotesOff} can
2766 be used.  The term @notation{dead note} is commonly used by guitarists.
2767
2768 There is also a shorthand for diamond shapes which can be used
2769 only inside chords:
2770
2771 @lilypond[verbatim,quote,relative=2]
2772 <c f\harmonic>2 <d a'\harmonic>4 <c g'\harmonic>
2773 @end lilypond
2774
2775 @predefined
2776 @code{\harmonic},
2777 @code{\xNotesOn},
2778 @code{\xNotesOff},
2779 @code{\xNote}.
2780 @endpredefined
2781
2782 @seealso
2783 Snippets:
2784 @rlsr{Pitches}.
2785
2786 Notation Reference:
2787 @ref{Note head styles},
2788 @ref{Chorded notes},
2789 @ref{Indicating harmonics and dampened notes}.
2790
2791 Internals Reference:
2792 @rinternals{note-event},
2793 @rinternals{Note_heads_engraver},
2794 @rinternals{Ledger_line_engraver},
2795 @rinternals{NoteHead},
2796 @rinternals{LedgerLineSpanner},
2797 @rinternals{note-head-interface},
2798 @rinternals{ledger-line-spanner-interface}.
2799
2800
2801 @node Easy notation note heads
2802 @unnumberedsubsubsec Easy notation note heads
2803
2804 @cindex note heads, practice
2805 @cindex practice note heads
2806 @cindex note heads, easy notation
2807 @cindex easy notation
2808 @cindex beginners' music
2809 @cindex music, beginners'
2810 @cindex easy play note heads
2811 @cindex note heads, easy play
2812
2813 @funindex \easyHeadsOn
2814 @funindex easyHeadsOn
2815 @funindex \easyHeadsOff
2816 @funindex easyHeadsOff
2817
2818 The @q{easy play} note head includes a note name inside the head.
2819 It is used in music for beginners.  To make the letters readable,
2820 it should be printed in a large font size.  To print with a larger
2821 font, see @ref{Setting the staff size}.
2822
2823 @lilypond[verbatim,quote]
2824 #(set-global-staff-size 26)
2825 \relative c' {
2826   \easyHeadsOn
2827   c2 e4 f
2828   g1
2829   \easyHeadsOff
2830   c,1
2831 }
2832 @end lilypond
2833
2834
2835 @predefined
2836 @code{\easyHeadsOn},
2837 @code{\easyHeadsOff}.
2838 @endpredefined
2839
2840
2841 @snippets
2842
2843 @lilypondfile[verbatim,quote,texidoc,doctitle]
2844 {numbers-as-easy-note-heads.ly}
2845
2846 @seealso
2847 Notation Reference:
2848 @ref{Setting the staff size}.
2849
2850 Snippets:
2851 @rlsr{Pitches}.
2852
2853 Internals Reference:
2854 @rinternals{note-event},
2855 @rinternals{Note_heads_engraver},
2856 @rinternals{NoteHead},
2857 @rinternals{note-head-interface}.
2858
2859
2860 @node Shape note heads
2861 @unnumberedsubsubsec Shape note heads
2862
2863 @cindex note heads, shape
2864 @cindex note heads, Aiken
2865 @cindex note heads, sacred harp
2866 @cindex shape notes
2867 @cindex Aiken shape note heads
2868 @cindex sacred harp note heads
2869 @cindex note heads, Southern Harmony
2870 @cindex Southern Harmony note heads
2871 @cindex Funk shape note heads
2872 @cindex note heads, Funk
2873 @cindex note heads, Harmonica Sacra
2874 @cindex Harmonica Sacra note heads
2875 @cindex Christian Harmony note heads
2876 @cindex note heads, Christian Harmony
2877 @cindex Walker shape note heads
2878 @cindex note heads, Walker
2879
2880 @funindex \aikenHeads
2881 @funindex aikenHeads
2882 @funindex \sacredHarpHeads
2883 @funindex sacredHarpHeads
2884 @funindex \southernHarmonyHeads
2885 @funindex southernHarmonyHeads
2886 @funindex \funkHeads
2887 @funindex funkHeads
2888 @funindex \walkerHeads
2889 @funindex walkerHeads
2890
2891 In shape note head notation, the shape of the note head
2892 corresponds to the harmonic function of a note in the scale.  This
2893 notation was popular in nineteenth-century American song books.
2894 Shape note heads can be produced in Sacred Harp, Southern Harmony,
2895 Funk (Harmonica Sacra), Walker, and Aiken (Christian Harmony) styles:
2896
2897 @lilypond[verbatim,quote,relative=2]
2898 \aikenHeads
2899 c, d e f g2 a b1 c \break
2900 \sacredHarpHeads
2901 c,4 d e f g2 a b1 c \break
2902 \southernHarmonyHeads
2903 c,4 d e f g2 a b1 c \break
2904 \funkHeads
2905 c,4 d e f g2 a b1 c \break
2906 \walkerHeads
2907 c,4 d e f g2 a b1 c \break
2908 @end lilypond
2909
2910 @funindex \key
2911 @funindex key
2912 @funindex \aikenHeadsMinor
2913 @funindex aikenHeadsMinor
2914 @funindex \sacredHarpHeadsMinor
2915 @funindex sacredHarpHeadsMinor
2916 @funindex \southernHarmonyHeadsMinor
2917 @funindex southernHarmonyHeadsMinor
2918 @funindex \funkHeadsMinor
2919 @funindex funkHeadsMinor
2920 @funindex \walkerHeadsMinor
2921 @funindex walkerHeadsMinor
2922
2923 Shapes are typeset according to the step in the scale, where the base
2924 of the scale is determined by the @code{\key} command.  When writing
2925 in a minor key, the scale step can be determined from the relative
2926 major:
2927
2928 @lilypond[verbatim,quote,relative=2]
2929 \key a \minor
2930 \aikenHeads
2931 a b c d e2 f g1 a \break
2932 \aikenHeadsMinor
2933 a,4 b c d e2 f g1 a \break
2934 \sacredHarpHeadsMinor
2935 a,2 b c d \break
2936 \southernHarmonyHeadsMinor
2937 a2 b c d \break
2938 \funkHeadsMinor
2939 a2 b c d \break
2940 \walkerHeadsMinor
2941 a2 b c d \break
2942
2943 @end lilypond
2944
2945
2946 @predefined
2947 @code{\aikenHeads},
2948 @code{\aikenHeadsMinor},
2949 @code{\funkHeads},
2950 @code{\funkHeadsMinor},
2951 @code{\sacredHarpHeads},
2952 @code{\sacredHarpHeadsMinor},
2953 @code{\southernHarmonyHeads},
2954 @code{\southernHarmonyHeadsMinor},
2955 @code{\walkerHeads},
2956 @code{\walkerHeadsMinor}.
2957 @endpredefined
2958
2959
2960 @snippets
2961
2962 @lilypondfile[verbatim,quote,texidoc,doctitle]
2963 {applying-note-head-styles-depending-on-the-step-of-the-scale.ly}
2964
2965 To see all note head styles, see @ref{Note head styles}.
2966
2967 @seealso
2968 Snippets:
2969 @rlsr{Pitches}.
2970
2971 Notation Reference:
2972 @ref{Note head styles}.
2973
2974 Internals Reference:
2975 @rinternals{note-event},
2976 @rinternals{Note_heads_engraver},
2977 @rinternals{NoteHead},
2978 @rinternals{note-head-interface}.
2979
2980
2981 @node Improvisation
2982 @unnumberedsubsubsec Improvisation
2983
2984 @cindex improvisation
2985 @cindex slashed note heads
2986 @cindex note heads, improvisation
2987 @cindex note heads, slashed
2988
2989 @funindex \improvisationOn
2990 @funindex improvisationOn
2991 @funindex \improvisationOff
2992 @funindex improvisationOff
2993
2994 Improvisation is sometimes denoted with slashed note heads, where
2995 the performer may choose any pitch but should play the specified
2996 rhythm.  Such note heads can be created:
2997
2998 @lilypond[verbatim,quote,relative=2]
2999 \new Voice \with {
3000   \consists "Pitch_squash_engraver"
3001 } {
3002   e8 e g a a16( bes) a8 g
3003   \improvisationOn
3004   e8 ~
3005   e2 ~ e8 f4 f8 ~
3006   f2
3007   \improvisationOff
3008   a16( bes) a8 g e
3009 }
3010 @end lilypond
3011
3012 @predefined
3013 @code{\improvisationOn},
3014 @code{\improvisationOff}.
3015 @endpredefined
3016
3017 @seealso
3018 Snippets:
3019 @rlsr{Pitches}.
3020
3021 Internals Reference:
3022 @rinternals{Pitch_squash_engraver},
3023 @rinternals{Voice},
3024 @rinternals{RhythmicStaff}.