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