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