]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/user/pitches.itely
Merge master into nested-bookparts
[lilypond.git] / Documentation / user / 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.  See TRANSLATION for details.
7 @end ignore
8
9 @c \version "2.11.61"
10
11
12 @node Pitches
13 @section Pitches
14
15 @lilypondfile[quote]{pitches-headword.ly}
16
17 This section discusses how to specify the pitch of notes.  There
18 are three steps to this process: input, modification, and output.
19
20 @menu
21 * Writing pitches::
22 * Changing multiple pitches::
23 * Displaying pitches::
24 * Note heads::
25 @end menu
26
27
28 @node Writing pitches
29 @subsection Writing pitches
30
31 This section discusses how to input pitches.  There are two
32 different ways to place notes in octaves: absolute and relative
33 mode.  In most cases, relative mode will be more convenient.
34
35 @menu
36 * Absolute octave entry::
37 * Relative octave entry::
38 * Accidentals::
39 * Note names in other languages::
40 @end menu
41
42
43 @node Absolute octave entry
44 @unnumberedsubsubsec Absolute octave entry
45
46 @cindex pitch names
47 @cindex pitches
48 @cindex absolute
49 @cindex absolute octave specification
50 @cindex absolute octave entry
51
52 A pitch name is specified using lowercase letters@tie{}@code{a}
53 through@tie{}@code{g}.  The note names @code{c} to @code{b} are
54 engraved in the octave below middle C.
55
56 @c don't use c' here.
57 @lilypond[verbatim,quote,fragment]
58 \clef bass
59 c d e f
60 g a b c
61 d e f g
62 @end lilypond
63
64 @cindex octave changing mark
65 @funindex '
66 @funindex ,
67
68 Other octaves may be specified with a single quote@tie{}(@code{'})
69 or comma@tie{}(@code{,}) character.  Each@tie{}@code{'} raises the
70 pitch by one octave; each@tie{}@code{,} lowers the pitch by an
71 octave.
72
73 @lilypond[verbatim,quote,fragment]
74 \clef treble
75 c' c'' e' g
76 d'' d' d c
77 \clef bass
78 c, c,, e, g
79 d,, d, d c
80 @end lilypond
81
82 @seealso
83
84 Music Glossary:
85 @rglos{Pitch names}.
86
87 Snippets:
88 @rlsr{Pitches}.
89
90
91 @node Relative octave entry
92 @unnumberedsubsubsec Relative octave entry
93
94 @cindex relative
95 @cindex relative octave entry
96 @cindex relative octave specification
97 @funindex \relative
98
99 When octaves are specified in absolute mode it is easy to
100 accidentally put a pitch in the wrong octave.  Relative octave
101 mode reduces these errors since most of the time it is not
102 necessary to indicate any octaves at all.  Furthermore, in
103 absolute mode a single mistake may be difficult to spot, while in
104 relative mode a single error puts the rest of the piece off by one
105 octave.
106
107 @example
108 \relative @var{startpitch} @var{musicexpr}
109 @end example
110
111 In relative mode, each note is assumed to be as close to the
112 previous note as possible.  This means that the octave of each
113 pitch inside @var{musicexpr} is calculated as follows:
114
115 @itemize
116 @item
117 If no octave changing mark is used on a pitch, its octave is
118 calculated so that the interval with the previous note is less
119 than a fifth.  This interval is determined without considering
120 accidentals.
121
122 @item
123 An octave changing mark@tie{}@code{'} or@tie{}@code{,} can be
124 added to respectively raise or lower a pitch by an extra octave,
125 relative to the pitch calculated without an octave mark.
126
127 @item
128 Multiple octave changing marks can be used.  For example,
129 @code{''}@tie{}and@tie{}@code{,,} will alter the pitch by two
130 octaves.
131
132 @item
133 The pitch of the first note is relative to
134 @code{@var{startpitch}}.  @var{startpitch} is specified in
135 absolute octave mode, and it is recommended that it be a octave of
136 @code{c}.
137
138 @end itemize
139
140 Here is the relative mode shown in action:
141
142 @lilypond[verbatim,quote]
143 \relative c {
144   \clef bass
145   c d e f
146   g a b c
147   d e f g
148 }
149 @end lilypond
150
151 Octave changing marks are used for intervals greater than a
152 fourth:
153
154 @lilypond[verbatim,quote]
155 \relative c'' {
156   c g c f,
157   c' a, e'' c
158 }
159 @end lilypond
160
161 A note sequence without a single octave mark can nevertheless span
162 large intervals:
163
164 @lilypond[verbatim,quote]
165 \relative c {
166   c f b e
167   a d g c
168 }
169 @end lilypond
170
171 If the preceding item is a chord, the first note of the chord is
172 used as the reference point for the octave placement of a
173 following note or chord.  Inside chords, the next note is always
174 relative to the preceding one.  Examine the next example
175 carefully, paying attention to the @code{c} notes.
176
177 @lilypond[verbatim,quote]
178 \relative c' {
179   c
180   <c e g>
181   <c' e g'>
182   <c, e, g''>
183 }
184 @end lilypond
185
186 As explained above, the octave of pitches is calculated only with
187 the note names, regardless of any alterations.  Therefore, an
188 E-double-sharp following a B will be placed higher, while an
189 F-double-flat will be placed lower.  In other words, a
190 double-augmented fourth is considered a smaller interval than a
191 double-diminished fifth, regardless of the number of semitones
192 that each interval contains.
193
194 @lilypond[verbatim,quote]
195 \relative c'' {
196   c2 fis
197   c2 ges
198   b2 eisis
199   b2 feses
200 }
201 @end lilypond
202
203
204 @seealso
205
206 Music Glossary:
207 @rglos{fifth},
208 @rglos{interval},
209 @rglos{Pitch names}.
210
211 Notation Reference:
212 @ref{Octave checks}.
213
214 Snippets:
215 @rlsr{Pitches}.
216
217 Internals Reference:
218 @rinternals{RelativeOctaveMusic}.
219
220
221 @cindex relative octave entry and transposition
222 @cindex transposition and relative octave entry
223 @funindex \transpose
224 @funindex \chordmode
225 @funindex \relative
226
227 @knownissues
228
229 The relative conversion will not affect @code{\transpose},
230 @code{\chordmode} or @code{\relative} sections in its argument.
231 To use relative mode within transposed music, an additional
232 @code{\relative} must be placed inside @code{\transpose}.
233
234 @c DEPRECATED
235 If no @var{startpitch} is specified for @code{\relative},
236 then@tie{}@code{c'} is assumed.  However, this is a deprecated
237 option and may disappear in future versions, so its use is
238 discouraged.
239
240
241
242 @node Accidentals
243 @unnumberedsubsubsec Accidentals
244
245 @cindex accidental
246 @cindex key signature
247 @cindex clef
248
249 @c duplicated in Key signature and Accidentals
250 @warning{New users are sometimes confused about accidentals and
251 key signatures.  In LilyPond, note names are the raw input; key
252 signatures and clefs determine how this raw input is displayed.
253 An unaltered note like@tie{}@code{c} means @q{C natural},
254 regardless of the key signature or clef.  For more information,
255 see @rlearning{Accidentals and key signatures}.}
256
257 @cindex note names, Dutch
258 @cindex note names, default
259 @cindex sharp
260 @cindex flat
261 @cindex double sharp
262 @cindex sharp, double
263 @cindex double flat
264 @cindex flat, double
265 @cindex natural sign
266 @cindex natural pitch
267
268 A @notation{sharp} pitch is made by adding @code{is} to the note
269 name, and a @notation{flat} pitch by adding @code{es}.  As you
270 might expect, a @notation{double sharp} or @notation{double flat}
271 is made by adding @code{isis} or @code{eses}.  This syntax is
272 derived from Dutch note naming conventions.  To use other names
273 for accidentals, see @ref{Note names in other languages}.
274
275 @lilypond[verbatim,quote,relative=2]
276 ais1 aes aisis aeses
277 @end lilypond
278
279 A natural will cancel the effect of an accidental or key
280 signature.  However, naturals are not encoded into the note name
281 syntax with a suffix; a natural pitch is shown as a simple note
282 name:
283
284 @lilypond[verbatim,quote,relative=2]
285 a4 aes a2
286 @end lilypond
287
288 @cindex quarter tones
289 @cindex semi-flats, semi-sharps
290
291 Quarter tones may be added; the following is a series of Cs with
292 increasing pitches:
293
294 @lilypond[verbatim,quote,relative=2]
295 ceseh1 ces ceh c cih cis cisih
296 @end lilypond
297
298
299
300 @cindex accidental, reminder
301 @cindex accidental, cautionary
302 @cindex accidental, parenthesized
303 @cindex reminder accidental
304 @funindex ?
305 @cindex cautionary accidental
306 @cindex parenthesized accidental
307 @funindex !
308
309 Normally accidentals are printed automatically, but you may also
310 print them manually.  A reminder accidental can be forced by
311 adding an exclamation mark@tie{}@code{!} after the pitch.  A
312 cautionary accidental (i.e., an accidental within parentheses) can
313 be obtained by adding the question mark@tie{}@code{?} after the
314 pitch.  These extra accidentals can also be used to produce
315 natural signs.
316
317 @lilypond[verbatim,quote,relative=2]
318 cis cis cis! cis? c c c! c?
319 @end lilypond
320
321 @cindex accidental on tied note
322 @cindex tied note, accidental
323
324 Accidentals on tied notes are only printed at the beginning of a
325 new system:
326
327 @lilypond[verbatim,quote,relative=2]
328 cis1 ~ cis ~
329 \break
330 cis
331 @end lilypond
332
333
334 @snippets
335
336 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
337 {preventing-extra-naturals-from-being-automatically-added.ly}
338
339 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
340 {makam-example.ly}
341
342 @seealso
343
344 Music Glossary:
345 @rglos{sharp},
346 @rglos{flat},
347 @rglos{double sharp},
348 @rglos{double flat},
349 @rglos{Pitch names},
350 @rglos{quarter tone}.
351
352 Learning Manual:
353 @rlearning{Accidentals and key signatures}.
354
355 Notation Reference:
356 @ref{Automatic accidentals},
357 @ref{Annotational accidentals (musica ficta)},
358 @ref{Note names in other languages}.
359
360 Snippets:
361 @rlsr{Pitches}.
362
363 Internals Reference:
364 @rinternals{Accidental_engraver},
365 @rinternals{Accidental},
366 @rinternals{AccidentalCautionary},
367 @rinternals{accidental-interface}.
368
369
370 @cindex accidental, quarter-tone
371 @cindex quarter-tone accidental
372
373 @knownissues
374
375 There are no generally accepted standards for denoting
376 quarter-tone accidentals, so LilyPond's symbol does not conform to
377 any standard.
378
379
380
381 @node Note names in other languages
382 @unnumberedsubsubsec Note names in other languages
383
384 @cindex note names, other languages
385 @cindex pitch names, other languages
386 @cindex language, note names in other
387 @cindex language, pitch names in other
388
389 There are predefined sets of note names for various other
390 languages.  To use them, include the language-specific init file.
391 For example, to use English notes names, add
392 @w{@code{\include "english.ly"}} to the top of the input file.
393 The available language files and the note names they define are:
394
395
396 @smallexample
397 @multitable {nederlands.ly} {do re mi fa sol la sib si} {-iss/-is} {-ess/-es} {-ss/-x/-sharpsharp} {-essess/-eses}
398 @headitem Language
399   @tab Note names
400   @tab sharp @tab flat @tab double sharp @tab double flat
401 @item nederlands.ly
402   @tab c d e f g a bes b
403   @tab -is @tab -es @tab -isis @tab -eses
404 @item arabic.ly
405   @tab do re mi fa sol la sib si
406   @tab -d @tab -b @tab -dd @tab -bb
407 @item catalan.ly
408   @tab do re mi fa sol la sib si
409   @tab -d/-s @tab -b @tab -dd/-ss @tab -bb
410 @item deutsch.ly
411   @tab c d e f g a b h
412   @tab -is @tab -es @tab -isis @tab -eses
413 @item english.ly
414   @tab c d e f g a bf b
415   @tab -s/-sharp @tab -f/-flat @tab -ss/-x/-sharpsharp
416     @tab -ff/-flatflat
417 @item espanol.ly
418   @tab do re mi fa sol la sib si
419   @tab -s @tab -b @tab -ss @tab -bb
420 @item italiano.ly
421   @tab do re mi fa sol la sib si
422   @tab -d @tab -b @tab -dd @tab -bb
423 @item norsk.ly
424   @tab c d e f g a b h
425   @tab -iss/-is @tab -ess/-es @tab -ississ/-isis
426     @tab -essess/-eses
427 @item portugues.ly
428   @tab do re mi fa sol la sib si
429   @tab -s @tab -b @tab -ss @tab -bb
430 @item suomi.ly
431   @tab c d e f g a b h
432   @tab -is @tab -es @tab -isis @tab -eses
433 @item svenska.ly
434   @tab c d e f g a b h
435   @tab -iss @tab -ess @tab -ississ @tab -essess
436 @item vlaams.ly
437   @tab do re mi fa sol la sib si
438   @tab -k @tab -b @tab -kk @tab -bb
439 @end multitable
440 @end smallexample
441
442 In Dutch, @code{aes} is contracted to @code{as}, but both forms
443 are accepted in LilyPond.  Similarly, both @code{es} and
444 @code{ees} are accepted.  This also applies to
445 @code{aeses}@tie{}/@tie{}@code{ases} and
446 @code{eeses}@tie{}/@tie{}@code{eses}.  Sometimes only these
447 contracted names are defined in the corresponding language files.
448
449 @lilypond[verbatim,quote,relative=2]
450 a2 as e es a ases e eses
451 @end lilypond
452
453
454 @cindex microtones
455 @cindex semi-sharp
456 @cindex semi-flat
457 @cindex sesqui-sharp
458 @cindex sesqui-flat
459
460 Some music uses microtones whose alterations are fractions of a
461 @q{normal} sharp or flat.  The note names for quarter-tones
462 defined in the various language files are listed in the following
463 table.  Here the prefixes @notation{semi-} and @notation{sesqui-}
464 mean @q{half} and @q{one and a half}, respectively.  For the other
465 languages, no special names have been defined yet.
466
467 @smallexample
468 @multitable {nederlands.ly} {do re mi fa sol la sib si} {-iss/-is} {-ess/-es} {-ississ/-isis} {-ississ/-isis}
469 @headitem Language
470   @tab Note names
471   @tab semi-sharp @tab semi-flat @tab sesqui-sharp @tab sesqui-flat
472
473 @item nederlands.ly
474   @tab c d e f g a bes b
475   @tab -ih @tab -eh @tab -isih @tab -eseh
476 @item arabic.ly
477   @tab do re mi fa sol la sib si
478   @tab -sd @tab -sb @tab -dsd @tab -bsb
479 @item deutsch.ly
480   @tab c d e f g a b h
481   @tab -ih @tab -eh @tab -isih @tab -eseh
482 @item english.ly
483   @tab c d e f g a bf b
484   @tab -qs @tab -qf @tab -tqs @tab -tqf
485 @item italiano.ly
486   @tab do re mi fa sol la sib si
487   @tab -sd @tab -sb @tab -dsd @tab -bsb
488 @item portugues.ly
489   @tab do re mi fa sol la sib si
490   @tab -sqt @tab -bqt @tab -stqt @tab -btqt
491 @end multitable
492 @end smallexample
493
494
495 @seealso
496
497 Music Glossary:
498 @rglos{Pitch names}.
499
500 Snippets:
501 @rlsr{Pitches}.
502
503
504 @node Changing multiple pitches
505 @subsection Changing multiple pitches
506
507 This section discusses how to modify pitches.
508
509 @menu
510 * Octave checks::
511 * Transpose::
512 @end menu
513
514 @node Octave checks
515 @unnumberedsubsubsec Octave checks
516
517 @cindex octave correction
518 @cindex octave check
519 @cindex control pitch
520 @funindex =
521 @funindex \octaveCheck
522 @funindex controlpitch
523
524 In relative mode, it is easy to forget an octave changing mark.
525 Octave checks make such errors easier to find by displaying a
526 warning and correcting the octave if a note is found in an
527 unexpected octave.
528
529 To check the octave of a note, specify the absolute octave after
530 the @code{=}@tie{}symbol.  This example will generate a warning
531 (and change the pitch) because the second note is the absolute
532 octave @code{d''} instead of @code{d'} as indicated by the octave
533 correction.
534
535 @lilypond[verbatim,quote]
536 \relative c'' {
537   c2 d='4 d
538   e2 f
539 }
540 @end lilypond
541
542 The octave of notes may also be checked with the
543 @code{\octaveCheck}@tie{}@var{controlpitch} command.
544 @var{controlpitch} is specified in absolute mode.  This checks
545 that the interval between the previous note and the
546 @var{controlpitch} is within a fourth (i.e., the normal
547 calculation of relative mode).  If this check fails, a warning is
548 printed, but the previous note is not changed.  Future notes are
549 relative to the @var{controlpitch}.
550
551 @lilypond[verbatim,quote]
552 \relative c'' {
553   c2 d
554   \octaveCheck c'
555   e2 f
556 }
557 @end lilypond
558
559 Compare the two bars below.  The first and third @code{\octaveCheck}
560 checks fail, but the second one does not fail.
561
562 @lilypond[verbatim,quote]
563 \relative c'' {
564   c4 f g f
565
566   c4
567   \octaveCheck c'
568   f
569   \octaveCheck c'
570   g
571   \octaveCheck c'
572   f
573 }
574 @end lilypond
575
576
577 @seealso
578
579 Snippets:
580 @rlsr{Pitches}.
581
582 Internals Reference:
583 @rinternals{RelativeOctaveCheck}.
584
585
586 @node Transpose
587 @unnumberedsubsubsec Transpose
588
589 @cindex transpose
590 @cindex transposing
591 @cindex transposition
592 @cindex transposition of pitches
593 @cindex transposition of notes
594 @cindex pitches, transposition of
595 @cindex notes, transposition of
596 @funindex \transpose
597
598 A music expression can be transposed with @code{\transpose}.  The
599 syntax is
600
601 @example
602 \transpose @var{frompitch} @var{topitch} @var{musicexpr}
603 @end example
604
605 @noindent
606 This means that @var{musicexpr} is transposed by the interval
607 between the pitches @var{frompitch} and @var{topitch}: any note
608 with pitch @var{frompitch} is changed to @var{topitch} and any
609 other note is transposed by the same interval.  Both pitches are
610 entered in absolute mode.
611
612 Consider a piece written in the key of D-major.  It can be
613 transposed up to E-major; note that the key signature is
614 automatically transposed as well.
615
616 @lilypond[verbatim,quote]
617 \transpose d e {
618   \relative c' {
619     \key d \major
620     d4 fis a d
621   }
622 }
623 @end lilypond
624
625 @cindex transposing instruments
626 @cindex instruments, transposing
627
628 If a part written in C (normal @notation{concert pitch}) is to be
629 played on the A clarinet (for which an A is notated as a C and
630 thus sounds a minor third lower than notated), the appropriate
631 part will be produced with:
632
633 @lilypond[verbatim,quote]
634 \transpose a c' {
635   \relative c' {
636     \key c \major
637     c4 d e g
638   }
639 }
640 @end lilypond
641
642 @noindent
643 Note that we specify @w{@code{\key c \major}} explicitly.  If we
644 do not specify a key signature, the notes will be transposed but
645 no key signature will be printed.
646
647 @code{\transpose} distinguishes between enharmonic pitches: both
648 @w{@code{\transpose c cis}} or @w{@code{\transpose c des}} will
649 transpose up a semitone.  The first version will print sharps and
650 the notes will remain on the same scale step, the second version
651 will print flats on the scale step above.
652
653 @lilypond[verbatim,quote]
654 music = \relative c' { c d e f }
655 \new Staff {
656   \transpose c cis { \music }
657   \transpose c des { \music }
658 }
659 @end lilypond
660
661 @cindex transposing instruments
662 @cindex instruments, transposing
663
664 @code{\transpose} may also be used in a different way, to input
665 written notes for a transposing instrument.  The previous examples
666 show how to enter pitches in C (or @notation{concert pitch}) and
667 typeset them for a transposing instrument, but the opposite is
668 also possible if you for example have a set of instrumental parts
669 and want to print a conductor's score.  For example, when entering
670 music for a B-flat trumpet that begins on a notated E (concert D),
671 one would write:
672
673 @example
674 musicInBflat = @{ e4 @dots{} @}
675 \transpose c bes, \musicInBflat
676 @end example
677
678 @noindent
679 To print this music in F (e.g., rearranging to a French horn) you
680 could wrap the existing music with another @code{\transpose}:
681
682 @example
683 musicInBflat = @{ e4 @dots{} @}
684 \transpose f c' @{ \transpose c bes, \musicInBflat @}
685 @end example
686
687 @noindent
688 For more information about transposing instruments,
689 see @ref{Instrument transpositions}.
690
691
692 @snippets
693
694 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
695 {transposing-pitches-with-minimum-accidentals-smart-transpose.ly}
696
697
698 @seealso
699
700 Notation Reference:
701 @ref{Instrument transpositions}.
702
703 Snippets:
704 @rlsr{Pitches}.
705
706 Internals Reference:
707 @rinternals{TransposedMusic}.
708
709 @funindex \transpose
710 @funindex \chordmode
711 @funindex \relative
712
713 @knownissues
714
715 The relative conversion will not affect @code{\transpose},
716 @code{\chordmode} or @code{\relative} sections in its argument.
717 To use relative mode within transposed music, an additional
718 @code{\relative} must be placed inside @code{\transpose}.
719
720
721 @node Displaying pitches
722 @subsection Displaying pitches
723
724 This section discusses how to alter the output of pitches.
725
726 @menu
727 * Clef::
728 * Key signature::
729 * Ottava brackets::
730 * Instrument transpositions::
731 * Automatic accidentals::
732 * Ambitus::
733 @end menu
734
735
736 @node Clef
737 @unnumberedsubsubsec Clef
738
739 @funindex \clef
740 @cindex G clef
741 @cindex C clef
742 @cindex F clef
743 @cindex treble clef
744 @cindex violin clef
745 @cindex alto clef
746 @cindex tenor clef
747 @cindex bass clef
748 @cindex french clef
749 @cindex soprano clef
750 @cindex mezzosoprano clef
751 @cindex baritone clef
752 @cindex varbaritone clef
753 @cindex subbass clef
754 @cindex clef
755 @cindex ancient clef
756 @cindex clef, ancient
757 @cindex clef, G
758 @cindex clef, C
759 @cindex clef, F
760 @cindex clef, treble
761 @cindex clef, violin
762 @cindex clef, alto
763 @cindex clef, tenor
764 @cindex clef, bass
765 @cindex clef, french
766 @cindex clef, soprano
767 @cindex clef, mezzosoprano
768 @cindex clef, baritone
769 @cindex clef, varbaritone
770 @cindex subbass clef, subbass
771
772 The clef may be altered.  Middle C is shown in every example.
773
774 @lilypond[verbatim,quote,relative=1]
775 \clef treble
776 c2 c
777 \clef alto
778 c2 c
779 \clef tenor
780 c2 c
781 \clef bass
782 c2 c
783 @end lilypond
784
785 Other clefs include:
786
787 @lilypond[verbatim,quote,relative=1]
788 \clef french
789 c2 c
790 \clef soprano
791 c2 c
792 \clef mezzosoprano
793 c2 c
794 \clef baritone
795 c2 c
796
797 \break
798
799 \clef varbaritone
800 c2 c
801 \clef subbass
802 c2 c
803 \clef percussion
804 c2 c
805 \clef tab
806 c2 c
807 @end lilypond
808
809 Further supported clefs are described under @ref{Mensural clefs}
810 and @ref{Gregorian clefs}.
811
812 @cindex transposing clefs
813 @cindex clef, transposing
814 @cindex octave transposition
815 @cindex choral tenor clef
816
817 By adding@tie{}@code{_8} or@tie{}@code{^8} to the clef name, the
818 clef is transposed one octave down or up, respectively,
819 and@tie{}@code{_15} and@tie{}@code{^15} transpose by two octaves.
820 The clef name must be enclosed in quotes when it contains
821 underscores or digits.
822
823 @lilypond[verbatim,quote,relative=2]
824 \clef treble
825 c2 c
826 \clef "treble_8"
827 c2 c
828 \clef "bass^15"
829 c2 c
830 @end lilypond
831
832
833 @snippets
834
835 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
836 {tweaking-clef-properties.ly}
837
838
839 @seealso
840
841 Notation Reference:
842 @ref{Mensural clefs}, @ref{Gregorian clefs}.
843
844 Snippets:
845 @rlsr{Pitches}.
846
847 Internals Reference:
848 @rinternals{Clef_engraver},
849 @rinternals{Clef},
850 @rinternals{OctavateEight},
851 @rinternals{clef-interface}.
852
853
854 @node Key signature
855 @unnumberedsubsubsec Key signature
856
857 @cindex key signature
858 @funindex \key
859
860 @c duplicated in Key signature and Accidentals
861 @warning{New users are sometimes confused about accidentals and
862 key signatures.  In LilyPond, note names are the raw input; key
863 signatures and clefs determine how this raw input is displayed.
864 An unaltered note like@tie{}@code{c} means @q{C natural},
865 regardless of the key signature or clef.  For more information,
866 see @rlearning{Accidentals and key signatures}.}
867
868 The key signature indicates the tonality in which a piece is
869 played.  It is denoted by a set of alterations (flats or sharps)
870 at the start of the staff.  The key signature may be altered:
871
872 @example
873 \key @var{pitch} @var{mode}
874 @end example
875
876 @funindex \major
877 @funindex \minor
878 @funindex \ionian
879 @funindex \locrian
880 @funindex \aeolian
881 @funindex \mixolydian
882 @funindex \lydian
883 @funindex \phrygian
884 @funindex \dorian
885 @cindex church modes
886 @cindex modes
887 @cindex major
888 @cindex minor
889 @cindex ionian
890 @cindex locrian
891 @cindex aeolian
892 @cindex mixolydian
893 @cindex lydian
894 @cindex phrygian
895 @cindex dorian
896
897 Here, @var{mode} should be @code{\major} or @code{\minor} to get a
898 key signature of @var{pitch}-major or @var{pitch}-minor,
899 respectively.  You may also use the standard mode names, also
900 called @notation{church modes}: @code{\ionian}, @code{\dorian},
901 @code{\phrygian}, @code{\lydian}, @code{\mixolydian},
902 @code{\aeolian}, and @code{\locrian}.
903
904 @lilypond[verbatim,quote,relative=2]
905 \key g \major
906 fis1
907 f
908 fis
909 @end lilypond
910
911
912 @snippets
913
914 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
915 {preventing-natural-signs-from-being-printed-when-the-key-signature-changes.ly}
916
917 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
918 {non-traditional-key-signatures.ly}
919
920
921 @seealso
922
923 Music Glossary:
924 @rglos{church mode},
925 @rglos{scordatura}.
926
927 Learning Manual:
928 @rlearning{Accidentals and key signatures}.
929
930 Snippets:
931 @rlsr{Pitches}.
932
933 Internals Reference:
934 @rinternals{KeyChangeEvent},
935 @rinternals{Key_engraver},
936 @rinternals{Key_performer},
937 @rinternals{KeyCancellation},
938 @rinternals{KeySignature},
939 @rinternals{key-cancellation-interface},
940 @rinternals{key-signature-interface}.
941
942
943 @node Ottava brackets
944 @unnumberedsubsubsec Ottava brackets
945
946 @cindex ottava
947 @cindex 15ma
948 @cindex 8va
949 @cindex 8ve
950 @cindex octavation
951 @funindex set-octavation
952
953 @notation{Ottava brackets} introduce an extra transposition of an
954 octave for the staff:
955
956 @lilypond[verbatim,quote,relative=2]
957 a'2 b
958 \ottava #1
959 a b
960 \ottava #0
961 a b
962 @end lilypond
963
964 The @code{ottava} function also takes -1 (for 8va bassa),
965 2@tie{}(for 15ma), and -2 (for 15ma bassa) as arguments.
966
967
968 @snippets
969
970 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
971 {ottava-text.ly}
972
973
974 @seealso
975
976 Music Glossary:
977 @rglos{octavation}.
978
979 Snippets:
980 @rlsr{Pitches}.
981
982 Internals Reference:
983 @rinternals{Ottava_spanner_engraver},
984 @rinternals{OttavaBracket},
985 @rinternals{ottava-bracket-interface}.
986
987
988
989 @node Instrument transpositions
990 @unnumberedsubsubsec Instrument transpositions
991
992 @cindex transposition, MIDI
993 @cindex transposition, instrument
994 @cindex transposing instrument
995 @cindex MIDI
996 @cindex MIDI transposition
997 @funindex \transposition
998
999 When typesetting scores that involve transposing instruments, some
1000 parts can be typeset in a different pitch than the
1001 @notation{concert pitch}.  In these cases, the key of the
1002 @notation{transposing instrument} should be specified; otherwise
1003 the MIDI output and cues in other parts will produce incorrect
1004 pitches.  For more information about quotations, see
1005 @ref{Quoting other voices}.
1006
1007 @example
1008 \transposition @var{pitch}
1009 @end example
1010
1011 The pitch to use for @code{\transposition} should correspond to
1012 the real sound heard when a@tie{}@code{c'} written on the staff is
1013 played by the transposing instrument.  This pitch is entered in
1014 absolute mode, so an instrument that produces a real sound which
1015 is one tone higher than the printed music should use
1016 @w{@code{\transposition d'}}.  @code{\transposition} should
1017 @emph{only} be used if the pitches are @emph{not} being entered in
1018 concert pitch.
1019
1020 Here are a few notes for violin and B-flat clarinet where the
1021 parts have been entered using the notes and key as they appear in
1022 each part of the conductor's score.  The two instruments are
1023 playing in unison.
1024
1025 @lilypond[verbatim,quote]
1026 \new GrandStaff <<
1027   \new Staff = "violin" {
1028     \relative c'' {
1029       \set Staff.instrumentName = "Vln"
1030       \set Staff.midiInstrument = "violin"
1031       % not strictly necessary, but a good reminder
1032       \transposition c'
1033
1034       \key c \major
1035       g4( c8) r c r c4
1036     }
1037   }
1038   \new Staff = "clarinet" {
1039     \relative c'' {
1040       \set Staff.instrumentName = \markup { Cl (B\flat) }
1041       \set Staff.midiInstrument = "clarinet"
1042       \transposition bes
1043
1044       \key d \major
1045       a4( d8) r d r d4
1046     }
1047   }
1048 >>
1049 @end lilypond
1050
1051 The @code{\transposition} may be changed during a piece.  For
1052 example, a clarinetist may switch from an A clarinet to a B-flat
1053 clarinet.
1054
1055 @lilypond[verbatim,quote,relative=2]
1056 \set Staff.instrumentName = "Cl (A)"
1057 \key a \major
1058 \transposition a
1059 c d e f
1060 \textLengthOn
1061 s1*0^\markup { Switch to B\flat clarinet }
1062 R1
1063
1064 \key bes \major
1065 \transposition bes
1066 c2 g
1067 @end lilypond
1068
1069
1070 @seealso
1071
1072 Music Glossary:
1073 @rglos{concert pitch},
1074 @rglos{transposing instrument}.
1075
1076 Notation Reference:
1077 @ref{Quoting other voices}, @ref{Transpose}.
1078
1079 Snippets:
1080 @rlsr{Pitches}.
1081
1082
1083 @node Automatic accidentals
1084 @unnumberedsubsubsec Automatic accidentals
1085
1086 @cindex accidental style
1087 @cindex accidental style, default
1088 @cindex accidentals
1089 @cindex accidentals, automatic
1090 @cindex automatic accidentals
1091 @cindex default accidental style
1092 @funindex set-accidental-style
1093 @funindex voice
1094
1095 There are many different conventions on how to typeset
1096 accidentals.  LilyPond provides a function to specify which
1097 accidental style to use.  This function is called as follows:
1098
1099 @example
1100 \new Staff <<
1101   #(set-accidental-style 'voice)
1102   @{ @dots{} @}
1103 >>
1104 @end example
1105
1106 The accidental style applies to the current @code{Staff} by
1107 default (with the exception of the styles @code{piano} and
1108 @code{piano-cautionary}, which are explained below).  Optionally,
1109 the function can take a second argument that determines in which
1110 scope the style should be changed.  For example, to use the same
1111 style in all staves of the current @code{StaffGroup}, use:
1112
1113 @example
1114 #(set-accidental-style 'voice 'StaffGroup)
1115 @end example
1116
1117 The following accidental styles are supported.  To demonstrate
1118 each style, we use the following example:
1119
1120 @funindex default
1121
1122 @lilypond[verbatim,quote]
1123 musicA = {
1124   <<
1125     \relative c' {
1126       cis'8 fis, d'4 <a cis>8 f bis4 |
1127       cis2. <c, g'>4 |
1128     }
1129     \\
1130     \relative c' {
1131       ais'2 cis, |
1132       fis8 b a4 cis2 |
1133     }
1134   >>
1135 }
1136
1137 musicB = {
1138   \clef bass
1139   \new Voice {
1140     \voiceTwo \relative c' {
1141       <fis, a cis>4
1142       \change Staff = up
1143       cis'
1144       \change Staff = down
1145       <fis, a>
1146       \change Staff = up
1147       dis' |
1148       \change Staff = down
1149       <fis, a cis>4 gis <f a d>2 |
1150     }
1151   }
1152 }
1153
1154 \new PianoStaff {
1155   <<
1156     \context Staff = "up" {
1157       #(set-accidental-style 'default)
1158       \musicA
1159     }
1160     \context Staff = "down" {
1161       #(set-accidental-style 'default)
1162       \musicB
1163     }
1164   >>
1165 }
1166 @end lilypond
1167
1168 Note that the last lines of this example can be replaced by the
1169 following, as long as the same accidental style should be used in
1170 both staves.
1171
1172 @example
1173 \new PianoStaff @{
1174   <<
1175     \context Staff = "up" @{
1176       %%% change the next line as desired:
1177       #(set-accidental-style 'default 'Score)
1178       \musicA
1179     @}
1180     \context Staff = "down" @{
1181       \musicB
1182     @}
1183   >>
1184 @}
1185 @end example
1186
1187
1188 @c don't use verbatim in this table.
1189 @table @code
1190 @item default
1191
1192 @cindex default accidental style
1193 @cindex accidental style, default
1194 @funindex default
1195
1196 This is the default typesetting behavior.  It corresponds to
1197 eighteenth-century common practice: accidentals are remembered to
1198 the end of the measure in which they occur and only in their own
1199 octave.  Thus, in the example below, no natural signs are printed
1200 before the@tie{}@code{b} in the second measure or the
1201 last@tie{}@code{c}:
1202
1203 @lilypond[quote]
1204 musicA = {
1205   <<
1206     \relative c' {
1207       cis'8 fis, d'4 <a cis>8 f bis4 |
1208       cis2. <c, g'>4 |
1209     }
1210     \\
1211     \relative c' {
1212       ais'2 cis, |
1213       fis8 b a4 cis2 |
1214     }
1215   >>
1216 }
1217
1218 musicB = {
1219   \clef bass
1220   \new Voice {
1221     \voiceTwo \relative c' {
1222       <fis, a cis>4
1223       \change Staff = up
1224       cis'
1225       \change Staff = down
1226       <fis, a>
1227       \change Staff = up
1228       dis' |
1229       \change Staff = down
1230       <fis, a cis>4 gis <f a d>2 |
1231     }
1232   }
1233 }
1234
1235 \new PianoStaff {
1236   <<
1237     \context Staff = "up" {
1238       #(set-accidental-style 'default)
1239       \musicA
1240     }
1241     \context Staff = "down" {
1242       #(set-accidental-style 'default)
1243       \musicB
1244     }
1245   >>
1246 }
1247 @end lilypond
1248
1249 @item voice
1250
1251 @cindex accidental style, voice
1252 @cindex voice accidental style
1253 @cindex accidental style, modern
1254 @cindex modern accidental style
1255 @cindex accidental style, modern-cautionary
1256 @cindex modern-cautionary accidental style
1257 @funindex voice
1258
1259 The normal behavior is to remember the accidentals at
1260 @code{Staff}-level.  In this style, however, accidentals are
1261 typeset individually for each voice.  Apart from that, the rule is
1262 similar to @code{default}.
1263
1264 As a result, accidentals from one voice do not get canceled in
1265 other voices, which is often an unwanted result: in the following
1266 example, it is hard to determine whether the second@tie{}@code{a}
1267 should be played natural or sharp.  The @code{voice} option should
1268 therefore be used only if the voices are to be read solely by
1269 individual musicians.  If the staff is to be used by one musician
1270 (e.g., a conductor or in a piano score) then @code{modern} or
1271 @code{modern-cautionary} should be used instead.
1272
1273
1274 @lilypond[quote]
1275 musicA = {
1276   <<
1277     \relative c' {
1278       cis'8 fis, d'4 <a cis>8 f bis4 |
1279       cis2. <c, g'>4 |
1280     }
1281     \\
1282     \relative c' {
1283       ais'2 cis, |
1284       fis8 b a4 cis2 |
1285     }
1286   >>
1287 }
1288
1289 musicB = {
1290   \clef bass
1291   \new Voice {
1292     \voiceTwo \relative c' {
1293       <fis, a cis>4
1294       \change Staff = up
1295       cis'
1296       \change Staff = down
1297       <fis, a>
1298       \change Staff = up
1299       dis' |
1300       \change Staff = down
1301       <fis, a cis>4 gis <f a d>2 |
1302     }
1303   }
1304 }
1305
1306 \new PianoStaff {
1307   <<
1308     \context Staff = "up" {
1309       #(set-accidental-style 'voice)
1310       \musicA
1311     }
1312     \context Staff = "down" {
1313       #(set-accidental-style 'voice)
1314       \musicB
1315     }
1316   >>
1317 }
1318 @end lilypond
1319
1320 @item modern
1321
1322 @cindex accidentals, modern style
1323 @cindex modern style accidentals
1324 @funindex modern
1325
1326 This rule corresponds to the common practice in the twentieth
1327 century.  It prints the same accidentals as @code{default}, with
1328 two exceptions that serve to avoid ambiguity: after temporary
1329 accidentals, cancellation marks are printed also in the following
1330 measure (for notes in the same octave) and, in the same measure,
1331 for notes in other octaves.  Hence the naturals before
1332 the@tie{}@code{b} and the@tie{}@code{c} in the second measure of
1333 the upper staff:
1334
1335 @lilypond[quote]
1336 musicA = {
1337   <<
1338     \relative c' {
1339       cis'8 fis, d'4 <a cis>8 f bis4 |
1340       cis2. <c, g'>4 |
1341     }
1342     \\
1343     \relative c' {
1344       ais'2 cis, |
1345       fis8 b a4 cis2 |
1346     }
1347   >>
1348 }
1349
1350 musicB = {
1351   \clef bass
1352   \new Voice {
1353     \voiceTwo \relative c' {
1354       <fis, a cis>4
1355       \change Staff = up
1356       cis'
1357       \change Staff = down
1358       <fis, a>
1359       \change Staff = up
1360       dis' |
1361       \change Staff = down
1362       <fis, a cis>4 gis <f a d>2 |
1363     }
1364   }
1365 }
1366
1367 \new PianoStaff {
1368   <<
1369     \context Staff = "up" {
1370       #(set-accidental-style 'modern)
1371       \musicA
1372     }
1373     \context Staff = "down" {
1374       #(set-accidental-style 'modern)
1375       \musicB
1376     }
1377   >>
1378 }
1379 @end lilypond
1380
1381 @item modern-cautionary
1382
1383 @cindex accidentals, modern cautionary style
1384 @cindex modern accidental style
1385 @cindex modern cautionary accidental style
1386 @cindex modern style accidentals
1387 @cindex modern style cautionary accidentals
1388 @funindex modern-cautionary
1389
1390 This rule is similar to @code{modern}, but the @q{extra}
1391 accidentals (the ones not typeset by @code{default}) are typeset
1392 as cautionary accidentals.  They are by default printed with
1393 parentheses, but they can also be printed in reduced size by
1394 defining the @code{cautionary-style} property of
1395 @code{AccidentalSuggestion}.
1396
1397 @lilypond[quote]
1398 musicA = {
1399   <<
1400     \relative c' {
1401       cis'8 fis, d'4 <a cis>8 f bis4 |
1402       cis2. <c, g'>4 |
1403     }
1404     \\
1405     \relative c' {
1406       ais'2 cis, |
1407       fis8 b a4 cis2 |
1408     }
1409   >>
1410 }
1411
1412 musicB = {
1413   \clef bass
1414   \new Voice {
1415     \voiceTwo \relative c' {
1416       <fis, a cis>4
1417       \change Staff = up
1418       cis'
1419       \change Staff = down
1420       <fis, a>
1421       \change Staff = up
1422       dis' |
1423       \change Staff = down
1424       <fis, a cis>4 gis <f a d>2 |
1425     }
1426   }
1427 }
1428
1429 \new PianoStaff {
1430   <<
1431     \context Staff = "up" {
1432       #(set-accidental-style 'modern-cautionary)
1433       \musicA
1434     }
1435     \context Staff = "down" {
1436       #(set-accidental-style 'modern-cautionary)
1437       \musicB
1438     }
1439   >>
1440 }
1441 @end lilypond
1442
1443 @item modern-voice
1444
1445 @cindex accidental style, modern
1446 @cindex accidentals, modern
1447 @cindex accidentals, multivoice
1448 @cindex modern accidental style
1449 @cindex modern accidentals
1450 @cindex multivoice accidentals
1451 @funindex modern-voice
1452
1453 This rule is used for multivoice accidentals to be read both by
1454 musicians playing one voice and musicians playing all voices.
1455 Accidentals are typeset for each voice, but they @emph{are}
1456 canceled across voices in the same @code{Staff}.  Hence,
1457 the@tie{}@code{a} in the last measure is canceled because the
1458 previous cancellation was in a different voice, and
1459 the@tie{}@code{d} in the lower staff is canceled because of the
1460 accidental in a different voice in the previous measure:
1461
1462 @lilypond[quote]
1463 musicA = {
1464   <<
1465     \relative c' {
1466       cis'8 fis, d'4 <a cis>8 f bis4 |
1467       cis2. <c, g'>4 |
1468     }
1469     \\
1470     \relative c' {
1471       ais'2 cis, |
1472       fis8 b a4 cis2 |
1473     }
1474   >>
1475 }
1476
1477 musicB = {
1478   \clef bass
1479   \new Voice {
1480     \voiceTwo \relative c' {
1481       <fis, a cis>4
1482       \change Staff = up
1483       cis'
1484       \change Staff = down
1485       <fis, a>
1486       \change Staff = up
1487       dis' |
1488       \change Staff = down
1489       <fis, a cis>4 gis <f a d>2 |
1490     }
1491   }
1492 }
1493
1494 \new PianoStaff {
1495   <<
1496     \context Staff = "up" {
1497       #(set-accidental-style 'modern-voice)
1498       \musicA
1499     }
1500     \context Staff = "down" {
1501       #(set-accidental-style 'modern-voice)
1502       \musicB
1503     }
1504   >>
1505 }
1506 @end lilypond
1507
1508 @cindex accidental style, cautionary, modern voice
1509 @cindex accidental style, modern voice cautionary
1510 @cindex accidental style, voice, modern cautionary
1511 @funindex modern-voice-cautionary
1512
1513 @item modern-voice-cautionary
1514
1515 This rule is the same as @code{modern-voice}, but with the extra
1516 accidentals (the ones not typeset by @code{voice}) typeset as
1517 cautionaries.  Even though all accidentals typeset by
1518 @code{default} @emph{are} typeset with this rule, some of them are
1519 typeset as cautionaries.
1520
1521 @lilypond[quote]
1522 musicA = {
1523   <<
1524     \relative c' {
1525       cis'8 fis, d'4 <a cis>8 f bis4 |
1526       cis2. <c, g'>4 |
1527     }
1528     \\
1529     \relative c' {
1530       ais'2 cis, |
1531       fis8 b a4 cis2 |
1532     }
1533   >>
1534 }
1535
1536 musicB = {
1537   \clef bass
1538   \new Voice {
1539     \voiceTwo \relative c' {
1540       <fis, a cis>4
1541       \change Staff = up
1542       cis'
1543       \change Staff = down
1544       <fis, a>
1545       \change Staff = up
1546       dis' |
1547       \change Staff = down
1548       <fis, a cis>4 gis <f a d>2 |
1549     }
1550   }
1551 }
1552
1553 \new PianoStaff {
1554   <<
1555     \context Staff = "up" {
1556       #(set-accidental-style 'modern-voice-cautionary)
1557       \musicA
1558     }
1559     \context Staff = "down" {
1560       #(set-accidental-style 'modern-voice-cautionary)
1561       \musicB
1562     }
1563   >>
1564 }
1565 @end lilypond
1566
1567 @item piano
1568
1569 @cindex accidental style, piano
1570 @cindex accidentals, piano
1571 @cindex piano accidental style
1572 @cindex piano accidentals
1573 @funindex piano
1574
1575 This rule reflects twentieth-century practice for piano notation.
1576 Its behavior is very similar to @code{modern} style, but here
1577 accidentals also get canceled across the staves in the same
1578 @code{GrandStaff} or @code{PianoStaff}, hence all the
1579 cancellations of the final notes.
1580
1581 This accidental style applies to the current @code{GrandStaff} or
1582 @code{PianoStaff} by default.
1583
1584 @lilypond[quote]
1585 musicA = {
1586   <<
1587     \relative c' {
1588       cis'8 fis, d'4 <a cis>8 f bis4 |
1589       cis2. <c, g'>4 |
1590     }
1591     \\
1592     \relative c' {
1593       ais'2 cis, |
1594       fis8 b a4 cis2 |
1595     }
1596   >>
1597 }
1598
1599 musicB = {
1600   \clef bass
1601   \new Voice {
1602     \voiceTwo \relative c' {
1603       <fis, a cis>4
1604       \change Staff = up
1605       cis'
1606       \change Staff = down
1607       <fis, a>
1608       \change Staff = up
1609       dis' |
1610       \change Staff = down
1611       <fis, a cis>4 gis <f a d>2 |
1612     }
1613   }
1614 }
1615
1616 \new PianoStaff {
1617   <<
1618     \context Staff = "up" {
1619       #(set-accidental-style 'piano)
1620       \musicA
1621     }
1622     \context Staff = "down" {
1623       \musicB
1624     }
1625   >>
1626 }
1627 @end lilypond
1628
1629 @item piano-cautionary
1630
1631 @funindex piano-cautionary
1632 @cindex accidentals, piano cautionary
1633 @cindex cautionary accidentals, piano
1634 @cindex piano cautionary accidentals
1635 @cindex accidental style, piano cautionary
1636 @cindex cautionary accidental style, piano
1637 @cindex piano cautionary accidental style
1638
1639 This is the same as @code{piano} but with the extra accidentals
1640 typeset as cautionaries.
1641
1642 @lilypond[quote]
1643 musicA = {
1644   <<
1645     \relative c' {
1646       cis'8 fis, d'4 <a cis>8 f bis4 |
1647       cis2. <c, g'>4 |
1648     }
1649     \\
1650     \relative c' {
1651       ais'2 cis, |
1652       fis8 b a4 cis2 |
1653     }
1654   >>
1655 }
1656
1657 musicB = {
1658   \clef bass
1659   \new Voice {
1660     \voiceTwo \relative c' {
1661       <fis, a cis>4
1662       \change Staff = up
1663       cis'
1664       \change Staff = down
1665       <fis, a>
1666       \change Staff = up
1667       dis' |
1668       \change Staff = down
1669       <fis, a cis>4 gis <f a d>2 |
1670     }
1671   }
1672 }
1673
1674 \new PianoStaff {
1675   <<
1676     \context Staff = "up" {
1677       #(set-accidental-style 'piano-cautionary)
1678       \musicA
1679     }
1680     \context Staff = "down" {
1681       \musicB
1682     }
1683   >>
1684 }
1685 @end lilypond
1686
1687
1688 @item neo-modern
1689
1690 @funindex neo-modern
1691 @cindex neo-modern accidental style
1692 @cindex accidental style, neo-modern
1693
1694 This rule reproduces a common practice in contemporary music:
1695 accidentals are printed like with @code{modern}, but they are printed
1696 again if the same note appears later in the same measure -- except
1697 if the note is immediately repeated.
1698
1699 @lilypond[quote]
1700 musicA = {
1701   <<
1702     \relative c' {
1703       cis'8 fis, d'4 <a cis>8 f bis4 |
1704       cis2. <c, g'>4 |
1705     }
1706     \\
1707     \relative c' {
1708       ais'2 cis, |
1709       fis8 b a4 cis2 |
1710     }
1711   >>
1712 }
1713
1714 musicB = {
1715   \clef bass
1716   \new Voice {
1717     \voiceTwo \relative c' {
1718       <fis, a cis>4
1719       \change Staff = up
1720       cis'
1721       \change Staff = down
1722       <fis, a>
1723       \change Staff = up
1724       dis' |
1725       \change Staff = down
1726       <fis, a cis>4 gis <f a d>2 |
1727     }
1728   }
1729 }
1730
1731 \new PianoStaff {
1732   <<
1733     \context Staff = "up" {
1734       #(set-accidental-style 'neo-modern)
1735       \musicA
1736     }
1737     \context Staff = "down" {
1738       #(set-accidental-style 'neo-modern)
1739       \musicB
1740     }
1741   >>
1742 }
1743 @end lilypond
1744
1745 @item neo-modern-cautionary
1746
1747 @funindex neo-modern-cautionary
1748 @cindex neo-modern-cautionary accidental style
1749 @cindex accidental style, neo-modern-cautionary
1750
1751 This rule is similar to @code{neo-modern}, but the extra
1752 accidentals are printed as cautionary accidentals.
1753
1754 @lilypond[quote]
1755 musicA = {
1756   <<
1757     \relative c' {
1758       cis'8 fis, d'4 <a cis>8 f bis4 |
1759       cis2. <c, g'>4 |
1760     }
1761     \\
1762     \relative c' {
1763       ais'2 cis, |
1764       fis8 b a4 cis2 |
1765     }
1766   >>
1767 }
1768
1769 musicB = {
1770   \clef bass
1771   \new Voice {
1772     \voiceTwo \relative c' {
1773       <fis, a cis>4
1774       \change Staff = up
1775       cis'
1776       \change Staff = down
1777       <fis, a>
1778       \change Staff = up
1779       dis' |
1780       \change Staff = down
1781       <fis, a cis>4 gis <f a d>2 |
1782     }
1783   }
1784 }
1785
1786 \new PianoStaff {
1787   <<
1788     \context Staff = "up" {
1789       #(set-accidental-style 'neo-modern-cautionary)
1790       \musicA
1791     }
1792     \context Staff = "down" {
1793       #(set-accidental-style 'neo-modern-cautionary)
1794       \musicB
1795     }
1796   >>
1797 }
1798 @end lilypond
1799
1800
1801 @item dodecaphonic
1802
1803 @funindex dodecaphonic
1804 @cindex dodecaphonic accidental style
1805 @cindex dodecaphonic style, neo-modern
1806
1807 This rule reflects a practice introduced by composers at
1808 the beginning of the 20th century, in an attempt to
1809 abolish the hierarchy between natural and non-natural notes.
1810 With this style, @emph{every} note gets an accidental sign,
1811 including natural signs.
1812
1813 @lilypond[quote]
1814 musicA = {
1815   <<
1816     \relative c' {
1817       cis'8 fis, d'4 <a cis>8 f bis4 |
1818       cis2. <c, g'>4 |
1819     }
1820     \\
1821     \relative c' {
1822       ais'2 cis, |
1823       fis8 b a4 cis2 |
1824     }
1825   >>
1826 }
1827
1828 musicB = {
1829   \clef bass
1830   \new Voice {
1831     \voiceTwo \relative c' {
1832       <fis, a cis>4
1833       \change Staff = up
1834       cis'
1835       \change Staff = down
1836       <fis, a>
1837       \change Staff = up
1838       dis' |
1839       \change Staff = down
1840       <fis, a cis>4 gis <f a d>2 |
1841     }
1842   }
1843 }
1844
1845 \new PianoStaff {
1846   <<
1847     \context Staff = "up" {
1848       #(set-accidental-style 'dodecaphonic)
1849       \musicA
1850     }
1851     \context Staff = "down" {
1852       #(set-accidental-style 'dodecaphonic)
1853       \musicB
1854     }
1855   >>
1856 }
1857 @end lilypond
1858
1859
1860 @item teaching
1861
1862 @funindex teaching
1863 @cindex teaching accidental style
1864 @cindex accidental style, teaching
1865
1866 This rule is intended for students, and makes it easy to create
1867 scale sheets with automagically created cautionary accidentals.
1868 Accidentals are printed like with @code{modern}, but cautionary
1869 accidentals are added for all sharp or flat tones specified by the
1870 key signature, except if the note is immediately repeated.
1871
1872 @lilypond[quote]
1873 musicA = {
1874   <<
1875     \relative c' {
1876       cis'8 fis, d'4 <a cis>8 f bis4 |
1877       cis2. <c, g'>4 |
1878     }
1879     \\
1880     \relative c' {
1881       ais'2 cis, |
1882       fis8 b a4 cis2 |
1883     }
1884   >>
1885 }
1886
1887 musicB = {
1888   \clef bass
1889   \new Voice {
1890     \voiceTwo \relative c' {
1891       <fis, a cis>4
1892       \change Staff = up
1893       cis'
1894       \change Staff = down
1895       <fis, a>
1896       \change Staff = up
1897       dis' |
1898       \change Staff = down
1899       <fis, a cis>4 gis <f a d>2 |
1900     }
1901   }
1902 }
1903
1904 \new PianoStaff {
1905   <<
1906     \context Staff = "up" {
1907       \key fis \minor
1908       #(set-accidental-style 'teaching)
1909       \musicA
1910     }
1911     \context Staff = "down" {
1912       \key fis \minor
1913       #(set-accidental-style 'teaching)
1914       \musicB
1915     }
1916   >>
1917 }
1918 @end lilypond
1919
1920
1921
1922 @item no-reset
1923
1924 @funindex no-reset
1925 @cindex accidental style, no reset
1926 @cindex no reset accidental style
1927
1928 This is the same as @code{default} but with accidentals lasting
1929 @q{forever} and not only within the same measure:
1930
1931 @lilypond[quote]
1932 musicA = {
1933   <<
1934     \relative c' {
1935       cis'8 fis, d'4 <a cis>8 f bis4 |
1936       cis2. <c, g'>4 |
1937     }
1938     \\
1939     \relative c' {
1940       ais'2 cis, |
1941       fis8 b a4 cis2 |
1942     }
1943   >>
1944 }
1945
1946 musicB = {
1947   \clef bass
1948   \new Voice {
1949     \voiceTwo \relative c' {
1950       <fis, a cis>4
1951       \change Staff = up
1952       cis'
1953       \change Staff = down
1954       <fis, a>
1955       \change Staff = up
1956       dis' |
1957       \change Staff = down
1958       <fis, a cis>4 gis <f a d>2 |
1959     }
1960   }
1961 }
1962
1963 \new PianoStaff {
1964   <<
1965     \context Staff = "up" {
1966       #(set-accidental-style 'no-reset)
1967       \musicA
1968     }
1969     \context Staff = "down" {
1970       #(set-accidental-style 'no-reset)
1971       \musicB
1972     }
1973   >>
1974 }
1975 @end lilypond
1976
1977 @item forget
1978
1979 @funindex forget
1980 @cindex forget accidental style
1981 @cindex accidental style, forget
1982
1983 This is the opposite of @code{no-reset}: Accidentals are not
1984 remembered at all -- and hence all accidentals are typeset
1985 relative to the key signature, regardless of what came before in
1986 the music.  Unlike @code{dodecaphonic}, this rule never prints
1987 any naturals.
1988
1989 @lilypond[quote]
1990 musicA = {
1991   <<
1992     \relative c' {
1993       cis'8 fis, d'4 <a cis>8 f bis4 |
1994       cis2. <c, g'>4 |
1995     }
1996     \\
1997     \relative c' {
1998       ais'2 cis, |
1999       fis8 b a4 cis2 |
2000     }
2001   >>
2002 }
2003
2004 musicB = {
2005   \clef bass
2006   \new Voice {
2007     \voiceTwo \relative c' {
2008       <fis, a cis>4
2009       \change Staff = up
2010       cis'
2011       \change Staff = down
2012       <fis, a>
2013       \change Staff = up
2014       dis' |
2015       \change Staff = down
2016       <fis, a cis>4 gis <f a d>2 |
2017     }
2018   }
2019 }
2020
2021 \new PianoStaff {
2022   <<
2023     \context Staff = "up" {
2024       #(set-accidental-style 'forget)
2025       \musicA
2026     }
2027     \context Staff = "down" {
2028       #(set-accidental-style 'forget)
2029       \musicB
2030     }
2031   >>
2032 }
2033 @end lilypond
2034 @end table
2035
2036 @snippets
2037
2038 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
2039 {dodecaphonic-style-accidentals-for-each-note-including-naturals.ly}
2040
2041
2042 @seealso
2043
2044 Snippets:
2045 @rlsr{Pitches}.
2046
2047 Internals Reference:
2048 @rinternals{Accidental},
2049 @rinternals{Accidental_engraver},
2050 @rinternals{GrandStaff} and
2051 @rinternals{PianoStaff},
2052 @rinternals{Staff},
2053 @rinternals{AccidentalSuggestion},
2054 @rinternals{AccidentalPlacement},
2055 @rinternals{accidental-suggestion-interface}.
2056
2057
2058 @cindex accidentals and simultaneous notes
2059 @cindex simultaneous notes and accidentals
2060 @cindex accidentals in chords
2061 @cindex chords, accidentals in
2062
2063 @knownissues
2064
2065 Simultaneous notes are considered to be entered in sequential
2066 mode.  This means that in a chord the accidentals are typeset as
2067 if the notes in the chord happen one at a time, in the order in
2068 which they appear in the input file.  This is a problem when
2069 accidentals in a chord depend on each other, which does not happen
2070 for the default accidental style.  The problem can be solved by
2071 manually inserting@tie{}@code{!} and@tie{}@code{?} for the
2072 problematic notes.
2073
2074
2075 @node Ambitus
2076 @unnumberedsubsubsec Ambitus
2077
2078 @cindex ambitus
2079 @cindex range of pitches
2080 @cindex pitch range
2081
2082 The term @notation{ambitus} (pl. ambitus) denotes a range of
2083 pitches for a given voice in a part of music.  It may also denote
2084 the pitch range that a musical instrument is capable of playing.
2085 Ambitus are printed on vocal parts so that performers can easily
2086 determine if it matches their capabilities.
2087
2088 Ambitus are denoted at the beginning of a piece near the initial
2089 clef.  The range is graphically specified by two note heads that
2090 represent the lowest and highest pitches.  Accidentals are only
2091 printed if they are not part of the key signature.
2092
2093 @lilypond[verbatim,quote]
2094 \layout {
2095   \context {
2096     \Voice
2097     \consists "Ambitus_engraver"
2098   }
2099 }
2100
2101 \relative c'' {
2102   aes c e2
2103   cis,1
2104 }
2105 @end lilypond
2106
2107
2108 @snippets
2109
2110 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
2111 {adding-ambitus-per-voice.ly}
2112
2113 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
2114 {ambitus-with-multiple-voices.ly}
2115
2116
2117 @seealso
2118
2119 Music Glossary:
2120 @rglos{ambitus}.
2121
2122 Snippets:
2123 @rlsr{Pitches}.
2124
2125 Internals Reference:
2126 @rinternals{Ambitus_engraver},
2127 @rinternals{Voice},
2128 @rinternals{Staff},
2129 @rinternals{Ambitus},
2130 @rinternals{AmbitusAccidental},
2131 @rinternals{AmbitusLine},
2132 @rinternals{AmbitusNoteHead},
2133 @rinternals{ambitus-interface}.
2134
2135
2136 @knownissues
2137
2138 There is no collision handling in the case of multiple per-voice
2139 ambitus.
2140
2141
2142 @node Note heads
2143 @subsection Note heads
2144
2145 This section suggests ways of altering note heads.
2146
2147 @menu
2148 * Special note heads::
2149 * Easy notation note heads::
2150 * Shape note heads::
2151 * Improvisation::
2152 @end menu
2153
2154 @node Special note heads
2155 @unnumberedsubsubsec Special note heads
2156
2157 @cindex note heads, special
2158 @cindex note heads, cross
2159 @cindex note heads, diamond
2160 @cindex note heads, parlato
2161 @cindex note heads, harmonic
2162 @cindex note heads, guitar
2163 @cindex special note heads
2164 @cindex cross note heads
2165 @cindex diamond note heads
2166 @cindex parlato note heads
2167 @cindex harmonic note heads
2168 @cindex guitar note heads
2169 @cindex note head styles
2170 @cindex styles, note heads
2171 @funindex cross
2172
2173 Note heads may be altered:
2174
2175 @lilypond[verbatim,quote,relative=2]
2176 c4 b a b
2177 \override NoteHead #'style = #'cross
2178 c4 b a b
2179 \revert NoteHead #'style
2180 c4 d e f
2181 @end lilypond
2182
2183 There is a shorthand for diamond shapes which can only be used
2184 inside chords:
2185
2186 @lilypond[verbatim,quote,relative=2]
2187 <c f\harmonic>2 <d a'\harmonic>4 <c g'\harmonic>
2188 @end lilypond
2189
2190 @noindent
2191 To see all note head styles, see @ref{Note head styles}.
2192
2193 @seealso
2194
2195 Snippets:
2196 @rlsr{Pitches}.
2197
2198 Notation Reference:
2199 @ref{Note head styles},
2200 @ref{Chorded notes}.
2201
2202 Internals Reference:
2203 @rinternals{note-event},
2204 @rinternals{Note_heads_engraver},
2205 @rinternals{Ledger_line_engraver},
2206 @rinternals{NoteHead},
2207 @rinternals{LedgerLineSpanner},
2208 @rinternals{note-head-interface},
2209 @rinternals{ledger-line-spanner-interface}.
2210
2211
2212 @node Easy notation note heads
2213 @unnumberedsubsubsec Easy notation note heads
2214
2215 @cindex note heads, practice
2216 @cindex practice note heads
2217 @cindex note heads, easy notation
2218 @cindex easy notation
2219 @cindex Hal Leonard
2220 @cindex beginners' music
2221 @cindex music, beginners'
2222 @cindex easy play note heads
2223 @cindex note heads, easy play
2224
2225 The @q{easy play} note head includes a note name inside the head.
2226 It is used in music for beginners.  To make the letters readable,
2227 it should be printed in a large font size.  To print with a larger
2228 font, see @ref{Setting the staff size}.
2229
2230 @lilypond[verbatim,quote]
2231 #(set-global-staff-size 26)
2232 \relative c' {
2233   \easyHeadsOn
2234   c2 e4 f
2235   g1
2236   \easyHeadsOff
2237   c,1
2238 }
2239 @end lilypond
2240
2241 @predefined
2242
2243 @funindex \easyHeadsOn
2244 @funindex \easyHeadsOff
2245 @code{\easyHeadsOn}, @code{\easyHeadsOff}
2246
2247 @seealso
2248
2249 Notation Reference:
2250 @ref{Setting the staff size}.
2251
2252 Snippets:
2253 @rlsr{Pitches}.
2254
2255 Internals Reference:
2256 @rinternals{note-event},
2257 @rinternals{Note_heads_engraver},
2258 @rinternals{NoteHead},
2259 @rinternals{note-head-interface}.
2260
2261
2262 @node Shape note heads
2263 @unnumberedsubsubsec Shape note heads
2264
2265 @cindex note heads, shape
2266 @cindex note heads, Aiken
2267 @cindex note heads, sacred harp
2268 @cindex shape notes
2269 @cindex Aiken shape note heads
2270 @cindex sacred harp note heads
2271 @funindex \key
2272 @funindex \aikenHeads
2273 @funindex \sacredHarpHeads
2274
2275 In shape note head notation, the shape of the note head
2276 corresponds to the harmonic function of a note in the scale.  This
2277 notation was popular in nineteenth-century American song books.
2278 Shape note heads can be produced:
2279
2280 @lilypond[verbatim,quote,relative=2]
2281 \aikenHeads
2282 c, d e f g a b c
2283 \sacredHarpHeads
2284 c, d e f g a b c
2285 @end lilypond
2286
2287 Shapes are typeset according to the step in the scale, where the
2288 base of the scale is determined by the @code{\key} command.
2289
2290 @predefined
2291
2292 @funindex \aikenHeads
2293 @funindex \sacredHarpHeads
2294 @code{\aikenHeads}, @code{\sacredHarpHeads}
2295
2296 @snippets
2297
2298 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
2299 {applying-note-head-styles-depending-on-the-step-of-the-scale.ly}
2300
2301 @noindent
2302 To see all note head styles, see @ref{Note head styles}.
2303
2304 @seealso
2305
2306 Snippets:
2307 @rlsr{Pitches}.
2308
2309 Notation Reference:
2310 @ref{Note head styles}.
2311
2312 Internals Reference:
2313 @rinternals{note-event},
2314 @rinternals{Note_heads_engraver},
2315 @rinternals{NoteHead},
2316 @rinternals{note-head-interface}.
2317
2318
2319 @node Improvisation
2320 @unnumberedsubsubsec Improvisation
2321
2322 @cindex improvisation
2323 @cindex slashed note heads
2324 @cindex note heads, improvisation
2325 @cindex note heads, slashed
2326
2327 Improvisation is sometimes denoted with slashed note heads, where
2328 the performer may choose any pitch but should play the specified
2329 rhythm.  Such note heads can be created:
2330
2331 @lilypond[verbatim,quote,relative=2]
2332 \new Voice \with {
2333   \consists "Pitch_squash_engraver"
2334 } {
2335   e8 e g a a16( bes) a8 g
2336   \improvisationOn
2337   e8 ~
2338   e2 ~ e8 f4 f8 ~
2339   f2
2340   \improvisationOff
2341   a16( bes) a8 g e
2342 }
2343 @end lilypond
2344
2345
2346 @predefined
2347
2348 @funindex \improvisationOn
2349 @funindex \improvisationOff
2350
2351 @code{\improvisationOn}, @code{\improvisationOff}
2352
2353 @seealso
2354
2355 Snippets:
2356 @rlsr{Pitches}.
2357
2358 Internals Reference:
2359 @rinternals{Pitch_squash_engraver},
2360 @rinternals{Voice},
2361 @rinternals{RhythmicStaff}.
2362
2363