]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/user/pitches.itely
Formatting fixes in accordance with doc policy.
[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
10 @node Pitches
11 @section Pitches
12
13 @lilypondfile[quote,ragged-right,line-width=16\cm,staffsize=16]
14 {pitches-headword.ly}
15
16 This section discusses how to specify the pitch of notes.  There
17 are three steps to this process: input, modifying, and output.
18
19 @menu
20 * Writing pitches::
21 * Changing multiple pitches::
22 * Displaying pitches::
23 * Note heads::
24 @end menu
25
26
27 @node Writing pitches
28 @subsection Writing pitches
29
30 This section discusses how to input pitches.
31
32 @menu
33 * Absolute octave entry::
34 * Relative octave entry::
35 * Accidentals::
36 * Note names in other languages::
37 @end menu
38
39
40 @node Absolute octave entry
41 @unnumberedsubsubsec Absolute octave entry
42
43 @cindex pitch names
44 @cindex pitches
45
46 A pitch name is specified using lowercase letters@tie{}@code{a}
47 through@tie{}@code{g}.  An ascending C-major scale is engraved
48 with
49
50 @lilypond[verbatim,quote,ragged-right,fragment]
51 \clef bass
52 c d e f g a b c'
53 @end lilypond
54
55 @cindex absolute
56 @cindex absolute octave specification
57
58 There are two different ways to enter these note names with regard
59 to octave placement: absolute and relative.  The relative mode
60 will in most cases be the most convenient, but the absolute mode
61 is more fundamental and will be presented first.  In absolute
62 mode, every note is placed explicitly in a specific octave.  The
63 note names @code{c} to @code{b} are engraved in the octave below
64 middle C, as in the previous example.
65
66 @lilypond[verbatim,quote,ragged-right,fragment]
67 \clef treble
68 c1
69 \clef bass
70 c1
71 @end lilypond
72
73 @funindex '
74 @funindex ,
75
76 If a note should be in another octave than this, an octave
77 specification must be given.  It takes the form of a series of
78 single quote@tie{}(@code{'}) or comma@tie{}(@code{,}) characters.
79 Each@tie{}@code{'} raises the pitch by one octave;
80 each@tie{}@code{,} lowers the pitch by an octave.
81
82 @lilypond[verbatim,quote,ragged-right,fragment]
83 \clef treble
84 c' c'' e' g d'' d' d c
85 \clef bass
86 c, c,, e, g d,, d, d c
87 @end lilypond
88
89 @seealso
90
91 Snippets: @lsrdir{Pitches}.
92
93 Internals Reference: @internalsref{LedgerLineSpanner},
94 @internalsref{NoteHead}.
95
96
97 @node Relative octave entry
98 @unnumberedsubsubsec Relative octave entry
99
100 @cindex relative
101 @cindex relative octave specification
102 @funindex \relative
103
104 The absolute mode requires a lot of octave specifications, which
105 not only becomes tedious but also easily leads to errors.
106 Therefore, it is usually more convenient to let notes be entered
107 relative to the previous note.  This is done with the relative
108 mode.
109
110 @example
111 \relative @var{startpitch} @var{musicexpr}
112 @end example
113
114 In relative mode, each note is assumed to be as close to the
115 previous note as possible.  This means that the octave of pitches
116 in @var{musicexpr} is calculated as follows:
117
118 @itemize
119 @item
120 The pitch of the first note is relative to @code{@var{startpitch}}.
121
122 @item
123 If no octave changing mark is used on a pitch, its octave is calculated
124 so that the interval with the previous note is a fourth or less.  This
125 interval is determined without regarding alterations or the actual
126 sounding pitches, it is determined only with note names.  For example,
127 an augmented fourth is considered a @emph{smaller} interval than a
128 diminished fifth, even though these intervals both span six semitones.
129 Even @qq{worse}, a doubly-augmented fourth is considered a smaller
130 interval than a diminished fifth, even though the doubly-augmented
131 fourth spans seven semitones while the diminished fifth only spans six
132 semitones; that is why a B-sharp following an F will be put above
133 the F.
134
135 @item
136 An octave changing mark@tie{}@code{'} or@tie{}@code{,} can be added to
137 respectively raise or lower a pitch by an extra octave, relatively to
138 the pitch calculated without octave mark.
139
140 @item
141 Multiple octave changing marks can be used.  @code{''}@tie{}will
142 raise the pitch by two octaves.
143
144 @end itemize
145
146 Here is the relative mode shown in action:
147
148 @lilypond[verbatim,quote,ragged-right,fragment]
149 \relative c'' {
150   b c d c b c bes a
151 }
152 @end lilypond
153
154 Octave changing marks are used for intervals greater than a
155 fourth:
156
157 @lilypond[verbatim,quote,ragged-right,fragment]
158 \relative c'' {
159   c g c f, c' a, e''
160 }
161 @end lilypond
162
163 A note sequence without a single octave mark can nevertheless span
164 large intervals:
165
166 @lilypond[verbatim,quote,ragged-right,fragment]
167 \relative c {
168   c f b e a d g
169 }
170 @end lilypond
171
172 If the preceding item is a chord, the first note of the chord is
173 used as the reference point for the octave placement of a
174 following note or chord.  Inside of chords the next note is always
175 relative to the preceding one.
176
177 @lilypond[verbatim,quote,ragged-right,fragment]
178 \relative c' {
179   c <c e g>
180   <c' e, g'>
181   <c, e' g> c
182 }
183 @end lilypond
184
185 The @var{startpitch} (after @code{\relative}) is a note name in
186 absolute mode.  In principle it can be any note name, but common
187 practice is to use@tie{}@code{c} in various octave positions or the
188 first note of @var{musicexpr}.
189
190 When octaves are specified as above by adding@tie{}@code{'}
191 and@tie{}@code{,} to pitch names, it is easy to accidentally put a
192 pitch in the wrong octave.  The relative octave mode prevents
193 these errors since most of the time it is not necessary to
194 indicate any octaves at all.  Furthermore, in absolute mode, a
195 single mistake may be difficult to spot; in relative mode, a
196 single error puts the rest of the piece off by one octave.
197
198 As explained above, the octave of pitches is calculated only with the
199 note names, regardless of any alterations. Therefore, an F-sharp
200 following a C will be placed higher than the C, while a G-flat following
201 a C will be placed lower than the C.
202
203 @lilypond[verbatim,quote,ragged-right,fragment,relative=2]
204 c2 fis
205 c2 ges
206 @end lilypond
207
208 @seealso
209
210 Snippets: @lsrdir{Pitches}.
211
212
213 @refbugs
214
215 The relative conversion will not affect @code{\transpose},
216 @code{\chordmode} or @code{\relative} sections in its argument.
217 To use relative within transposed music, an additional
218 @code{\relative} must be placed inside @code{\transpose}.
219
220 @c DEPRECATED
221 If no @var{startpitch} is specified for @code{\relative},
222 then@tie{}@code{c'} is assumed.  However, this is a deprecated
223 option and may disappear in future versions, so its use is
224 discouraged.
225
226
227
228 @node Accidentals
229 @unnumberedsubsubsec Accidentals
230
231 @warning{New users are sometimes confused about accidentals and
232 key signatures.  In LilyPond, note names are the raw input; key
233 signatures and clefs determine how this raw input is displayed.
234 An unaltered note like@tie{}@code{c} means @q{C natural},
235 regardless of the key signature or clef.  For more information,
236 see @rlearning{Accidentals and key signatures}.}
237
238 @cindex note names, Dutch
239 @cindex note names, default
240
241 A @notation{sharp} pitch is made by adding @code{is} to the name,
242 and a @notation{flat} pitch by adding @code{es}.  As you might
243 expect, a @notation{double sharp} or @notation{double flat} is
244 made by adding @code{isis} or @code{eses}.  This syntax is derived
245 from note naming conventions in Nordic and Germanic languages,
246 like German and Dutch.  To use other names for accidentals, see
247 @ref{Note names in other languages}.
248
249 @lilypond[verbatim,quote,ragged-right,fragment,relative=2]
250 a2 ais a aes
251 a2 aisis a aeses
252 @end lilypond
253
254 @noindent
255 The above notes are the Dutch note names.  In Dutch, @code{aes} is
256 contracted to @code{as}, but both forms are accepted in LilyPond.
257 Similarly, both @code{es} and @code{ees} are accepted:
258
259 @lilypond[verbatim,quote,ragged-right,fragment,relative=2]
260 a2 as e es
261 @end lilypond
262
263 A natural will cancel the effect of an accidental or key
264 signature.  However, naturals are not encoded into the note name
265 syntax with a suffix; a natural pitch is shown as a simple note
266 name:
267
268 @lilypond[verbatim,quote,ragged-right,fragment,relative=2]
269 a4 aes a2
270 @end lilypond
271
272
273 @cindex accidental, reminder
274 @cindex accidental, cautionary
275 @cindex accidental, parenthesized
276 @cindex reminder accidental
277 @funindex ?
278 @cindex cautionary accidental
279 @cindex parenthesized accidental
280 @funindex !
281
282 Normally accidentals are printed automatically, but you may also
283 print them manually.  A reminder accidental can be forced by
284 adding an exclamation mark@tie{}@code{!} after the pitch.  A
285 cautionary accidental (i.e., an accidental within parentheses) can
286 be obtained by adding the question mark@tie{}@code{?} after the
287 pitch.  These extra accidentals can be used to produce natural
288 signs, too.
289
290 @lilypond[verbatim,quote,ragged-right,fragment,relative=1]
291 cis cis cis! cis? c c? c! c
292 @end lilypond
293
294
295 @cindex quarter tones
296 @cindex semi-flats, semi-sharps
297
298 Half-flats and half-sharps are formed by adding @code{eh} and
299 @code{ih}; the following is a series of Cs with increasing
300 pitches
301
302 @lilypond[verbatim,quote,ragged-right,fragment,relative=2]
303 \set Staff.extraNatural = ##f
304 ceseh ces ceh c cih cis cisih
305 @end lilypond
306
307
308 @commonprop
309
310 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc]
311 {preventing-extra-naturals-from-being-automatically-added.ly}
312
313 @seealso
314
315 Music Glossary: @rglos{sharp}, @rglos{flat}, @rglos{double sharp},
316 @rglos{double flat}.
317
318 Learning Manual: @rlearning{Accidentals and key signatures}.
319
320 Notation Reference: @ref{Automatic accidentals},
321 @ref{Musica ficta accidentals},
322 @ref{Note names in other languages}.
323
324 Snippets: @lsrdir{Pitches},
325 @lsr{Pitches,
326 dodecaphonic-style-accidentals-for-each-note-including-naturals.ly},
327 @lsr{Pitches, makam.ly}.
328
329
330
331 @refbugs
332
333 There are no generally accepted standards for denoting
334 three-quarter flats, so LilyPond's symbol does not conform to any
335 standard.
336
337
338
339 @node Note names in other languages
340 @unnumberedsubsubsec Note names in other languages
341
342 There are predefined sets of note names for various other
343 languages.  To use them, include the language specific init file.
344 For example, add @code{\include "english.ly"} to the top of the
345 input file.  The available language files and the note names they
346 define are:
347
348 @cindex note names, other languages
349
350 @example
351 @multitable @columnfractions .2 .6 .05 .05 .05 .05
352 @headitem Language
353   @tab Note names
354   @tab sharp @tab flat @tab double sharp @tab double flat
355 @item nederlands.ly
356   @tab c d e f g a bes b
357   @tab -is @tab -es @tab -isis @tab -eses
358 @item english.ly
359   @tab c d e f g a bf b
360   @tab -s/-sharp @tab -f/-flat @tab -ss/-x/-sharpsharp
361     @tab -ff/-flatflat
362 @item deutsch.ly
363   @tab c d e f g a b h
364   @tab -is @tab -es @tab -isis @tab -eses
365 @item norsk.ly
366   @tab c d e f g a b h
367   @tab -iss/-is @tab -ess/-es @tab -ississ/-isis
368     @tab -essess/-eses
369 @item svenska.ly
370   @tab c d e f g a b h
371   @tab -iss @tab -ess @tab -ississ @tab -essess
372 @item suomi.ly
373   @tab c d e f g a b h
374   @tab -is @tab -es @tab -isis @tab -eses
375 @item italiano.ly
376   @tab do re mi fa sol la sib si
377   @tab -d @tab -b @tab -dd @tab -bb
378 @item catalan.ly
379   @tab do re mi fa sol la sib si
380   @tab -d/-s @tab -b @tab -dd/-ss @tab -bb
381 @item espanol.ly
382   @tab do re mi fa sol la sib si
383   @tab -s @tab -b @tab -ss @tab -bb
384 @item portugues.ly
385   @tab do re mi fa sol la sib si
386   @tab -s @tab -b @tab -ss @tab -bb
387 @item vlaams.ly
388   @tab do re mi fa sol la sib si
389   @tab -k @tab -b @tab -kk @tab -bb
390 @end multitable
391 @end example
392
393 @noindent
394 Note that in Dutch, German, Norwegian, and Swedish, the flat
395 alterations of@tie{}@code{a} like for example @code{aes} and
396 @code{aeses} are usually contracted to @code{as} and @code{ases}
397 (or more commonly @code{asas}).  Sometimes only these contracted
398 names are defined in the corresponding language files (this also
399 applies to the suffixes for quartertones below).
400
401 @noindent
402 Some music uses microtones whose alterations are fractions of a
403 @q{normal} sharp or flat.  The note names for quartertones defined
404 in the various language files are listed in the following table.
405 Here the prefixes @q{semi-} and @q{sesqui-} mean @q{half} and
406 @q{one and a half}, respectively.  For the other languages no
407 special names have been defined yet.
408
409
410 @example
411 @multitable @columnfractions .2 .6 .05 .05 .05 .05
412 @headitem Language
413   @tab Note names
414   @tab semi- @tab semi- @tab sesqui- @tab sesqui-
415
416 @item nederlands.ly
417   @tab c d e f g a bes b
418   @tab -ih @tab -eh @tab -isih @tab -eseh
419 @item english.ly
420   @tab c d e f g a bf b
421   @tab -qs @tab -qf @tab -tqs @tab -tqf
422 @item deutsch.ly
423   @tab c d e f g a b h
424   @tab -ih @tab -eh @tab -isih @tab -eseh
425 @c @item norsk.ly
426 @c   @tab c d e f g a b h
427 @c @item svenska.ly
428 @c   @tab c d e f g a b h
429 @item italiano.ly
430   @tab do re mi fa sol la sib si
431   @tab -sd @tab -sb @tab -dsd @tab -bsb
432 @c @item catalan.ly
433 @c   @tab do re mi fa sol la sib si
434 @c @item  espanol.ly
435 @c   @tab do re mi fa sol la sib si
436 @item portugues.ly
437   @tab do re mi fa sol la sib si
438   @tab -sqt @tab -bqt @tab -stqt @tab -btqt
439 @end multitable
440 @end example
441
442 @seealso
443
444 Snippets: @lsrdir{Pitches}.
445
446
447 @node Changing multiple pitches
448 @subsection Changing multiple pitches
449
450 This section discusses how to modify pitches.
451
452 @menu
453 * Octave check::
454 * Transpose::
455 @end menu
456
457 @node Octave check
458 @unnumberedsubsubsec Octave check
459
460 @cindex octave check
461
462 In relative mode, it is easy to forget an octave changing mark.
463 Octave checks make such errors easier to correct.  A note may be
464 followed by @code{=}@var{quotes} to indicate what its absolute
465 octave should be.  In the following example,
466
467 @example
468 \relative c'' @{ c g d='' @}
469 @end example
470
471 @noindent
472 the@tie{}@code{d} will generate a warning, because
473 a@tie{}@code{d''} is expected, as indicated by the octave check
474 @code{=''}, but a@tie{}@code{d'} is found, since both
475 @code{c}-@code{g} and @code{g}-@code{d} without octavation marks
476 are descending fourths.  In the output, the octave is corrected to
477 be a@tie{}@code{d''} and the next note is calculated relative
478 to@tie{}@code{d''} instead of@tie{}@code{d'}.
479
480 There is also an octave check that produces no visible output.
481 The syntax is:
482
483 @example
484 @var{pitch} \octave @var{controlpitch}
485 @end example
486
487 @noindent
488 where @var{pitch} is a regular note within a music expression in
489 relative mode and @var{controlpitch} is a pitch in absolute mode.
490 This checks that @var{pitch} lies within the octave surrounding
491 @var{controlpitch}, i.e. not more than a fourth above or below it.
492 If this is not the case, a warning is printed and the octave is
493 corrected.  The @var{controlpitch} is not printed as a note.
494
495 In the example below, the first check passes without incident,
496 since the@tie{}@code{e} (in @code{relative} mode) is within the
497 octave range of@tie{}@code{a'}.  However, the second check
498 produces a warning, since the@tie{}@code{e} is not within the
499 octave range of@tie{}@code{b'}.  The warning message is printed,
500 and the octave is adjusted so that the following notes are in the
501 correct octave once again.
502
503 @example
504 \relative c' @{
505   e
506   \octave a'
507   \octave b'
508 @}
509 @end example
510
511
512 The octave of a note following an @code{\octave} check is
513 determined with respect to the note preceding it, as modified by
514 the outcome of the octave check.  In the next fragment, the first
515 note, an@tie{}@code{e'}, lies within the octave of@tie{}@code{b},
516 and the @code{\octave} check passes successfully.  The second note
517 is then calculated relative to (absolute)@tie{}@code{e'}, which
518 yields an@tie{}@code{a'}, above middle@tie{}C.  In this case, the
519 check had no influence on the output of the piece.
520
521 The second @code{\octave} check fails: @code{a'}@tie{}is not
522 within the range of@tie{}@code{b}.  A warning is issued, and the
523 last note is calculated relative to@tie{}@code{a}, not
524 to@tie{}@code{a'}, and we get a@tie{}@code{d'}.  Without the last
525 @code{\octave} check, the last note would have been
526 a@tie{}@code{d''}.
527
528 @lilypond[verbatim,quote,ragged-right,fragment]
529 \relative c' {
530   e
531   \octave b
532   a
533   \octave b
534   d
535 }
536 @end lilypond
537
538 @seealso
539
540 Snippets: @lsrdir{Pitches}.
541
542
543 @node Transpose
544 @unnumberedsubsubsec Transpose
545
546 @cindex transpose
547 @cindex transposition of pitches
548 @cindex transposing instruments
549 @funindex \transpose
550
551 A music expression can be transposed with @code{\transpose}.  The
552 syntax is
553
554 @example
555 \transpose @var{from} @var{to} @var{musicexpr}
556 @end example
557
558 @noindent
559 This means that @var{musicexpr} is transposed by the interval
560 between the pitches @var{from} and @var{to}: any note with pitch
561 @var{from} is changed to @var{to} and any other note is transposed
562 by the same interval.
563
564 Consider a piece written in the key of D-major.  If this piece is
565 a little too low for its performer, it can be transposed up to
566 E-major with:
567
568 @example
569 \transpose d e @dots{}
570 @end example
571
572 Consider a part written for violin (a C instrument).  If this part is to
573 be played on the A clarinet (for which an A is notated as a C, and thus
574 sounds a minor third lower than notated), the appropriate part will be
575 produces with:
576
577 @example
578 \transpose a c' @dots{}
579 @end example
580
581 @code{\transpose} will also transpose key signatures:
582
583 @lilypond[verbatim,quote,ragged-right]
584 mus = { \key d \major cis d fis g }
585 \new Staff {
586   \clef "F" \mus
587   \clef "G"
588   \transpose c g' \mus
589   \transpose c f' \mus
590 }
591 @end lilypond
592
593 @code{\transpose} distinguishes between enharmonic pitches: both
594 @code{\transpose c cis} or @code{\transpose c des} will transpose
595 up half a tone.  The first version will print sharps and the notes
596 will remain on the same scale step, the second version will print
597 flats on the scale step above.
598
599 @lilypond[verbatim,quote,ragged-right]
600 mus = \relative c' { c d e f }
601 \new Staff {
602   \transpose c cis { \mus }
603   \transpose c des { \mus }
604 }
605 @end lilypond
606
607 @code{\transpose} may also be used to input written notes for a
608 transposing instrument.  The previous examples show how to enter
609 pitches in C (or @notation{concert pitch}) and typeset them for a
610 transposing instrument, but the opposite is also possible if you
611 for example have a set of instrumental parts and want to print a
612 conductor's score.  For example, when entering music for a B-flat
613 trumpet which begins on a notated E (concert D), one would write:
614
615 @example
616 musicInBflat = @{ e4 @dots{} @}
617 \transpose c bes, \musicInBflat
618 @end example
619
620 To print this music in F (e.g., rearranging to a French horn) you
621 would wrap the existing music with another @code{\transpose}:
622
623 @example
624 musicInBflat = @{ e4 @dots{} @}
625 \transpose f c' @{ \transpose c bes, \musicInBflat @}
626 @end example
627
628 @commonprop
629
630 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc]
631 {transposing-pitches-with-minimum-accidentals-smart-transpose.ly}
632
633
634 @seealso
635
636 Snippets: @lsrdir{Pitches}.
637
638 Internals Reference: @internalsref{TransposedMusic}.
639
640 @refbugs
641
642 If you want to use both @code{\transpose} and @code{\relative},
643 you must put @code{\transpose} outside of @code{\relative}, since
644 @code{\relative} will have no effect on music that appears inside
645 a @code{\transpose}.  See the previous example.
646
647
648 @node Displaying pitches
649 @subsection Displaying pitches
650
651 This section discusses how to alter the output of pitches.
652
653 @menu
654 * Clef::
655 * Key signature::
656 * Ottava brackets::
657 * Instrument transpositions::
658 * Automatic accidentals::
659 * Ambitus::
660 @end menu
661
662 @node Clef
663 @unnumberedsubsubsec Clef
664
665 @funindex \clef
666
667 @cindex G clef
668 @cindex C clef
669 @cindex F clef
670 @cindex treble clef
671 @cindex violin clef
672 @cindex alto clef
673 @cindex tenor clef
674 @cindex bass clef
675 @cindex french clef
676 @cindex soprano clef
677 @cindex mezzosoprano clef
678 @cindex baritone clef
679 @cindex varbaritone clef
680 @cindex subbass clef
681
682 The clef is set with the @code{\clef} @var{clefname} command:
683
684 @lilypond[verbatim,quote,ragged-right,fragment,relative=1]
685 \clef treble
686 c2 c
687 \clef alto
688 c2 c
689 \clef tenor
690 c2 c
691 \clef bass
692 c2 c
693 @end lilypond
694
695 The clef can also be changed inside the staff:
696
697 @lilypond[verbatim,quote,ragged-right,fragment]
698 \new PianoStaff <<
699   \new Staff {
700     \time 2/4
701     \clef treble
702     r16
703     \clef bass
704     e g c' e' e g c'
705   }
706   \new Staff {
707     \clef bass
708     c,8 r
709     \clef treble
710     g''4
711   }
712 >>
713 @end lilypond
714
715 These same clef symbols are used in different positions on the staff to
716 change the range of notes shown by that staff.  The treble (respectively
717 alto, bass) clef is always positioned to show the line on which
718 a@tie{}@code{g'} (resp. @code{c'}, @code{f}) note is printed.
719
720 Supported clefs include
721
722 @multitable @columnfractions .4 .6
723 @headitem Clef @tab Position
724 @item @code{treble, violin, G, G2} @tab
725 G clef (g') on 2nd line
726 @item @code{alto, C} @tab
727 C clef (c') on 3rd line
728 @item @code{tenor} @tab
729 C clef (c') on 4th line
730 @item @code{bass, F} @tab
731 F clef (f) on 4th line
732 @item @code{french} @tab
733 G clef (g') on 1st line, so-called French violin clef
734 @item @code{soprano} @tab
735 C clef (c') on 1st line
736 @item @code{mezzosoprano} @tab
737 C clef (c') on 2nd line
738 @item @code{baritone} @tab
739 C clef (c') on 5th line
740 @item @code{varbaritone} @tab
741 F clef (f) on 3rd line
742 @item @code{subbass} @tab
743 F clef (f) on 5th line
744 @item @code{percussion} @tab
745 percussion clef
746 @item @code{tab} @tab
747 tablature clef
748 @end multitable
749
750 Further supported clefs are described under @ref{Ancient clefs}.
751
752 By adding @code{_8} or @code{^8} to the clef name, the clef is
753 transposed one octave down or up, respectively, and @code{_15} and
754 @code{^15} transposes by two octaves.  The argument @var{clefname}
755 must be enclosed in quotes when it contains underscores or digits.
756 For example,
757
758 @cindex choral tenor clef
759
760 @lilypond[verbatim,quote,ragged-right,fragment,relative=1]
761 \clef "G_8" c4
762 @end lilypond
763
764
765 @commonprop
766
767 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc]
768 {clefs-commonly-tweaked-properties.ly}
769
770
771 @seealso
772
773 Notation Reference: @ref{Ancient clefs}.
774
775 Snippets: @lsrdir{Pitches}.
776
777 Internals Reference: @internalsref{Clef}.
778
779
780 @node Key signature
781 @unnumberedsubsubsec Key signature
782
783 @cindex key signature
784 @funindex \key
785
786 @warning{New users are sometimes confused about accidentals and
787 key signatures.  In LilyPond, note names are the raw input; key
788 signatures and clefs determine how this raw input is displayed.
789 An unaltered note like@tie{}@code{c} means @q{C natural},
790 regardless of the key signature or clef.  For more information,
791 see @rlearning{Accidentals and key signatures}.}
792
793 The key signature indicates the tonality in which a piece is
794 played.  It is denoted by a set of alterations (flats or sharps)
795 at the start of the staff.
796
797 Setting or changing the key signature is done with the @code{\key}
798 command:
799
800 @example
801 \key @var{pitch} @var{mode}
802 @end example
803
804 @funindex \minor
805 @funindex \major
806 @funindex \minor
807 @funindex \ionian
808 @funindex \locrian
809 @funindex \aeolian
810 @funindex \mixolydian
811 @funindex \lydian
812 @funindex \phrygian
813 @funindex \dorian
814 @cindex church modes
815
816 Here, @var{mode} should be @code{\major} or @code{\minor} to get
817 @var{pitch}-major or @var{pitch}-minor, respectively.  You may
818 also use the standard mode names, also called @q{church modes}:
819 @code{\ionian}, @code{\locrian}, @code{\aeolian},
820 @code{\mixolydian}, @code{\lydian}, @code{\phrygian}, and
821 @code{\dorian}.
822
823 @lilypond[verbatim,quote,ragged-right,fragment,relative=2]
824 \key g \major
825 f1
826 fis
827 @end lilypond
828
829
830 @commonprop
831
832 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc]
833 {preventing-natural-signs-from-being-printed-when-the-key-signature-changes.ly}
834
835 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc]
836 {non-traditional-key-signatures.ly}
837
838
839 @seealso
840
841 Music Glossary: @rglos{church mode}, @rglos{scordatura}.
842
843 Learning Manual: @rlearning{Accidentals and key signatures}.
844
845 Snippets: @lsrdir{Pitches}.
846
847 Internals Reference: @internalsref{KeyCancellation},
848 @internalsref{KeySignature}, @internalsref{Key_engraver}.
849
850
851 @node Ottava brackets
852 @unnumberedsubsubsec Ottava brackets
853
854 @cindex ottava
855 @cindex 15ma
856 @cindex 8va
857 @cindex 8ve
858 @cindex octavation
859
860 @notation{Ottava brackets} introduce an extra transposition of an
861 octave for the staff:
862
863 @lilypond[verbatim,quote,ragged-right,fragment,relative=2]
864 a'2 b
865 #(set-octavation 1)
866 a b
867 #(set-octavation 0)
868 a b
869 @end lilypond
870
871 The @code{set-octavation} function also takes -1 (for 8va bassa),
872 2@tie{}(for 15ma), and -2 (for 15ma bassa) as arguments.
873 Internally the function sets the properties @code{ottavation}
874 (e.g., to @code{"8va"} or @code{"8vb"}) and
875 @code{middleCPosition}.  To override the text of the bracket, set
876 @code{ottavation} after invoking @code{set-octavation}, i.e.,
877
878 @lilypond[verbatim,quote,ragged-right,fragment,relative=2]
879 #(set-octavation 1)
880 \set Staff.ottavation = #"8"
881 c'
882 @end lilypond
883
884
885 @seealso
886
887 Music Glossary: @rglos{ottava}.
888
889 Snippets: @lsrdir{Pitches}.
890
891 Internals Reference: @internalsref{OttavaBracket}.
892
893
894 @refbugs
895
896 @code{set-octavation} will get confused when clef changes happen
897 during an octavation bracket.
898
899
900 @node Instrument transpositions
901 @unnumberedsubsubsec Instrument transpositions
902
903 @cindex transposition, MIDI
904 @cindex transposition, instrument
905
906 The key of a @notation{transposing instrument} can be specified.
907 This applies to many wind instruments, for example, clarinets
908 (B-flat, A, and E-flat), horn (F) and trumpet (B-flat, C, D, and
909 E-flat).
910
911 The transposition is entered with the command
912
913 @example
914 \transposition @var{pitch}
915 @end example
916
917 @noindent
918 where @var{pitch} specifies the key in which the instrument plays.
919 For example, a part for B-flat clarinet would include
920
921 @example
922 \transposition bes
923 @end example
924
925 This command sets the property @code{instrumentTransposition}.
926 The value of this property is used for MIDI output and quotations.
927 MIDI output is transposed to play at concert pitch, and cue notes
928 and quotations are automatically transposed to the key of the
929 instrument in which they are quoted.  For more information about
930 quotations, see @ref{Quoting other voices}.
931
932 The pitch to use for @code{\transposition} should correspond to
933 the real sound heard when a@tie{}@code{c'} written on the staff is
934 played by the transposing instrument.  @code{\transposition}
935 should be used when the music is entered from an orchestral part
936 written for the instrument.  For example, in classical horn parts,
937 the tuning of the instrument is often changed during a piece.
938 Here are a few notes for a violin and a B-flat clarinet where the
939 parts have been entered using the notes and key as they appear in
940 each part or the conductor's score:
941
942 @lilypond[verbatim,quote,ragged-right]
943 \new GrandStaff <<
944   \new Staff = "Violin I" {
945     \set Staff.instrumentName = "Vln"
946     \set Staff.midiInstrument="violin"
947     \key c \major
948     \transposition c
949     g'4( c''8) r c'' r c''4
950   }
951   \new Staff = "Clarinet" {
952     \set Staff.instrumentName = "Cl"
953     \set Staff.midiInstrument="clarinet"
954     \key d \major
955     \transposition bes
956     a'4( d''8) r d'' r d''4
957   }
958 >>
959 @end lilypond
960
961 Without the @code{\transposition} command the MIDI output of this
962 music would play the notes a tone apart; with it the notes are
963 played correctly in unison.
964
965 However, when entering the notes of a score in concert pitch, when
966 all voices are entered in C, they may be prefaced by (the default)
967 @code{\transposition c'}:
968
969 @example
970 clarinet = @{
971   \transposition c'
972   ...
973 @}
974 saxophone = @{
975   \transposition c'
976   ...
977 @}
978 @end example
979
980 @noindent
981 to serve as a reminder that these parts are written in C.
982
983
984 @seealso
985
986 Notation Reference: @ref{Quoting other voices}, @ref{Transpose}.
987
988 Snippets: @lsrdir{Pitches}.
989
990
991 @node Automatic accidentals
992 @unnumberedsubsubsec Automatic accidentals
993 @cindex automatic accidentals
994
995 @funindex set-accidental-style
996
997 There are many different conventions on how to typeset
998 accidentals.  LilyPond provides a function to specify which such
999 accidental style to use.  This function is called as follows
1000
1001 @example
1002 \new Staff <<
1003   #(set-accidental-style 'voice)
1004   @{ @dots{} @}
1005 >>
1006 @end example
1007
1008 The accidental style applies to the current @code{Staff} by
1009 default (with the exception of the styles @code{piano} and
1010 @code{piano-cautionary}, see below.  Optionally, the function can
1011 take a second argument which determines in which scope the style
1012 should be changed.  For example, to use the same style in all
1013 staves of the current @code{StaffGroup}, use
1014
1015 @example
1016 #(set-accidental-style 'voice 'StaffGroup)
1017 @end example
1018
1019 The following accidental styles are supported.  To demonstrate
1020 each style, we use the following example:
1021
1022 @lilypond[verbatim,quote,ragged-right]
1023 musicA = {
1024   <<
1025     \relative c' {
1026       cis'8 fis, d'4 <a cis>8 f bis4 |
1027       cis2. <c, g'>4 |
1028     }
1029     \\
1030     \relative c' {
1031       ais'2 cis, |
1032       fis8 b a4 cis2 |
1033     }
1034   >>
1035 }
1036
1037 musicB = {
1038   \clef bass
1039   \new Voice {
1040     \voiceTwo \relative c' {
1041       <fis, a cis>4
1042       \change Staff = up
1043       cis'
1044       \change Staff = down
1045       <fis, a>
1046       \change Staff = up
1047       dis' |
1048       \change Staff = down
1049       <fis, a cis>4 gis <f a d>2 |
1050     }
1051   }
1052 }
1053
1054 \new PianoStaff {
1055   <<
1056     \context Staff = "up" {
1057       %%% change the next line as desired:
1058       #(set-accidental-style 'default)
1059       \musicA
1060     }
1061     \context Staff = "down" {
1062       %%% change the next line as desired:
1063       #(set-accidental-style 'default)
1064       \musicB
1065     }
1066   >>
1067 }
1068 @end lilypond
1069
1070 Note that the last lines of this example can be replaced by the
1071 following, as long as the same accidental style should be used in
1072 both staves.
1073 @example
1074 \new PianoStaff @{
1075   <<
1076     \context Staff = "up" @{
1077       %%% change the next line as desired:
1078       #(set-accidental-style 'default 'Score)
1079       \musicA
1080     @}
1081     \context Staff = "down" @{
1082       \musicB
1083     @}
1084   >>
1085 @}
1086 @end example
1087
1088
1089 @c don't use verbatim in this table.
1090 @table @code
1091 @item default
1092 This is the default typesetting behavior.  It corresponds to
1093 eighteenth-century common practice: accidentals are remembered to
1094 the end of the measure in which they occur and only on their own
1095 octave.  Thus, in the example below, no natural signs are printed
1096 before the@tie{}@code{b} in the second measure or the
1097 last@tie{}@code{c}:
1098
1099 @lilypond[quote,ragged-right]
1100 musicA = {
1101   <<
1102     \relative c' {
1103       cis'8 fis, d'4 <a cis>8 f bis4 |
1104       cis2. <c, g'>4 |
1105     }
1106     \\
1107     \relative c' {
1108       ais'2 cis, |
1109       fis8 b a4 cis2 |
1110     }
1111   >>
1112 }
1113
1114 musicB = {
1115   \clef bass
1116   \new Voice {
1117     \voiceTwo \relative c' {
1118       <fis, a cis>4
1119       \change Staff = up
1120       cis'
1121       \change Staff = down
1122       <fis, a>
1123       \change Staff = up
1124       dis' |
1125       \change Staff = down
1126       <fis, a cis>4 gis <f a d>2 |
1127     }
1128   }
1129 }
1130
1131 \new PianoStaff {
1132   <<
1133     \context Staff = "up" {
1134       #(set-accidental-style 'default)
1135       \musicA
1136     }
1137     \context Staff = "down" {
1138       #(set-accidental-style 'default)
1139       \musicB
1140     }
1141   >>
1142 }
1143 @end lilypond
1144
1145 @item voice
1146 The normal behavior is to remember the accidentals on Staff-level.
1147 In this style, however, accidentals are typeset individually for
1148 each voice.  Apart from that, the rule is similar to
1149 @code{default}.
1150
1151 As a result, accidentals from one voice do not get canceled in
1152 other voices, which is often an unwanted result: in the following
1153 example, it is hard to determine whether the second@tie{}@code{a}
1154 should be played natural or sharp.  The @code{voice} option should
1155 therefore be used only if the voices are to be read solely by
1156 individual musicians.  If the staff is to be used by one musician
1157 (e.g., a conductor or in a piano score) then @code{modern} or
1158 @code{modern-cautionary} should be used instead.
1159
1160
1161 @lilypond[quote,ragged-right]
1162 musicA = {
1163   <<
1164     \relative c' {
1165       cis'8 fis, d'4 <a cis>8 f bis4 |
1166       cis2. <c, g'>4 |
1167     }
1168     \\
1169     \relative c' {
1170       ais'2 cis, |
1171       fis8 b a4 cis2 |
1172     }
1173   >>
1174 }
1175
1176 musicB = {
1177   \clef bass
1178   \new Voice {
1179     \voiceTwo \relative c' {
1180       <fis, a cis>4
1181       \change Staff = up
1182       cis'
1183       \change Staff = down
1184       <fis, a>
1185       \change Staff = up
1186       dis' |
1187       \change Staff = down
1188       <fis, a cis>4 gis <f a d>2 |
1189     }
1190   }
1191 }
1192
1193 \new PianoStaff {
1194   <<
1195     \context Staff = "up" {
1196       #(set-accidental-style 'voice)
1197       \musicA
1198     }
1199     \context Staff = "down" {
1200       #(set-accidental-style 'voice)
1201       \musicB
1202     }
1203   >>
1204 }
1205 @end lilypond
1206
1207 @item modern
1208 @funindex modern style accidentals
1209
1210 This rule corresponds to the common practice in the twentieth
1211 century.  It prints the same accidentals as @code{default}, with
1212 two exceptions which serve to avoid ambiguity: after temporary
1213 accidentals, cancellation marks are printed also in the following
1214 measure (for notes in the same octave) and, in the same measure,
1215 for notes in other octaves.  Hence the naturals before
1216 the@tie{}@code{b} and the@tie{}@code{c} in the second measure of
1217 the upper staff:
1218
1219 @lilypond[quote,ragged-right]
1220 musicA = {
1221   <<
1222     \relative c' {
1223       cis'8 fis, d'4 <a cis>8 f bis4 |
1224       cis2. <c, g'>4 |
1225     }
1226     \\
1227     \relative c' {
1228       ais'2 cis, |
1229       fis8 b a4 cis2 |
1230     }
1231   >>
1232 }
1233
1234 musicB = {
1235   \clef bass
1236   \new Voice {
1237     \voiceTwo \relative c' {
1238       <fis, a cis>4
1239       \change Staff = up
1240       cis'
1241       \change Staff = down
1242       <fis, a>
1243       \change Staff = up
1244       dis' |
1245       \change Staff = down
1246       <fis, a cis>4 gis <f a d>2 |
1247     }
1248   }
1249 }
1250
1251 \new PianoStaff {
1252   <<
1253     \context Staff = "up" {
1254       #(set-accidental-style 'modern)
1255       \musicA
1256     }
1257     \context Staff = "down" {
1258       #(set-accidental-style 'modern)
1259       \musicB
1260     }
1261   >>
1262 }
1263 @end lilypond
1264
1265 @item modern-cautionary
1266 @funindex modern-cautionary
1267
1268 This rule is similar to @code{modern}, but the @q{extra}
1269 accidentals (the ones not typeset by @code{default}) are typeset
1270 as cautionary accidentals.  They are by default printed with
1271 parentheses, but they can also be printed in reduced size by
1272 defining the @code{cautionary-style} property of
1273 @code{AccidentalSuggestion}.
1274
1275
1276 @lilypond[quote,ragged-right]
1277 musicA = {
1278   <<
1279     \relative c' {
1280       cis'8 fis, d'4 <a cis>8 f bis4 |
1281       cis2. <c, g'>4 |
1282     }
1283     \\
1284     \relative c' {
1285       ais'2 cis, |
1286       fis8 b a4 cis2 |
1287     }
1288   >>
1289 }
1290
1291 musicB = {
1292   \clef bass
1293   \new Voice {
1294     \voiceTwo \relative c' {
1295       <fis, a cis>4
1296       \change Staff = up
1297       cis'
1298       \change Staff = down
1299       <fis, a>
1300       \change Staff = up
1301       dis' |
1302       \change Staff = down
1303       <fis, a cis>4 gis <f a d>2 |
1304     }
1305   }
1306 }
1307
1308 \new PianoStaff {
1309   <<
1310     \context Staff = "up" {
1311       #(set-accidental-style 'modern-cautionary)
1312       \musicA
1313     }
1314     \context Staff = "down" {
1315       #(set-accidental-style 'modern-cautionary)
1316       \musicB
1317     }
1318   >>
1319 }
1320 @end lilypond
1321
1322 @item modern-voice
1323 @funindex modern-voice
1324
1325 This rule is used for multivoice accidentals to be read both by
1326 musicians playing one voice and musicians playing all voices.
1327 Accidentals are typeset for each voice, but they @emph{are}
1328 canceled across voices in the same @code{Staff}.  Hence,
1329 the@tie{}@code{a} in the last measure is canceled because the
1330 previous cancellation was in a different voice, and
1331 the@tie{}@code{d} in the lower staff is canceled because of the
1332 accidental in a different voice in the previous measure:
1333
1334
1335 @lilypond[quote,ragged-right]
1336 musicA = {
1337   <<
1338     \relative c' {
1339       cis'8 fis, d'4 <a cis>8 f bis4 |
1340       cis2. <c, g'>4 |
1341     }
1342     \\
1343     \relative c' {
1344       ais'2 cis, |
1345       fis8 b a4 cis2 |
1346     }
1347   >>
1348 }
1349
1350 musicB = {
1351   \clef bass
1352   \new Voice {
1353     \voiceTwo \relative c' {
1354       <fis, a cis>4
1355       \change Staff = up
1356       cis'
1357       \change Staff = down
1358       <fis, a>
1359       \change Staff = up
1360       dis' |
1361       \change Staff = down
1362       <fis, a cis>4 gis <f a d>2 |
1363     }
1364   }
1365 }
1366
1367 \new PianoStaff {
1368   <<
1369     \context Staff = "up" {
1370       #(set-accidental-style 'modern-voice)
1371       \musicA
1372     }
1373     \context Staff = "down" {
1374       #(set-accidental-style 'modern-voice)
1375       \musicB
1376     }
1377   >>
1378 }
1379 @end lilypond
1380
1381 @funindex modern-voice-cautionary
1382 @item modern-voice-cautionary
1383
1384 This rule is the same as @code{modern-voice}, but with the extra
1385 accidentals (the ones not typeset by @code{voice}) typeset
1386 as cautionaries.  Even though all accidentals typeset by
1387 @code{default} @emph{are} typeset with this rule,
1388 some of them are typeset as cautionaries.
1389
1390 @lilypond[quote,ragged-right]
1391 musicA = {
1392   <<
1393     \relative c' {
1394       cis'8 fis, d'4 <a cis>8 f bis4 |
1395       cis2. <c, g'>4 |
1396     }
1397     \\
1398     \relative c' {
1399       ais'2 cis, |
1400       fis8 b a4 cis2 |
1401     }
1402   >>
1403 }
1404
1405 musicB = {
1406   \clef bass
1407   \new Voice {
1408     \voiceTwo \relative c' {
1409       <fis, a cis>4
1410       \change Staff = up
1411       cis'
1412       \change Staff = down
1413       <fis, a>
1414       \change Staff = up
1415       dis' |
1416       \change Staff = down
1417       <fis, a cis>4 gis <f a d>2 |
1418     }
1419   }
1420 }
1421
1422 \new PianoStaff {
1423   <<
1424     \context Staff = "up" {
1425       #(set-accidental-style 'modern-voice-cautionary)
1426       \musicA
1427     }
1428     \context Staff = "down" {
1429       #(set-accidental-style 'modern-voice-cautionary)
1430       \musicB
1431     }
1432   >>
1433 }
1434 @end lilypond
1435
1436 @item piano
1437 @funindex piano accidentals
1438
1439 This rule reflects twentieth-century practice for piano notation.
1440 Its behavior is very similar to @code{modern} style, but here
1441 accidentals also get canceled across the staves in the same
1442 GrandStaff or PianoStaff, hence all the cancellations of the final
1443 notes.
1444
1445 This accidental style applies to the current @code{GrandStaff} or
1446 @code{PianoStaff} by default.
1447
1448 @lilypond[quote,ragged-right]
1449 musicA = {
1450   <<
1451     \relative c' {
1452       cis'8 fis, d'4 <a cis>8 f bis4 |
1453       cis2. <c, g'>4 |
1454     }
1455     \\
1456     \relative c' {
1457       ais'2 cis, |
1458       fis8 b a4 cis2 |
1459     }
1460   >>
1461 }
1462
1463 musicB = {
1464   \clef bass
1465   \new Voice {
1466     \voiceTwo \relative c' {
1467       <fis, a cis>4
1468       \change Staff = up
1469       cis'
1470       \change Staff = down
1471       <fis, a>
1472       \change Staff = up
1473       dis' |
1474       \change Staff = down
1475       <fis, a cis>4 gis <f a d>2 |
1476     }
1477   }
1478 }
1479
1480 \new PianoStaff {
1481   <<
1482     \context Staff = "up" {
1483       #(set-accidental-style 'piano)
1484       \musicA
1485     }
1486     \context Staff = "down" {
1487       \musicB
1488     }
1489   >>
1490 }
1491 @end lilypond
1492
1493 @item piano-cautionary
1494 @funindex #(set-accidental-style 'piano-cautionary)
1495
1496 Same as @code{#(set-accidental-style 'piano)} but with the extra
1497 accidentals typeset as cautionaries.
1498
1499 @lilypond[quote,ragged-right]
1500 musicA = {
1501   <<
1502     \relative c' {
1503       cis'8 fis, d'4 <a cis>8 f bis4 |
1504       cis2. <c, g'>4 |
1505     }
1506     \\
1507     \relative c' {
1508       ais'2 cis, |
1509       fis8 b a4 cis2 |
1510     }
1511   >>
1512 }
1513
1514 musicB = {
1515   \clef bass
1516   \new Voice {
1517     \voiceTwo \relative c' {
1518       <fis, a cis>4
1519       \change Staff = up
1520       cis'
1521       \change Staff = down
1522       <fis, a>
1523       \change Staff = up
1524       dis' |
1525       \change Staff = down
1526       <fis, a cis>4 gis <f a d>2 |
1527     }
1528   }
1529 }
1530
1531 \new PianoStaff {
1532   <<
1533     \context Staff = "up" {
1534       #(set-accidental-style 'piano-cautionary)
1535       \musicA
1536     }
1537     \context Staff = "down" {
1538       \musicB
1539     }
1540   >>
1541 }
1542 @end lilypond
1543
1544 @item no-reset
1545 @funindex no-reset accidental style
1546
1547 This is the same as @code{default} but with accidentals lasting
1548 @q{forever} and not only within the same measure:
1549
1550 @lilypond[quote,ragged-right]
1551 musicA = {
1552   <<
1553     \relative c' {
1554       cis'8 fis, d'4 <a cis>8 f bis4 |
1555       cis2. <c, g'>4 |
1556     }
1557     \\
1558     \relative c' {
1559       ais'2 cis, |
1560       fis8 b a4 cis2 |
1561     }
1562   >>
1563 }
1564
1565 musicB = {
1566   \clef bass
1567   \new Voice {
1568     \voiceTwo \relative c' {
1569       <fis, a cis>4
1570       \change Staff = up
1571       cis'
1572       \change Staff = down
1573       <fis, a>
1574       \change Staff = up
1575       dis' |
1576       \change Staff = down
1577       <fis, a cis>4 gis <f a d>2 |
1578     }
1579   }
1580 }
1581
1582 \new PianoStaff {
1583   <<
1584     \context Staff = "up" {
1585       #(set-accidental-style 'no-reset)
1586       \musicA
1587     }
1588     \context Staff = "down" {
1589       #(set-accidental-style 'no-reset)
1590       \musicB
1591     }
1592   >>
1593 }
1594 @end lilypond
1595
1596 @item forget
1597 @funindex forget accidental style
1598
1599 This is the opposite of @code{no-reset}: Accidentals are not
1600 remembered at all -- and hence all accidentals are typeset
1601 relative to the key signature, regardless of what was before in
1602 the music:
1603
1604 @lilypond[quote,ragged-right]
1605 musicA = {
1606   <<
1607     \relative c' {
1608       cis'8 fis, d'4 <a cis>8 f bis4 |
1609       cis2. <c, g'>4 |
1610     }
1611     \\
1612     \relative c' {
1613       ais'2 cis, |
1614       fis8 b a4 cis2 |
1615     }
1616   >>
1617 }
1618
1619 musicB = {
1620   \clef bass
1621   \new Voice {
1622     \voiceTwo \relative c' {
1623       <fis, a cis>4
1624       \change Staff = up
1625       cis'
1626       \change Staff = down
1627       <fis, a>
1628       \change Staff = up
1629       dis' |
1630       \change Staff = down
1631       <fis, a cis>4 gis <f a d>2 |
1632     }
1633   }
1634 }
1635
1636 \new PianoStaff {
1637   <<
1638     \context Staff = "up" {
1639       #(set-accidental-style 'forget)
1640       \musicA
1641     }
1642     \context Staff = "down" {
1643       #(set-accidental-style 'forget)
1644       \musicB
1645     }
1646   >>
1647 }
1648 @end lilypond
1649 @end table
1650
1651 @commonprop
1652
1653 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc]
1654 {dodecaphonic-style-accidentals-for-each-note-including-naturals.ly}
1655
1656
1657 @seealso
1658
1659 Snippets: @lsrdir{Pitches}.
1660
1661 Internals Reference: @internalsref{Accidental_engraver},
1662 @internalsref{Accidental}, @internalsref{AccidentalSuggestion},
1663 @internalsref{AccidentalPlacement}, @internalsref{GrandStaff} and
1664 @internalsref{PianoStaff}, @internalsref{Staff}.
1665
1666
1667 @refbugs
1668
1669 Simultaneous notes are considered to be entered in sequential
1670 mode.  This means that in a chord the accidentals are typeset as
1671 if the notes in the chord happen one at a time, in the order in
1672 which they appear in the input file.  This is a problem when
1673 accidentals in a chord depend on each other, which does not happen
1674 for the default accidental style.  The problem can be solved by
1675 manually inserting@tie{}@code{!} and@tie{}@code{?} for the
1676 problematic notes.
1677
1678
1679 @node Ambitus
1680 @unnumberedsubsubsec Ambitus
1681 @cindex ambitus
1682
1683 The term @notation{ambitus} or @notation{ambit} denotes a range of
1684 pitches for a given voice in a part of music.  It may also denote
1685 the pitch range that a musical instrument is capable of playing.
1686 Ambits are printed on vocal parts, so performers can easily
1687 determine if it matches their capabilities.
1688
1689 Ambits are denoted at the beginning of a piece near the initial
1690 clef.  The range is graphically specified by two note heads that
1691 represent the minimum and maximum pitch.  Accidentals are only
1692 printed if they are not part of the key signature.
1693
1694 @lilypond[verbatim,quote,ragged-right]
1695 \layout {
1696   \context {
1697     \Voice
1698     \consists Ambitus_engraver
1699   }
1700 }
1701
1702 \relative c'' {
1703   aes c e2 cis,2
1704 }
1705 @end lilypond
1706
1707
1708 @commonprop
1709
1710 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc]
1711 {adding-ambiti-per-voice.ly}
1712
1713 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc]
1714 {ambiti-multiple-voices.ly}
1715
1716
1717 @seealso
1718
1719 Snippets: @lsrdir{Pitches}.
1720
1721 Internals Reference: @internalsref{Ambitus},
1722 @internalsref{AmbitusLine}, @internalsref{AmbitusNoteHead},
1723 @internalsref{AmbitusAccidental}, @internalsref{Ambitus_engraver},
1724 @internalsref{Staff}, @internalsref{Voice}.
1725
1726
1727 @refbugs
1728
1729 There is no collision handling in the case of multiple per-voice
1730 ambitus.
1731
1732
1733 @node Note heads
1734 @subsection Note heads
1735
1736 @menu
1737 * Easy notation note heads::
1738 * Shape note heads::
1739 * Improvisation::
1740 * Special noteheads::
1741 @end menu
1742
1743 @node Easy notation note heads
1744 @unnumberedsubsubsec Easy notation note heads
1745
1746 @cindex note heads, practice
1747 @cindex note heads, easy notation
1748 @cindex easy notation
1749 @cindex Hal Leonard
1750
1751 The @q{easy play} note head includes a note name inside the head.
1752 It is used in music for beginners
1753
1754 @lilypond[verbatim,quote,ragged-right,fragment,staffsize=26]
1755 \setEasyHeads
1756 c'2 e'4 f' |
1757 g'1
1758 @end lilypond
1759
1760 The command @code{\setEasyHeads} overrides settings for the
1761 @code{NoteHead} object.  To make the letters readable, it
1762 has to be printed in a large font size.  To print with a larger
1763 font, see @ref{Setting the staff size}.
1764
1765 @refcommands
1766
1767 @funindex \setEasyHeads
1768 @code{\setEasyHeads}
1769
1770 @seealso
1771
1772 Notation Reference: @ref{Setting the staff size}.
1773
1774 Snippets: @lsrdir{Pitches},
1775
1776 Internals Reference: @internalsref{NoteHead}.
1777
1778
1779 @node Shape note heads
1780 @unnumberedsubsubsec Shape note heads
1781
1782 @cindex note heads, shape
1783
1784 In shape note head notation, the shape of the note head
1785 corresponds to the harmonic function of a note in the scale.  This
1786 notation was popular in nineteenth-century American song books.
1787
1788 Shape note heads can be produced by setting @code{\aikenHeads} or
1789 @code{\sacredHarpHeads}, depending on the style desired.
1790
1791 @lilypond[verbatim,fragment,relative=1]
1792 \aikenHeads
1793 c8 d4 e8 a2 g1
1794 \sacredHarpHeads
1795 c,8 d4 e8 a2 g1
1796 @end lilypond
1797
1798 Shapes are typeset according to the step in the scale, where
1799 the base of the scale is determined by the @code{\key} command.
1800
1801 @funindex \key
1802 @funindex shapeNoteStyles
1803 @funindex \aikenHeads
1804 @funindex \sacredHarpHeads
1805
1806 Shape note heads are implemented through the
1807 @code{shapeNoteStyles} property.  Its value is a vector of
1808 symbols.  The k-th element indicates the style to use for the k-th
1809 step of the scale.  Arbitrary combinations are possible, e.g.:
1810
1811 @lilypond[verbatim,fragment,relative=1]
1812 \set shapeNoteStyles =
1813   ##(cross triangle fa #f mensural xcircle diamond)
1814 c8 d4 e8 a2 g1
1815 @end lilypond
1816
1817 @commonprop
1818
1819 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc]
1820 {applying-noteheads-styles-depending-on-the-step-of-the-scale.ly}
1821
1822
1823 @seealso
1824
1825 Snippets: @lsrdir{Pitches}.
1826
1827
1828 @node Improvisation
1829 @unnumberedsubsubsec Improvisation
1830
1831 Improvisation is sometimes denoted with slashed note heads.  Such
1832 note heads can be created by adding a @code{Pitch_squash_engraver}
1833 to the @code{Voice} context.  Then, the following command
1834
1835 @example
1836 \set squashedPosition = #0
1837 \override NoteHead #'style = #'slash
1838 @end example
1839
1840 @noindent
1841 switches on the slashes.
1842
1843 There are shortcuts @code{\improvisationOn} (and an accompanying
1844 @code{\improvisationOff}) for this command sequence.  They are
1845 used in the following example:
1846
1847 @lilypond[verbatim,quote,ragged-right]
1848 \new Voice \with {
1849   \consists Pitch_squash_engraver
1850 } \transpose c c' {
1851   e8 e g a a16(bes)(a8) g
1852   \improvisationOn
1853   e8
1854   ~e2~e8 f4 fis8
1855   ~fis2
1856   \improvisationOff
1857   a16(bes) a8 g e
1858 }
1859 @end lilypond
1860
1861 @seealso
1862
1863 Snippets: @lsrdir{Pitches}.
1864
1865 Internals Reference: @internalsref{Pitch_squash_engraver},
1866 @internalsref{Voice}.
1867
1868 @node Special noteheads
1869 @unnumberedsubsubsec Special noteheads
1870
1871 @cindex note heads, special
1872
1873 Different noteheads are used by various instruments for various
1874 meanings -- crosses are used for @q{parlato} with vocalists,
1875 stopped notes on guitar; diamonds are used for harmonics on string
1876 instruments, etc.  There is a shorthand (@code{\harmonic}) for
1877 diamond shapes; the other notehead styles are produced by tweaking
1878 the property:
1879
1880 @lilypond[verbatim,quote,ragged-right,fragment,relative=1]
1881 c4 d
1882 \override NoteHead #'style = #'cross
1883 e f
1884 \revert NoteHead #'style
1885 e d <c f\harmonic> <d a'\harmonic>
1886 @end lilypond
1887
1888 @noindent
1889 To see all notehead styles, please see @ref{Note head styles}.
1890
1891
1892 @seealso
1893
1894 Snippets: @lsrdir{Pitches}.
1895
1896 Notation Reference: @ref{Note head styles}.
1897
1898 Internals Reference: @internalsref{NoteHead}.