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