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