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