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