]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/notation/pitches.itely
Doc: avoid using zero-duration spacers in examples
[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.15.20"
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 with:
824
825 @example
826 \inversion @var{from-pitch} @var{to-pitch} @var{musicexpr}
827 @end example
828
829 The @code{@var{musicexpr}} is inverted interval-by-interval,
830 and then transposed so that @code{@var{from-pitch}} is mapped
831 to @code{@var{to-pitch}}.
832
833 @lilypond[verbatim,quote]
834 music = \relative c' { c d e f }
835 \new Staff {
836   \music
837   \inversion d' d' \music
838   \inversion d' ees' \music
839 }
840 @end lilypond
841
842 @seealso
843 Notation Reference:
844 @ref{Modal transformations},
845 @ref{Retrograde},
846 @ref{Transpose}.
847
848
849 @node Retrograde
850 @unnumberedsubsubsec Retrograde
851
852 @cindex retrograde transformation
853 @cindex transformation, retrograde
854 @cindex operation, retrograde
855 @funindex \retrograde
856 @funindex retrograde
857
858 A music expression can be reversed to produce its retrograde:
859
860 @lilypond[verbatim,quote]
861 music = \relative c' { c8. ees16( fis8. a16 b8.) gis16 f8. d16 }
862
863 \new Staff {
864   \music
865   \retrograde \music
866 }
867 @end lilypond
868
869 @knownissues
870 Manual ties inside @code{\retrograde} will be broken and
871 generate warnings.  Some ties can be generated automatically
872 by enabling @ref{Automatic note splitting}.
873
874 @seealso
875 Notation Reference:
876 @ref{Inversion},
877 @ref{Modal transformations},
878 @ref{Transpose}.
879
880
881 @node Modal transformations
882 @unnumberedsubsubsec Modal transformations
883
884 @cindex modal transformations
885 @cindex transformations, modal
886 @cindex operations, modal
887
888 In a musical composition that is based on a scale, a motif is
889 frequently transformed in various ways.  It may be
890 @notation{transposed} to start at different places in the scale or
891 it may be @notation{inverted} around a pivot point in the scale.
892 It may also be reversed to produce its @notation{retrograde}, see
893 @ref{Retrograde}.
894
895 @warning{Any note that does not lie within the given scale will be
896 left untransformed.}
897
898 @subsubheading Modal transposition
899
900 @cindex modal transposition
901 @cindex transposition, modal
902 @cindex operation, transposition
903 @funindex \modalTranspose
904 @funindex modalTranspose
905
906 A motif can be transposed within a given scale with:
907
908 @example
909 \modalTranspose @var{from-pitch} @var{to-pitch} @var{scale} @var{motif}
910 @end example
911
912 The notes of @var{motif} are shifted within the @var{scale} by the
913 number of scale degrees given by the interval between @var{to-pitch}
914 and @var{from-pitch}:
915
916 @lilypond[verbatim,quote]
917 diatonicScale = \relative c' { c d e f g a b }
918 motif = \relative c' { c8 d e f g a b c }
919
920 \new Staff {
921   \motif
922   \modalTranspose c f \diatonicScale \motif
923   \modalTranspose c b, \diatonicScale \motif
924 }
925 @end lilypond
926
927 An ascending scale of any length and with any intervals may be
928 specified:
929
930 @lilypond[verbatim,quote]
931 pentatonicScale = \relative c' { ges aes bes des ees }
932 motif = \relative c' { ees8 des ges,4 <ges' bes,> <ges bes,> }
933
934 \new Staff {
935   \motif
936   \modalTranspose ges ees' \pentatonicScale \motif
937 }
938 @end lilypond
939
940 When used with a chromatic scale @code{\modalTranspose} has a
941 similar effect to @code{\transpose}, but with the ability to
942 specify the names of the notes to be used:
943
944 @lilypond[verbatim,quote]
945 chromaticScale = \relative c' { c cis d dis e f fis g gis a ais b }
946 motif = \relative c' { c8 d e f g a b c }
947
948 \new Staff {
949   \motif
950   \transpose c f \motif
951   \modalTranspose c f \chromaticScale \motif
952 }
953 @end lilypond
954
955 @subsubheading Modal inversion
956
957 @cindex modal inversion
958 @cindex inversion, modal
959 @cindex operation, modal inversion
960 @funindex \modalInversion
961 @funindex modalInversion
962
963 A motif can be inverted within a given scale around a given pivot
964 note and transposed in a single operation with:
965
966 @example
967 \modalInversion @var{around-pitch} @var{to-pitch} @var{scale} @var{motif}
968 @end example
969
970 The notes of @var{motif} are placed the same number of scale degrees
971 from the @var{around-pitch} note within the @var{scale}, but in the
972 opposite direction, and the result is then shifted within the
973 @var{scale} by the number of scale degrees given by the interval between
974 @var{to-pitch} and @var{around-pitch}.
975
976 So to simply invert around a note in the scale use the same value for
977 @var{around-pitch} and @var{to-pitch}:
978
979 @lilypond[verbatim,quote]
980 octatonicScale = \relative c' { ees f fis gis a b c d }
981 motif = \relative c' { c8. ees16 fis8. a16 b8. gis16 f8. d16 }
982
983 \new Staff {
984   \motif
985   \modalInversion fis' fis' \octatonicScale \motif
986 }
987 @end lilypond
988
989 To invert around a pivot between two notes in the scale, invert around
990 one of the notes and then transpose by one scale degree.  The two notes
991 specified can be interpreted as bracketing the pivot point:
992
993 @lilypond[verbatim,quote]
994 scale = \relative c' { c g' }
995 motive = \relative c' { c c g' c, }
996
997 \new Staff {
998   \motive
999   \modalInversion c' g' \scale \motive
1000 }
1001 @end lilypond
1002
1003 The combined operation of inversion and retrograde produce the
1004 retrograde-inversion:
1005
1006 @lilypond[verbatim,quote]
1007 octatonicScale = \relative c' { ees f fis gis a b c d }
1008 motif = \relative c' { c8. ees16 fis8. a16 b8. gis16 f8. d16 }
1009
1010 \new Staff {
1011   \motif
1012   \retrograde \modalInversion c' c' \octatonicScale \motif
1013 }
1014 @end lilypond
1015
1016 @seealso
1017 Notation Reference:
1018 @ref{Inversion},
1019 @ref{Retrograde},
1020 @ref{Transpose}.
1021
1022
1023 @node Displaying pitches
1024 @subsection Displaying pitches
1025
1026 This section discusses how to alter the output of pitches.
1027
1028 @menu
1029 * Clef::
1030 * Key signature::
1031 * Ottava brackets::
1032 * Instrument transpositions::
1033 * Automatic accidentals::
1034 * Ambitus::
1035 @end menu
1036
1037
1038 @node Clef
1039 @unnumberedsubsubsec Clef
1040
1041 @cindex G clef
1042 @cindex C clef
1043 @cindex F clef
1044 @cindex treble clef
1045 @cindex violin clef
1046 @cindex alto clef
1047 @cindex tenor clef
1048 @cindex bass clef
1049 @cindex french clef
1050 @cindex soprano clef
1051 @cindex mezzosoprano clef
1052 @cindex baritone clef
1053 @cindex varbaritone clef
1054 @cindex subbass clef
1055 @cindex clef
1056 @cindex ancient clef
1057 @cindex clef, ancient
1058 @cindex clef, G
1059 @cindex clef, C
1060 @cindex clef, F
1061 @cindex clef, treble
1062 @cindex clef, violin
1063 @cindex clef, alto
1064 @cindex clef, tenor
1065 @cindex clef, bass
1066 @cindex clef, french
1067 @cindex clef, soprano
1068 @cindex clef, mezzosoprano
1069 @cindex clef, baritone
1070 @cindex clef, varbaritone
1071 @cindex clef, subbass
1072
1073
1074 @funindex \clef
1075 @funindex clef
1076
1077 The clef may be altered.  Middle C is shown in every example.  The
1078 following clef names can (but do not need to) be enclosed in quotes.
1079
1080 @lilypond[verbatim,quote,relative=1]
1081 \clef treble
1082 c2 c
1083 \clef alto
1084 c2 c
1085 \clef tenor
1086 c2 c
1087 \clef bass
1088 c2 c
1089 @end lilypond
1090
1091 Other clefs include:
1092
1093 @lilypond[verbatim,quote,relative=1]
1094 \clef french
1095 c2 c
1096 \clef soprano
1097 c2 c
1098 \clef mezzosoprano
1099 c2 c
1100 \clef baritone
1101 c2 c
1102
1103 \break
1104
1105 \clef varbaritone
1106 c2 c
1107 \clef subbass
1108 c2 c
1109 \clef percussion
1110 c2 c
1111
1112 \break
1113
1114 \clef G   % synonym for treble
1115 c2 c
1116 \clef F   % synonym for bass
1117 c2 c
1118 \clef C   % synonym for alto
1119 c2 c
1120 @end lilypond
1121
1122 @cindex transposing clef
1123 @cindex clef, transposing
1124 @cindex octave transposition
1125 @cindex choral tenor clef
1126 @cindex tenor clef, choral
1127
1128 By adding@tie{}@code{_8} or@tie{}@code{^8} to the clef name, the
1129 clef is transposed one octave down or up respectively,
1130 and@tie{}@code{_15} and@tie{}@code{^15} transpose by two octaves.
1131 Other integers can be used if required.  Clef names containing
1132 non-alphabetic characters must be enclosed in quotes
1133
1134 @lilypond[verbatim,quote,relative=1]
1135 \clef treble
1136 c2 c
1137 \clef "treble_8"
1138 c2 c
1139 \clef "bass^15"
1140 c2 c
1141 \clef "alto_2"
1142 c2 c
1143 \clef "G_8"
1144 c2 c
1145 \clef "F^5"
1146 c2 c
1147 @end lilypond
1148
1149 Some special purpose clefs are described in @ref{Mensural clefs},
1150 @ref{Gregorian clefs}, @ref{Default tablatures}, and @ref{Custom
1151 tablatures}.  For mixing different clefs when using cue notes within a
1152 score, see the @code{\cueClef} and @code{\cueDuringWithClef} functions
1153 in @ref{Formatting cue notes}.
1154
1155 @snippets
1156
1157 @lilypondfile[verbatim,quote,texidoc,doctitle]
1158 {tweaking-clef-properties.ly}
1159
1160 @seealso
1161 Notation Reference:
1162 @ref{Mensural clefs},
1163 @ref{Gregorian clefs},
1164 @ref{Default tablatures},
1165 @ref{Custom tablatures},
1166 @ref{Formatting cue notes}.
1167
1168 Snippets:
1169 @rlsr{Pitches}.
1170
1171 Internals Reference:
1172 @rinternals{Clef_engraver},
1173 @rinternals{Clef},
1174 @rinternals{OctavateEight},
1175 @rinternals{clef-interface}.
1176
1177
1178 @node Key signature
1179 @unnumberedsubsubsec Key signature
1180
1181 @cindex key signature
1182
1183 @funindex \key
1184 @funindex key
1185
1186 @c duplicated in Key signature and Accidentals
1187 @warning{New users are sometimes confused about accidentals and
1188 key signatures.  In LilyPond, note names are the raw input; key
1189 signatures and clefs determine how this raw input is displayed.
1190 An unaltered note like@tie{}@code{c} means @q{C natural},
1191 regardless of the key signature or clef.  For more information,
1192 see @rlearning{Accidentals and key signatures}.}
1193
1194 The key signature indicates the tonality in which a piece is
1195 played.  It is denoted by a set of alterations (flats or sharps)
1196 at the start of the staff.  The key signature may be altered:
1197
1198 @example
1199 \key @var{pitch} @var{mode}
1200 @end example
1201
1202 @funindex \major
1203 @funindex major
1204 @funindex \minor
1205 @funindex minor
1206 @funindex \ionian
1207 @funindex ionian
1208 @funindex \locrian
1209 @funindex locrian
1210 @funindex \aeolian
1211 @funindex aeolian
1212 @funindex \mixolydian
1213 @funindex mixolydian
1214 @funindex \lydian
1215 @funindex lydian
1216 @funindex \phrygian
1217 @funindex phrygian
1218 @funindex \dorian
1219 @funindex dorian
1220
1221 @cindex church modes
1222 @cindex modes
1223 @cindex major
1224 @cindex minor
1225 @cindex ionian
1226 @cindex locrian
1227 @cindex aeolian
1228 @cindex mixolydian
1229 @cindex lydian
1230 @cindex phrygian
1231 @cindex dorian
1232
1233 @noindent
1234 Here, @code{@var{mode}} should be @code{\major} or @code{\minor}
1235 to get a key signature of @code{@var{pitch}}-major or
1236 @code{@var{pitch}}-minor, respectively.  You may also use the
1237 standard mode names, also called @notation{church modes}:
1238 @code{\ionian}, @code{\dorian}, @code{\phrygian}, @code{\lydian},
1239 @code{\mixolydian}, @code{\aeolian}, and @code{\locrian}.
1240
1241 @lilypond[verbatim,quote,relative=2]
1242 \key g \major
1243 fis1
1244 f
1245 fis
1246 @end lilypond
1247
1248
1249 @snippets
1250
1251 @lilypondfile[verbatim,quote,texidoc,doctitle]
1252 {preventing-natural-signs-from-being-printed-when-the-key-signature-changes.ly}
1253
1254 @lilypondfile[verbatim,quote,texidoc,doctitle]
1255 {non-traditional-key-signatures.ly}
1256
1257 @seealso
1258 Music Glossary:
1259 @rglos{church mode},
1260 @rglos{scordatura}.
1261
1262 Learning Manual:
1263 @rlearning{Accidentals and key signatures}.
1264
1265 Snippets:
1266 @rlsr{Pitches}.
1267
1268 Internals Reference:
1269 @rinternals{KeyChangeEvent},
1270 @rinternals{Key_engraver},
1271 @rinternals{Key_performer},
1272 @rinternals{KeyCancellation},
1273 @rinternals{KeySignature},
1274 @rinternals{key-cancellation-interface},
1275 @rinternals{key-signature-interface}.
1276
1277
1278 @node Ottava brackets
1279 @unnumberedsubsubsec Ottava brackets
1280
1281 @cindex ottava
1282 @cindex 15ma
1283 @cindex 8va
1284 @cindex 8ve
1285 @cindex octavation
1286
1287 @funindex set-octavation
1288 @funindex \ottava
1289 @funindex ottava
1290
1291 @notation{Ottava brackets} introduce an extra transposition of an
1292 octave for the staff:
1293
1294 @lilypond[verbatim,quote,relative=2]
1295 a2 b
1296 \ottava #-2
1297 a2 b
1298 \ottava #-1
1299 a2 b
1300 \ottava #0
1301 a2 b
1302 \ottava #1
1303 a2 b
1304 \ottava #2
1305 a2 b
1306 @end lilypond
1307
1308 @snippets
1309
1310 @lilypondfile[verbatim,quote,texidoc,doctitle]
1311 {ottava-text.ly}
1312
1313 @seealso
1314 Music Glossary:
1315 @rglos{octavation}.
1316
1317 Snippets:
1318 @rlsr{Pitches}.
1319
1320 Internals Reference:
1321 @rinternals{Ottava_spanner_engraver},
1322 @rinternals{OttavaBracket},
1323 @rinternals{ottava-bracket-interface}.
1324
1325
1326 @node Instrument transpositions
1327 @unnumberedsubsubsec Instrument transpositions
1328
1329 @cindex transposition, MIDI
1330 @cindex transposition, instrument
1331 @cindex transposing instrument
1332 @cindex MIDI
1333 @cindex MIDI transposition
1334
1335 @funindex \transposition
1336 @funindex transposition
1337
1338 When typesetting scores that involve transposing instruments, some
1339 parts can be typeset in a different pitch than the
1340 @notation{concert pitch}.  In these cases, the key of the
1341 @notation{transposing instrument} should be specified; otherwise
1342 the MIDI output and cues in other parts will produce incorrect
1343 pitches.  For more information about quotations, see
1344 @ref{Quoting other voices}.
1345
1346 @example
1347 \transposition @var{pitch}
1348 @end example
1349
1350 The pitch to use for @code{\transposition} should correspond to
1351 the real sound heard when a@tie{}@code{c'} written on the staff is
1352 played by the transposing instrument.  This pitch is entered in
1353 absolute mode, so an instrument that produces a real sound which
1354 is one tone higher than the printed music should use
1355 @w{@code{\transposition d'}}.  @code{\transposition} should
1356 @emph{only} be used if the pitches are @emph{not} being entered in
1357 concert pitch.
1358
1359 Here are a few notes for violin and B-flat clarinet where the
1360 parts have been entered using the notes and key as they appear in
1361 each part of the conductor's score.  The two instruments are
1362 playing in unison.
1363
1364 @lilypond[verbatim,quote]
1365 \new GrandStaff <<
1366   \new Staff = "violin" {
1367     \relative c'' {
1368       \set Staff.instrumentName = #"Vln"
1369       \set Staff.midiInstrument = #"violin"
1370       % not strictly necessary, but a good reminder
1371       \transposition c'
1372
1373       \key c \major
1374       g4( c8) r c r c4
1375     }
1376   }
1377   \new Staff = "clarinet" {
1378     \relative c'' {
1379       \set Staff.instrumentName = \markup { Cl (B\flat) }
1380       \set Staff.midiInstrument = #"clarinet"
1381       \transposition bes
1382
1383       \key d \major
1384       a4( d8) r d r d4
1385     }
1386   }
1387 >>
1388 @end lilypond
1389
1390 The @code{\transposition} may be changed during a piece.  For
1391 example, a clarinetist may switch from an A clarinet to a B-flat
1392 clarinet.
1393
1394 @lilypond[verbatim,quote,relative=2]
1395 \set Staff.instrumentName = #"Cl (A)"
1396 \key a \major
1397 \transposition a
1398 c d e f
1399 \textLengthOn
1400 <>^\markup { Switch to B\flat clarinet }
1401 R1
1402
1403 \key bes \major
1404 \transposition bes
1405 c2 g
1406 @end lilypond
1407
1408 @seealso
1409 Music Glossary:
1410 @rglos{concert pitch},
1411 @rglos{transposing instrument}.
1412
1413 Notation Reference:
1414 @ref{Quoting other voices},
1415 @ref{Transpose}.
1416
1417 Snippets:
1418 @rlsr{Pitches}.
1419
1420
1421 @node Automatic accidentals
1422 @unnumberedsubsubsec Automatic accidentals
1423
1424 @cindex accidental style
1425 @cindex accidental style, default
1426 @cindex accidentals
1427 @cindex accidentals, automatic
1428 @cindex automatic accidentals
1429 @cindex default accidental style
1430
1431 @funindex \accidentalStyle
1432 @funindex voice
1433 @funindex default
1434
1435 There are many different conventions on how to typeset
1436 accidentals.  LilyPond provides a function to specify which
1437 accidental style to use.  This function is called as follows:
1438
1439 @example
1440 \new Staff <<
1441   \accidentalStyle "voice"
1442   @{ @dots{} @}
1443 >>
1444 @end example
1445
1446 The accidental style applies to the current @code{Staff} by
1447 default (with the exception of the styles @code{piano} and
1448 @code{piano-cautionary}, which are explained below).  Optionally,
1449 the function can take a second argument that determines in which
1450 scope the style should be changed.  For example, to use the same
1451 style in all staves of the current @code{StaffGroup}, use:
1452
1453 @example
1454 \accidentalStyle #'StaffGroup "voice"
1455 @end example
1456
1457 The following accidental styles are supported.  To demonstrate
1458 each style, we use the following example:
1459
1460
1461 @lilypond[verbatim,quote]
1462 musicA = {
1463   <<
1464     \relative c' {
1465       cis'8 fis, bes4 <a cis>8 f bis4 |
1466       cis2. <c, g'>4 |
1467     }
1468     \\
1469     \relative c' {
1470       ais'2 cis, |
1471       fis8 b a4 cis2 |
1472     }
1473   >>
1474 }
1475
1476 musicB = {
1477   \clef bass
1478   \new Voice {
1479     \voiceTwo \relative c' {
1480       <fis, a cis>8[ <fis a cis>
1481       \change Staff = up
1482       cis' cis
1483       \change Staff = down
1484       <fis, a> <fis a>]
1485       \showStaffSwitch
1486       \change Staff = up
1487       dis'4 |
1488       \change Staff = down
1489       <fis, a cis>4 gis <f a d>2 |
1490     }
1491   }
1492 }
1493
1494 \new PianoStaff {
1495   <<
1496     \context Staff = "up" {
1497       \accidentalStyle "default"
1498       \musicA
1499     }
1500     \context Staff = "down" {
1501       \accidentalStyle "default"
1502       \musicB
1503     }
1504   >>
1505 }
1506 @end lilypond
1507
1508 Note that the last lines of this example can be replaced by the
1509 following, as long as the same accidental style should be used in
1510 both staves.
1511
1512 @example
1513 \new PianoStaff @{
1514   <<
1515     \context Staff = "up" @{
1516       %%% change the next line as desired:
1517       \accidentalStyle #'Score "default"
1518       \musicA
1519     @}
1520     \context Staff = "down" @{
1521       \musicB
1522     @}
1523   >>
1524 @}
1525 @end example
1526
1527
1528 @c don't use verbatim in this table.
1529 @table @code
1530 @item default
1531
1532 @cindex default accidental style
1533 @cindex accidental style, default
1534
1535 @funindex default
1536
1537 This is the default typesetting behavior.  It corresponds to
1538 eighteenth-century common practice: accidentals are remembered to
1539 the end of the measure in which they occur and only in their own
1540 octave.  Thus, in the example below, no natural signs are printed
1541 before the@tie{}@code{b} in the second measure or the
1542 last@tie{}@code{c}:
1543
1544 @lilypond[quote]
1545 musicA = {
1546   <<
1547     \relative c' {
1548       cis'8 fis, bes4 <a cis>8 f bis4 |
1549       cis2. <c, g'>4 |
1550     }
1551     \\
1552     \relative c' {
1553       ais'2 cis, |
1554       fis8 b a4 cis2 |
1555     }
1556   >>
1557 }
1558
1559 musicB = {
1560   \clef bass
1561   \new Voice {
1562     \voiceTwo \relative c' {
1563       <fis, a cis>8[ <fis a cis>
1564       \change Staff = up
1565       cis' cis
1566       \change Staff = down
1567       <fis, a> <fis a>]
1568       \showStaffSwitch
1569       \change Staff = up
1570       dis'4 |
1571       \change Staff = down
1572       <fis, a cis>4 gis <f a d>2 |
1573     }
1574   }
1575 }
1576
1577 \new PianoStaff {
1578   <<
1579     \context Staff = "up" {
1580       \accidentalStyle "default"
1581       \musicA
1582     }
1583     \context Staff = "down" {
1584       \accidentalStyle "default"
1585       \musicB
1586     }
1587   >>
1588 }
1589 @end lilypond
1590
1591 @item voice
1592
1593 @cindex accidental style, voice
1594 @cindex voice accidental style
1595 @cindex accidental style, modern
1596 @cindex modern accidental style
1597 @cindex accidental style, modern-cautionary
1598 @cindex modern-cautionary accidental style
1599
1600 @funindex voice
1601
1602 The normal behavior is to remember the accidentals at
1603 @code{Staff}-level.  In this style, however, accidentals are
1604 typeset individually for each voice.  Apart from that, the rule is
1605 similar to @code{default}.
1606
1607 As a result, accidentals from one voice do not get canceled in
1608 other voices, which is often an unwanted result: in the following
1609 example, it is hard to determine whether the second@tie{}@code{a}
1610 should be played natural or sharp.  The @code{voice} option should
1611 therefore be used only if the voices are to be read solely by
1612 individual musicians.  If the staff is to be used by one musician
1613 (e.g., a conductor or in a piano score) then @code{modern} or
1614 @code{modern-cautionary} should be used instead.
1615
1616
1617 @lilypond[quote]
1618 musicA = {
1619   <<
1620     \relative c' {
1621       cis'8 fis, bes4 <a cis>8 f bis4 |
1622       cis2. <c, g'>4 |
1623     }
1624     \\
1625     \relative c' {
1626       ais'2 cis, |
1627       fis8 b a4 cis2 |
1628     }
1629   >>
1630 }
1631
1632 musicB = {
1633   \clef bass
1634   \new Voice {
1635     \voiceTwo \relative c' {
1636       <fis, a cis>8[ <fis a cis>
1637       \change Staff = up
1638       cis' cis
1639       \change Staff = down
1640       <fis, a> <fis a>]
1641       \showStaffSwitch
1642       \change Staff = up
1643       dis'4 |
1644       \change Staff = down
1645       <fis, a cis>4 gis <f a d>2 |
1646     }
1647   }
1648 }
1649
1650 \new PianoStaff {
1651   <<
1652     \context Staff = "up" {
1653       \accidentalStyle "voice"
1654       \musicA
1655     }
1656     \context Staff = "down" {
1657       \accidentalStyle "voice"
1658       \musicB
1659     }
1660   >>
1661 }
1662 @end lilypond
1663
1664 @item modern
1665
1666 @cindex accidentals, modern style
1667 @cindex modern style accidentals
1668
1669 @funindex modern
1670
1671 This rule corresponds to the common practice in the twentieth
1672 century.  It omits some extra natural signs, which were
1673 traditionally prefixed to a sharp following a double sharp,
1674 or a flat following a double flat.  The @code{modern} rule
1675 prints the same accidentals as @code{default}, with
1676 two additions that serve to avoid ambiguity: after temporary
1677 accidentals, cancellation marks are printed also in the following
1678 measure (for notes in the same octave) and, in the same measure,
1679 for notes in other octaves.  Hence the naturals before
1680 the@tie{}@code{b} and the@tie{}@code{c} in the second measure of
1681 the upper staff:
1682
1683 @lilypond[quote]
1684 musicA = {
1685   <<
1686     \relative c' {
1687       cis'8 fis, bes4 <a cis>8 f bis4 |
1688       cis2. <c, g'>4 |
1689     }
1690     \\
1691     \relative c' {
1692       ais'2 cis, |
1693       fis8 b a4 cis2 |
1694     }
1695   >>
1696 }
1697
1698 musicB = {
1699   \clef bass
1700   \new Voice {
1701     \voiceTwo \relative c' {
1702       <fis, a cis>8[ <fis a cis>
1703       \change Staff = up
1704       cis' cis
1705       \change Staff = down
1706       <fis, a> <fis a>]
1707       \showStaffSwitch
1708       \change Staff = up
1709       dis'4 |
1710       \change Staff = down
1711       <fis, a cis>4 gis <f a d>2 |
1712     }
1713   }
1714 }
1715
1716 \new PianoStaff {
1717   <<
1718     \context Staff = "up" {
1719       \accidentalStyle "modern"
1720       \musicA
1721     }
1722     \context Staff = "down" {
1723       \accidentalStyle "modern"
1724       \musicB
1725     }
1726   >>
1727 }
1728 @end lilypond
1729
1730 @item modern-cautionary
1731
1732 @cindex accidentals, modern cautionary style
1733 @cindex modern accidental style
1734 @cindex modern cautionary accidental style
1735 @cindex modern style accidentals
1736 @cindex modern style cautionary accidentals
1737
1738 @funindex modern-cautionary
1739
1740 This rule is similar to @code{modern}, but the @q{extra}
1741 accidentals (the ones not typeset by @code{default}) are typeset
1742 as cautionary accidentals.  They are by default printed with
1743 parentheses, but they can also be printed in reduced size by
1744 defining the @code{cautionary-style} property of
1745 @code{AccidentalSuggestion}.
1746
1747 @lilypond[quote]
1748 musicA = {
1749   <<
1750     \relative c' {
1751       cis'8 fis, bes4 <a cis>8 f bis4 |
1752       cis2. <c, g'>4 |
1753     }
1754     \\
1755     \relative c' {
1756       ais'2 cis, |
1757       fis8 b a4 cis2 |
1758     }
1759   >>
1760 }
1761
1762 musicB = {
1763   \clef bass
1764   \new Voice {
1765     \voiceTwo \relative c' {
1766       <fis, a cis>8[ <fis a cis>
1767       \change Staff = up
1768       cis' cis
1769       \change Staff = down
1770       <fis, a> <fis a>]
1771       \showStaffSwitch
1772       \change Staff = up
1773       dis'4 |
1774       \change Staff = down
1775       <fis, a cis>4 gis <f a d>2 |
1776     }
1777   }
1778 }
1779
1780 \new PianoStaff {
1781   <<
1782     \context Staff = "up" {
1783       \accidentalStyle "modern-cautionary"
1784       \musicA
1785     }
1786     \context Staff = "down" {
1787       \accidentalStyle "modern-cautionary"
1788       \musicB
1789     }
1790   >>
1791 }
1792 @end lilypond
1793
1794 @item modern-voice
1795
1796 @cindex accidental style, modern
1797 @cindex accidentals, modern
1798 @cindex accidentals, multivoice
1799 @cindex modern accidental style
1800 @cindex modern accidentals
1801 @cindex multivoice accidentals
1802
1803 @funindex modern-voice
1804
1805 This rule is used for multivoice accidentals to be read both by
1806 musicians playing one voice and musicians playing all voices.
1807 Accidentals are typeset for each voice, but they @emph{are}
1808 canceled across voices in the same @code{Staff}.  Hence,
1809 the@tie{}@code{a} in the last measure is canceled because the
1810 previous cancellation was in a different voice, and
1811 the@tie{}@code{d} in the lower staff is canceled because of the
1812 accidental in a different voice in the previous measure:
1813
1814 @lilypond[quote]
1815 musicA = {
1816   <<
1817     \relative c' {
1818       cis'8 fis, bes4 <a cis>8 f bis4 |
1819       cis2. <c, g'>4 |
1820     }
1821     \\
1822     \relative c' {
1823       ais'2 cis, |
1824       fis8 b a4 cis2 |
1825     }
1826   >>
1827 }
1828
1829 musicB = {
1830   \clef bass
1831   \new Voice {
1832     \voiceTwo \relative c' {
1833       <fis, a cis>8[ <fis a cis>
1834       \change Staff = up
1835       cis' cis
1836       \change Staff = down
1837       <fis, a> <fis a>]
1838       \showStaffSwitch
1839       \change Staff = up
1840       dis'4 |
1841       \change Staff = down
1842       <fis, a cis>4 gis <f a d>2 |
1843     }
1844   }
1845 }
1846
1847 \new PianoStaff {
1848   <<
1849     \context Staff = "up" {
1850       \accidentalStyle "modern-voice"
1851       \musicA
1852     }
1853     \context Staff = "down" {
1854       \accidentalStyle "modern-voice"
1855       \musicB
1856     }
1857   >>
1858 }
1859 @end lilypond
1860
1861 @cindex accidental style, cautionary, modern voice
1862 @cindex accidental style, modern voice cautionary
1863 @cindex accidental style, voice, modern cautionary
1864
1865 @funindex modern-voice-cautionary
1866
1867 @item modern-voice-cautionary
1868
1869 This rule is the same as @code{modern-voice}, but with the extra
1870 accidentals (the ones not typeset by @code{voice}) typeset as
1871 cautionaries.  Even though all accidentals typeset by
1872 @code{default} @emph{are} typeset with this rule, some of them are
1873 typeset as cautionaries.
1874
1875 @lilypond[quote]
1876 musicA = {
1877   <<
1878     \relative c' {
1879       cis'8 fis, bes4 <a cis>8 f bis4 |
1880       cis2. <c, g'>4 |
1881     }
1882     \\
1883     \relative c' {
1884       ais'2 cis, |
1885       fis8 b a4 cis2 |
1886     }
1887   >>
1888 }
1889
1890 musicB = {
1891   \clef bass
1892   \new Voice {
1893     \voiceTwo \relative c' {
1894       <fis, a cis>8[ <fis a cis>
1895       \change Staff = up
1896       cis' cis
1897       \change Staff = down
1898       <fis, a> <fis a>]
1899       \showStaffSwitch
1900       \change Staff = up
1901       dis'4 |
1902       \change Staff = down
1903       <fis, a cis>4 gis <f a d>2 |
1904     }
1905   }
1906 }
1907
1908 \new PianoStaff {
1909   <<
1910     \context Staff = "up" {
1911       \accidentalStyle "modern-voice-cautionary"
1912       \musicA
1913     }
1914     \context Staff = "down" {
1915       \accidentalStyle "modern-voice-cautionary"
1916       \musicB
1917     }
1918   >>
1919 }
1920 @end lilypond
1921
1922 @item piano
1923
1924 @cindex accidental style, piano
1925 @cindex accidentals, piano
1926 @cindex piano accidental style
1927 @cindex piano accidentals
1928
1929 @funindex piano
1930
1931 This rule reflects twentieth-century practice for piano notation.
1932 Its behavior is very similar to @code{modern} style, but here
1933 accidentals also get canceled across the staves in the same
1934 @code{GrandStaff} or @code{PianoStaff}, hence all the
1935 cancellations of the final notes.
1936
1937 This accidental style applies to the current @code{GrandStaff} or
1938 @code{PianoStaff} by default.
1939
1940 @lilypond[quote]
1941 musicA = {
1942   <<
1943     \relative c' {
1944       cis'8 fis, bes4 <a cis>8 f bis4 |
1945       cis2. <c, g'>4 |
1946     }
1947     \\
1948     \relative c' {
1949       ais'2 cis, |
1950       fis8 b a4 cis2 |
1951     }
1952   >>
1953 }
1954
1955 musicB = {
1956   \clef bass
1957   \new Voice {
1958     \voiceTwo \relative c' {
1959       <fis, a cis>8[ <fis a cis>
1960       \change Staff = up
1961       cis' cis
1962       \change Staff = down
1963       <fis, a> <fis a>]
1964       \showStaffSwitch
1965       \change Staff = up
1966       dis'4 |
1967       \change Staff = down
1968       <fis, a cis>4 gis <f a d>2 |
1969     }
1970   }
1971 }
1972
1973 \new PianoStaff {
1974   <<
1975     \context Staff = "up" {
1976       \accidentalStyle "piano"
1977       \musicA
1978     }
1979     \context Staff = "down" {
1980       \musicB
1981     }
1982   >>
1983 }
1984 @end lilypond
1985
1986 @item piano-cautionary
1987
1988 @cindex accidentals, piano cautionary
1989 @cindex cautionary accidentals, piano
1990 @cindex piano cautionary accidentals
1991 @cindex accidental style, piano cautionary
1992 @cindex cautionary accidental style, piano
1993 @cindex piano cautionary accidental style
1994
1995 @funindex piano-cautionary
1996
1997 This is the same as @code{piano} but with the extra accidentals
1998 typeset as cautionaries.
1999
2000 @lilypond[quote]
2001 musicA = {
2002   <<
2003     \relative c' {
2004       cis'8 fis, bes4 <a cis>8 f bis4 |
2005       cis2. <c, g'>4 |
2006     }
2007     \\
2008     \relative c' {
2009       ais'2 cis, |
2010       fis8 b a4 cis2 |
2011     }
2012   >>
2013 }
2014
2015 musicB = {
2016   \clef bass
2017   \new Voice {
2018     \voiceTwo \relative c' {
2019       <fis, a cis>8[ <fis a cis>
2020       \change Staff = up
2021       cis' cis
2022       \change Staff = down
2023       <fis, a> <fis a>]
2024       \showStaffSwitch
2025       \change Staff = up
2026       dis'4 |
2027       \change Staff = down
2028       <fis, a cis>4 gis <f a d>2 |
2029     }
2030   }
2031 }
2032
2033 \new PianoStaff {
2034   <<
2035     \context Staff = "up" {
2036       \accidentalStyle "piano-cautionary"
2037       \musicA
2038     }
2039     \context Staff = "down" {
2040       \musicB
2041     }
2042   >>
2043 }
2044 @end lilypond
2045
2046
2047 @item neo-modern
2048
2049 @cindex neo-modern accidental style
2050 @cindex accidental style, neo-modern
2051
2052 @funindex neo-modern
2053
2054 This rule reproduces a common practice in contemporary music:
2055 accidentals are printed like with @code{modern}, but they are printed
2056 again if the same note appears later in the same measure -- except
2057 if the note is immediately repeated.
2058
2059 @lilypond[quote]
2060 musicA = {
2061   <<
2062     \relative c' {
2063       cis'8 fis, bes4 <a cis>8 f bis4 |
2064       cis2. <c, g'>4 |
2065     }
2066     \\
2067     \relative c' {
2068       ais'2 cis, |
2069       fis8 b a4 cis2 |
2070     }
2071   >>
2072 }
2073
2074 musicB = {
2075   \clef bass
2076   \new Voice {
2077     \voiceTwo \relative c' {
2078       <fis, a cis>8[ <fis a cis>
2079       \change Staff = up
2080       cis' cis
2081       \change Staff = down
2082       <fis, a> <fis a>]
2083       \showStaffSwitch
2084       \change Staff = up
2085       dis'4 |
2086       \change Staff = down
2087       <fis, a cis>4 gis <f a d>2 |
2088     }
2089   }
2090 }
2091
2092 \new PianoStaff {
2093   <<
2094     \context Staff = "up" {
2095       \accidentalStyle "neo-modern"
2096       \musicA
2097     }
2098     \context Staff = "down" {
2099       \accidentalStyle "neo-modern"
2100       \musicB
2101     }
2102   >>
2103 }
2104 @end lilypond
2105
2106 @item neo-modern-cautionary
2107
2108 @cindex neo-modern-cautionary accidental style
2109 @cindex accidental style, neo-modern-cautionary
2110
2111 @funindex neo-modern-cautionary
2112
2113 This rule is similar to @code{neo-modern}, but the extra
2114 accidentals are printed as cautionary accidentals.
2115
2116 @lilypond[quote]
2117 musicA = {
2118   <<
2119     \relative c' {
2120       cis'8 fis, bes4 <a cis>8 f bis4 |
2121       cis2. <c, g'>4 |
2122     }
2123     \\
2124     \relative c' {
2125       ais'2 cis, |
2126       fis8 b a4 cis2 |
2127     }
2128   >>
2129 }
2130
2131 musicB = {
2132   \clef bass
2133   \new Voice {
2134     \voiceTwo \relative c' {
2135       <fis, a cis>8[ <fis a cis>
2136       \change Staff = up
2137       cis' cis
2138       \change Staff = down
2139       <fis, a> <fis a>]
2140       \showStaffSwitch
2141       \change Staff = up
2142       dis'4 |
2143       \change Staff = down
2144       <fis, a cis>4 gis <f a d>2 |
2145     }
2146   }
2147 }
2148
2149 \new PianoStaff {
2150   <<
2151     \context Staff = "up" {
2152       \accidentalStyle "neo-modern-cautionary"
2153       \musicA
2154     }
2155     \context Staff = "down" {
2156       \accidentalStyle "neo-modern-cautionary"
2157       \musicB
2158     }
2159   >>
2160 }
2161 @end lilypond
2162
2163
2164 @item neo-modern-voice
2165
2166 @cindex neo-modern-voice accidental style
2167 @cindex accidental style, neo-modern-voice
2168
2169 @funindex neo-modern-voice
2170
2171 This rule is used for multivoice accidentals to be read both by
2172 musicians playing one voice and musicians playing all voices.
2173 Accidentals are typeset for each voice as with @code{neo-modern},
2174 but they are canceled across voices in the same @code{Staff}.
2175
2176 @lilypond[quote]
2177 musicA = {
2178   <<
2179     \relative c' {
2180       cis'8 fis, bes4 <a cis>8 f bis4 |
2181       cis2. <c, g'>4 |
2182     }
2183     \\
2184     \relative c' {
2185       ais'2 cis, |
2186       fis8 b a4 cis2 |
2187     }
2188   >>
2189 }
2190
2191 musicB = {
2192   \clef bass
2193   \new Voice {
2194     \voiceTwo \relative c' {
2195       <fis, a cis>8[ <fis a cis>
2196       \change Staff = up
2197       cis' cis
2198       \change Staff = down
2199       <fis, a> <fis a>]
2200       \showStaffSwitch
2201       \change Staff = up
2202       dis'4 |
2203       \change Staff = down
2204       <fis, a cis>4 gis <f a d>2 |
2205     }
2206   }
2207 }
2208
2209 \new PianoStaff {
2210   <<
2211     \context Staff = "up" {
2212       \accidentalStyle "neo-modern-voice"
2213       \musicA
2214     }
2215     \context Staff = "down" {
2216       \accidentalStyle "neo-modern-voice"
2217       \musicB
2218     }
2219   >>
2220 }
2221 @end lilypond
2222
2223 @item neo-modern-voice-cautionary
2224
2225 @cindex neo-modern-voice-cautionary accidental style
2226 @cindex accidental style, neo-modern-voice-cautionary
2227
2228 @funindex neo-modern-voice-cautionary
2229
2230 This rule is similar to @code{neo-modern-voice}, but the extra
2231 accidentals are printed as cautionary accidentals.
2232
2233 @lilypond[quote]
2234 musicA = {
2235   <<
2236     \relative c' {
2237       cis'8 fis, bes4 <a cis>8 f bis4 |
2238       cis2. <c, g'>4 |
2239     }
2240     \\
2241     \relative c' {
2242       ais'2 cis, |
2243       fis8 b a4 cis2 |
2244     }
2245   >>
2246 }
2247
2248 musicB = {
2249   \clef bass
2250   \new Voice {
2251     \voiceTwo \relative c' {
2252       <fis, a cis>8[ <fis a cis>
2253       \change Staff = up
2254       cis' cis
2255       \change Staff = down
2256       <fis, a> <fis a>]
2257       \showStaffSwitch
2258       \change Staff = up
2259       dis'4 |
2260       \change Staff = down
2261       <fis, a cis>4 gis <f a d>2 |
2262     }
2263   }
2264 }
2265
2266 \new PianoStaff {
2267   <<
2268     \context Staff = "up" {
2269       \accidentalStyle "neo-modern-voice-cautionary"
2270       \musicA
2271     }
2272     \context Staff = "down" {
2273       \accidentalStyle "neo-modern-voice-cautionary"
2274       \musicB
2275     }
2276   >>
2277 }
2278 @end lilypond
2279
2280 @item dodecaphonic
2281
2282 @cindex dodecaphonic accidental style
2283 @cindex dodecaphonic style, neo-modern
2284
2285 @funindex dodecaphonic
2286
2287 This rule reflects a practice introduced by composers at
2288 the beginning of the 20th century, in an attempt to
2289 abolish the hierarchy between natural and non-natural notes.
2290 With this style, @emph{every} note gets an accidental sign,
2291 including natural signs.
2292
2293 @lilypond[quote]
2294 musicA = {
2295   <<
2296     \relative c' {
2297       cis'8 fis, bes4 <a cis>8 f bis4 |
2298       cis2. <c, g'>4 |
2299     }
2300     \\
2301     \relative c' {
2302       ais'2 cis, |
2303       fis8 b a4 cis2 |
2304     }
2305   >>
2306 }
2307
2308 musicB = {
2309   \clef bass
2310   \new Voice {
2311     \voiceTwo \relative c' {
2312       <fis, a cis>8[ <fis a cis>
2313       \change Staff = up
2314       cis' cis
2315       \change Staff = down
2316       <fis, a> <fis a>]
2317       \showStaffSwitch
2318       \change Staff = up
2319       dis'4 |
2320       \change Staff = down
2321       <fis, a cis>4 gis <f a d>2 |
2322     }
2323   }
2324 }
2325
2326 \new PianoStaff {
2327   <<
2328     \context Staff = "up" {
2329       \accidentalStyle "dodecaphonic"
2330       \musicA
2331     }
2332     \context Staff = "down" {
2333       \accidentalStyle "dodecaphonic"
2334       \musicB
2335     }
2336   >>
2337 }
2338 @end lilypond
2339
2340
2341 @item teaching
2342
2343 @cindex teaching accidental style
2344 @cindex accidental style, teaching
2345
2346 @funindex teaching
2347
2348 This rule is intended for students, and makes it easy to create
2349 scale sheets with automatically created cautionary accidentals.
2350 Accidentals are printed like with @code{modern}, but cautionary
2351 accidentals are added for all sharp or flat tones specified by the
2352 key signature, except if the note is immediately repeated.
2353
2354 @lilypond[quote]
2355 musicA = {
2356   <<
2357     \relative c' {
2358       cis'8 fis, bes4 <a cis>8 f bis4 |
2359       cis2. <c, g'>4 |
2360     }
2361     \\
2362     \relative c' {
2363       ais'2 cis, |
2364       fis8 b a4 cis2 |
2365     }
2366   >>
2367 }
2368
2369 musicB = {
2370   \clef bass
2371   \new Voice {
2372     \voiceTwo \relative c' {
2373       <fis, a cis>8[ <fis a cis>
2374       \change Staff = up
2375       cis' cis
2376       \change Staff = down
2377       <fis, a> <fis a>]
2378       \showStaffSwitch
2379       \change Staff = up
2380       dis'4 |
2381       \change Staff = down
2382       <fis, a cis>4 gis <f a d>2 |
2383     }
2384   }
2385 }
2386
2387 \new PianoStaff {
2388   <<
2389     \context Staff = "up" {
2390       \key fis \minor
2391       \accidentalStyle "teaching"
2392       \musicA
2393     }
2394     \context Staff = "down" {
2395       \key fis \minor
2396       \accidentalStyle "teaching"
2397       \musicB
2398     }
2399   >>
2400 }
2401 @end lilypond
2402
2403
2404
2405 @item no-reset
2406
2407 @cindex accidental style, no reset
2408 @cindex no reset accidental style
2409
2410 @funindex no-reset
2411
2412 This is the same as @code{default} but with accidentals lasting
2413 @q{forever} and not only within the same measure:
2414
2415 @lilypond[quote]
2416 musicA = {
2417   <<
2418     \relative c' {
2419       cis'8 fis, bes4 <a cis>8 f bis4 |
2420       cis2. <c, g'>4 |
2421     }
2422     \\
2423     \relative c' {
2424       ais'2 cis, |
2425       fis8 b a4 cis2 |
2426     }
2427   >>
2428 }
2429
2430 musicB = {
2431   \clef bass
2432   \new Voice {
2433     \voiceTwo \relative c' {
2434       <fis, a cis>8[ <fis a cis>
2435       \change Staff = up
2436       cis' cis
2437       \change Staff = down
2438       <fis, a> <fis a>]
2439       \showStaffSwitch
2440       \change Staff = up
2441       dis'4 |
2442       \change Staff = down
2443       <fis, a cis>4 gis <f a d>2 |
2444     }
2445   }
2446 }
2447
2448 \new PianoStaff {
2449   <<
2450     \context Staff = "up" {
2451       \accidentalStyle "no-reset"
2452       \musicA
2453     }
2454     \context Staff = "down" {
2455       \accidentalStyle "no-reset"
2456       \musicB
2457     }
2458   >>
2459 }
2460 @end lilypond
2461
2462 @item forget
2463
2464 @cindex forget accidental style
2465 @cindex accidental style, forget
2466
2467 @funindex forget
2468
2469 This is the opposite of @code{no-reset}: Accidentals are not
2470 remembered at all -- and hence all accidentals are typeset
2471 relative to the key signature, regardless of what came before in
2472 the music.
2473
2474 @lilypond[quote]
2475 musicA = {
2476   <<
2477     \relative c' {
2478       cis'8 fis, bes4 <a cis>8 f bis4 |
2479       cis2. <c, g'>4 |
2480     }
2481     \\
2482     \relative c' {
2483       ais'2 cis, |
2484       fis8 b a4 cis2 |
2485     }
2486   >>
2487 }
2488
2489 musicB = {
2490   \clef bass
2491   \new Voice {
2492     \voiceTwo \relative c' {
2493       <fis, a cis>8[ <fis a cis>
2494       \change Staff = up
2495       cis' cis
2496       \change Staff = down
2497       <fis, a> <fis a>]
2498       \showStaffSwitch
2499       \change Staff = up
2500       dis'4 |
2501       \change Staff = down
2502       <fis, a cis>4 gis <f a d>2 |
2503     }
2504   }
2505 }
2506
2507 \new PianoStaff {
2508   <<
2509     \context Staff = "up" {
2510       \accidentalStyle "forget"
2511       \musicA
2512     }
2513     \context Staff = "down" {
2514       \accidentalStyle "forget"
2515       \musicB
2516     }
2517   >>
2518 }
2519 @end lilypond
2520 @end table
2521
2522 @seealso
2523 Snippets:
2524 @rlsr{Pitches}.
2525
2526 Internals Reference:
2527 @rinternals{Accidental},
2528 @rinternals{Accidental_engraver},
2529 @rinternals{GrandStaff},
2530 @rinternals{PianoStaff},
2531 @rinternals{Staff},
2532 @rinternals{AccidentalSuggestion},
2533 @rinternals{AccidentalPlacement},
2534 @rinternals{accidental-suggestion-interface}.
2535
2536 @cindex accidentals and simultaneous notes
2537 @cindex simultaneous notes and accidentals
2538 @cindex accidentals in chords
2539 @cindex chords, accidentals in
2540
2541 @knownissues
2542 Simultaneous notes are not considered in the automatic
2543 determination of accidentals; only previous notes and the key
2544 signature are considered.  Forcing accidentals with@tie{}@code{!}
2545 or@tie{}@code{?} may be required when the same note name occurs
2546 simultaneously with different alterations, as in @samp{<f! fis!>}.
2547
2548 Cautionary cancellation of accidentals is done by looking at previous measure.
2549 However, in the @code{\alternative} block following a @code{\repeat volta N}
2550 section, one would expect the cancellation being calculated using the previous
2551 @emph{played} measure, not previous @emph{printed} measure.
2552 In the following example, the natural @code{c} in the second alternative does
2553 not need a natural sign:
2554
2555 @lilypond[quote]
2556 {
2557   \accidentalStyle "modern"
2558   \time 2/4
2559   \repeat volta 2 {
2560     c'2
2561   }
2562   \alternative {
2563      cis'
2564      c'
2565   }
2566 }
2567 @end lilypond
2568
2569 The following work-around can be used: define a function that locally changes
2570 the accidental style to @code{forget}:
2571
2572 @lilypond[verbatim,quote]
2573 forget = #(define-music-function (parser location music) (ly:music?) #{
2574   \accidentalStyle "forget"
2575   $music
2576   \accidentalStyle "modern"
2577 #})
2578 {
2579   \accidentalStyle "modern"
2580   \time 2/4
2581   \repeat volta 2 {
2582     c'2
2583   }
2584   \alternative {
2585      cis'
2586      \forget c'
2587   }
2588 }
2589 @end lilypond
2590
2591
2592 @node Ambitus
2593 @unnumberedsubsubsec Ambitus
2594
2595 @cindex ambitus
2596 @cindex range of pitches
2597 @cindex pitch range
2598
2599 The term @notation{ambitus} (pl. ambitus) denotes a range of
2600 pitches for a given voice in a part of music.  It may also denote
2601 the pitch range that a musical instrument is capable of playing.
2602 Ambitus are printed on vocal parts so that performers can easily
2603 determine if it matches their capabilities.
2604
2605 Ambitus are denoted at the beginning of a piece near the initial
2606 clef.  The range is graphically specified by two note heads that
2607 represent the lowest and highest pitches.  Accidentals are only
2608 printed if they are not part of the key signature.
2609
2610 @lilypond[verbatim,quote]
2611 \layout {
2612   \context {
2613     \Voice
2614     \consists "Ambitus_engraver"
2615   }
2616 }
2617
2618 \relative c'' {
2619   aes c e2
2620   cis,1
2621 }
2622 @end lilypond
2623
2624
2625 @snippets
2626
2627 @lilypondfile[verbatim,quote,texidoc,doctitle]
2628 {adding-ambitus-per-voice.ly}
2629
2630 @lilypondfile[verbatim,quote,texidoc,doctitle]
2631 {ambitus-with-multiple-voices.ly}
2632
2633 @lilypondfile[verbatim,quote,texidoc,doctitle]
2634 {changing-the-ambitus-gap.ly}
2635
2636 @seealso
2637 Music Glossary:
2638 @rglos{ambitus}.
2639
2640 Snippets:
2641 @rlsr{Pitches}.
2642
2643 Internals Reference:
2644 @rinternals{Ambitus_engraver},
2645 @rinternals{Voice},
2646 @rinternals{Staff},
2647 @rinternals{Ambitus},
2648 @rinternals{AmbitusAccidental},
2649 @rinternals{AmbitusLine},
2650 @rinternals{AmbitusNoteHead},
2651 @rinternals{ambitus-interface}.
2652
2653 @knownissues
2654 There is no collision handling in the case of multiple per-voice
2655 ambitus.
2656
2657
2658 @node Note heads
2659 @subsection Note heads
2660
2661 This section suggests ways of altering note heads.
2662
2663 @menu
2664 * Special note heads::
2665 * Easy notation note heads::
2666 * Shape note heads::
2667 * Improvisation::
2668 @end menu
2669
2670 @node Special note heads
2671 @unnumberedsubsubsec Special note heads
2672
2673 @cindex note heads, special
2674 @cindex note heads, cross
2675 @cindex note heads, diamond
2676 @cindex note heads, parlato
2677 @cindex note heads, harmonic
2678 @cindex note heads, guitar
2679 @cindex special note heads
2680 @cindex cross note heads
2681 @cindex diamond note heads
2682 @cindex parlato note heads
2683 @cindex harmonic note heads
2684 @cindex guitar note heads
2685 @cindex note head styles
2686 @cindex styles, note heads
2687
2688 @funindex cross
2689
2690 The appearance of note heads may be altered:
2691
2692 @lilypond[verbatim,quote,relative=2]
2693 c4 b
2694 \override NoteHead #'style = #'cross
2695 c4 b
2696 \revert NoteHead #'style
2697 a b
2698 \override NoteHead #'style = #'harmonic
2699 a b
2700 \revert NoteHead #'style
2701 c4 d e f
2702 @end lilypond
2703
2704 To see all note head styles, see @ref{Note head styles}.
2705
2706 The @code{cross} style is used to represent a variety of musical
2707 intentions.  The following generic predefined commands modify the
2708 note head in both staff and tablature contexts and can be used to
2709 represent any musical meaning:
2710
2711 @lilypond[verbatim,quote,relative=2]
2712 c4 b
2713 \xNotesOn
2714  a b c4 b
2715 \xNotesOff
2716 c4 d
2717 @end lilypond
2718
2719 The music function form of this predefined command may be used
2720 inside and outside chords to generate crossed note heads in both
2721 staff and tablature contexts:
2722
2723 @lilypond[verbatim,quote,relative=2]
2724 c4 b
2725 \xNote { e f }
2726 c b < g \xNote c f > b
2727 @end lilypond
2728
2729 As synonyms for @code{\xNote}, @code{\xNotesOn} and @code{\xNotesOff},
2730 @code{\deadNote}, @code{\deadNotesOn} and @code{\deadNotesOff} can
2731 be used.  The term @notation{dead note} is commonly used by guitarists.
2732
2733 There is also a shorthand for diamond shapes which can be used
2734 only inside chords:
2735
2736 @lilypond[verbatim,quote,relative=2]
2737 <c f\harmonic>2 <d a'\harmonic>4 <c g'\harmonic>
2738 @end lilypond
2739
2740 @predefined
2741 @code{\harmonic},
2742 @code{\xNotesOn},
2743 @code{\xNotesOff},
2744 @code{\xNote}.
2745 @endpredefined
2746
2747 @seealso
2748 Snippets:
2749 @rlsr{Pitches}.
2750
2751 Notation Reference:
2752 @ref{Note head styles},
2753 @ref{Chorded notes},
2754 @ref{Indicating harmonics and dampened notes}.
2755
2756 Internals Reference:
2757 @rinternals{note-event},
2758 @rinternals{Note_heads_engraver},
2759 @rinternals{Ledger_line_engraver},
2760 @rinternals{NoteHead},
2761 @rinternals{LedgerLineSpanner},
2762 @rinternals{note-head-interface},
2763 @rinternals{ledger-line-spanner-interface}.
2764
2765
2766 @node Easy notation note heads
2767 @unnumberedsubsubsec Easy notation note heads
2768
2769 @cindex note heads, practice
2770 @cindex practice note heads
2771 @cindex note heads, easy notation
2772 @cindex easy notation
2773 @cindex beginners' music
2774 @cindex music, beginners'
2775 @cindex easy play note heads
2776 @cindex note heads, easy play
2777
2778 @funindex \easyHeadsOn
2779 @funindex easyHeadsOn
2780 @funindex \easyHeadsOff
2781 @funindex easyHeadsOff
2782
2783 The @q{easy play} note head includes a note name inside the head.
2784 It is used in music for beginners.  To make the letters readable,
2785 it should be printed in a large font size.  To print with a larger
2786 font, see @ref{Setting the staff size}.
2787
2788 @lilypond[verbatim,quote]
2789 #(set-global-staff-size 26)
2790 \relative c' {
2791   \easyHeadsOn
2792   c2 e4 f
2793   g1
2794   \easyHeadsOff
2795   c,1
2796 }
2797 @end lilypond
2798
2799
2800 @predefined
2801 @code{\easyHeadsOn},
2802 @code{\easyHeadsOff}.
2803 @endpredefined
2804
2805
2806 @snippets
2807
2808 @lilypondfile[verbatim,quote,texidoc,doctitle]
2809 {numbers-as-easy-note-heads.ly}
2810
2811 @seealso
2812 Notation Reference:
2813 @ref{Setting the staff size}.
2814
2815 Snippets:
2816 @rlsr{Pitches}.
2817
2818 Internals Reference:
2819 @rinternals{note-event},
2820 @rinternals{Note_heads_engraver},
2821 @rinternals{NoteHead},
2822 @rinternals{note-head-interface}.
2823
2824
2825 @node Shape note heads
2826 @unnumberedsubsubsec Shape note heads
2827
2828 @cindex note heads, shape
2829 @cindex note heads, Aiken
2830 @cindex note heads, sacred harp
2831 @cindex shape notes
2832 @cindex Aiken shape note heads
2833 @cindex sacred harp note heads
2834 @cindex note heads, Southern Harmony
2835 @cindex Southern Harmony note heads
2836 @cindex Funk shape note heads
2837 @cindex note heads, Funk
2838 @cindex note heads, Harmonica Sacra
2839 @cindex Harmonica Sacra note heads
2840 @cindex Christian Harmony note heads
2841 @cindex note heads, Christian Harmony
2842 @cindex Walker shape note heads
2843 @cindex note heads, Walker
2844
2845 @funindex \aikenHeads
2846 @funindex aikenHeads
2847 @funindex \sacredHarpHeads
2848 @funindex sacredHarpHeads
2849 @funindex \southernHarmonyHeads
2850 @funindex southernHarmonyHeads
2851 @funindex \funkHeads
2852 @funindex funkHeads
2853 @funindex \walkerHeads
2854 @funindex walkerHeads
2855
2856 In shape note head notation, the shape of the note head
2857 corresponds to the harmonic function of a note in the scale.  This
2858 notation was popular in nineteenth-century American song books.
2859 Shape note heads can be produced in Sacred Harp, Southern Harmony,
2860 Funk (Harmonica Sacra), Walker, and Aiken (Christian Harmony) styles:
2861
2862 @lilypond[verbatim,quote,relative=2]
2863 \aikenHeads
2864 c, d e f g2 a b1 c \break
2865 \sacredHarpHeads
2866 c,4 d e f g2 a b1 c \break
2867 \southernHarmonyHeads
2868 c,4 d e f g2 a b1 c \break
2869 \funkHeads
2870 c,4 d e f g2 a b1 c \break
2871 \walkerHeads
2872 c,4 d e f g2 a b1 c \break
2873 @end lilypond
2874
2875 @funindex \key
2876 @funindex key
2877 @funindex \aikenHeadsMinor
2878 @funindex aikenHeadsMinor
2879 @funindex \sacredHarpHeadsMinor
2880 @funindex sacredHarpHeadsMinor
2881 @funindex \southernHarmonyHeadsMinor
2882 @funindex southernHarmonyHeadsMinor
2883 @funindex \funkHeadsMinor
2884 @funindex funkHeadsMinor
2885 @funindex \walkerHeadsMinor
2886 @funindex walkerHeadsMinor
2887
2888 Shapes are typeset according to the step in the scale, where the base
2889 of the scale is determined by the @code{\key} command.  When writing
2890 in a minor key, the scale step can be determined from the relative
2891 major:
2892
2893 @lilypond[verbatim,quote,relative=2]
2894 \key a \minor
2895 \aikenHeads
2896 a b c d e2 f g1 a \break
2897 \aikenHeadsMinor
2898 a,4 b c d e2 f g1 a \break
2899 \sacredHarpHeadsMinor
2900 a,2 b c d \break
2901 \southernHarmonyHeadsMinor
2902 a2 b c d \break
2903 \funkHeadsMinor
2904 a2 b c d \break
2905 \walkerHeadsMinor
2906 a2 b c d \break
2907
2908 @end lilypond
2909
2910
2911 @predefined
2912 @code{\aikenHeads},
2913 @code{\aikenHeadsMinor},
2914 @code{\funkHeads},
2915 @code{\funkHeadsMinor},
2916 @code{\sacredHarpHeads},
2917 @code{\sacredHarpHeadsMinor},
2918 @code{\southernHarmonyHeads},
2919 @code{\southernHarmonyHeadsMinor},
2920 @code{\walkerHeads},
2921 @code{\walkerHeadsMinor}.
2922 @endpredefined
2923
2924
2925 @snippets
2926
2927 @lilypondfile[verbatim,quote,texidoc,doctitle]
2928 {applying-note-head-styles-depending-on-the-step-of-the-scale.ly}
2929
2930 To see all note head styles, see @ref{Note head styles}.
2931
2932 @seealso
2933 Snippets:
2934 @rlsr{Pitches}.
2935
2936 Notation Reference:
2937 @ref{Note head styles}.
2938
2939 Internals Reference:
2940 @rinternals{note-event},
2941 @rinternals{Note_heads_engraver},
2942 @rinternals{NoteHead},
2943 @rinternals{note-head-interface}.
2944
2945
2946 @node Improvisation
2947 @unnumberedsubsubsec Improvisation
2948
2949 @cindex improvisation
2950 @cindex slashed note heads
2951 @cindex note heads, improvisation
2952 @cindex note heads, slashed
2953
2954 @funindex \improvisationOn
2955 @funindex improvisationOn
2956 @funindex \improvisationOff
2957 @funindex improvisationOff
2958
2959 Improvisation is sometimes denoted with slashed note heads, where
2960 the performer may choose any pitch but should play the specified
2961 rhythm.  Such note heads can be created:
2962
2963 @lilypond[verbatim,quote,relative=2]
2964 \new Voice \with {
2965   \consists "Pitch_squash_engraver"
2966 } {
2967   e8 e g a a16( bes) a8 g
2968   \improvisationOn
2969   e8 ~
2970   e2 ~ e8 f4 f8 ~
2971   f2
2972   \improvisationOff
2973   a16( bes) a8 g e
2974 }
2975 @end lilypond
2976
2977 @predefined
2978 @code{\improvisationOn},
2979 @code{\improvisationOff}.
2980 @endpredefined
2981
2982 @seealso
2983 Snippets:
2984 @rlsr{Pitches}.
2985
2986 Internals Reference:
2987 @rinternals{Pitch_squash_engraver},
2988 @rinternals{Voice},
2989 @rinternals{RhythmicStaff}.