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