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