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