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