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