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