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