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