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