1 @c -*- coding: utf-8; mode: texinfo; -*-
3 Translation of GIT committish: FILL-IN-HEAD-COMMITTISH
5 When revising a translation, copy the HEAD committish of the
6 version that you are working on. See TRANSLATION for details.
13 @lilypondfile[ragged-right,line-width=16\cm,staffsize=16,quote]
16 This section discusses how to specify the pitch of notes. There
17 are three steps to this process: input, modifying, and output.
21 * Changing multiple pitches::
22 * Displaying pitches::
27 @subsection Writing pitches
29 This section discusses how to input pitches.
32 * Absolute octave entry::
33 * Relative octave entry::
35 * Note names in other languages::
39 @node Absolute octave entry
40 @unnumberedsubsubsec Absolute octave entry
45 @c don't use @samp here because that might get confused with
47 A pitch name is specified using lowercase letters @code{a} through
48 @code{g}. An ascending C-major scale is engraved with
50 @lilypond[quote,fragment,verbatim,ragged-right]
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.
61 @cindex Absolute octave specification
63 @c don't use @samp here because that might get confused with
65 In absolute mode, every note is placed explicitly in a certain
66 octave. The note names @code{c} to @code{b} are engraved in the
67 octave below middle C, as in the previous example.
69 @lilypond[quote,fragment,verbatim,ragged-right]
79 If a note should be in another octave than this, an octave
80 specification must be given. It takes the form of a series of
81 single quote (@code{'}) or comma (@code{,}) characters. Each
82 @code{'} raises the pitch by one octave; each @code{,} lowers the
85 @lilypond[quote,ragged-right,fragment,verbatim]
87 c' c'' e' g d'' d' d c
89 c, c,, e, g d,, d, d c
94 Snippets: @lsrdir{pitch}
96 Program reference: @internalsref{LedgerLineSpanner},
97 @internalsref{NoteHead}.
100 @node Relative octave entry
101 @unnumberedsubsubsec Relative octaves entry
104 @cindex Relative octave specification
107 The absolute mode requires a lot of octave specifications, which
108 not only becomes tedious but also easily leads to errors.
109 Therefore, it is usually more convenient to let notes be entered
110 relative to the previous note. This is done with the relative
114 \relative @var{startpitch} @var{musicexpr}
117 In relative mode, each note is assumed to be as close to the
118 previous note as possible. This means that the octave of notes
119 that appear in @var{musicexpr} are calculated as follows:
123 The pitch of the first note is relative to @code{\relative
127 If no octave changing marks are used, the basic interval between a
128 note and the one that precedes it is always taken to be a fourth
132 This distance is determined without regarding alterations or the
133 actual sounding pitches; a @code{fisis} following a @code{ceses}
134 will be put above the @code{ceses}. In other words, a
135 doubly-augmented fourth is considered a smaller interval than a
136 diminished fifth, even though the doubly-augmented fourth spans
137 seven semitones while the diminished fifth only spans six
141 The octave changing marks @code{'} and @code{,} can be added to
142 raise or lower the pitch by an extra octave from the basic
146 Multiple octave changing marks can be used. @code{''} will raise
147 the pitch by two octaves.
151 Here is the relative mode shown in action:
153 @lilypond[quote,fragment,ragged-right,verbatim]
159 Octave changing marks are used for intervals greater than a
162 @lilypond[quote,ragged-right,fragment,verbatim]
168 A note sequence without a single octave mark can nevertheless span
171 @lilypond[quote,ragged-right,fragment,verbatim]
177 If the preceding item is a chord, the first note of the chord is
178 used as the reference point for the octave placement of a
179 following note or chord:
181 @lilypond[quote,ragged-right,fragment,verbatim]
189 The @var{startpitch} (after @code{\relative}) is a note name in
190 absolute mode. In principle it can be any note name, but common
191 practice is to use @code{c} in various octave positions.
193 When octaves are specified as above by adding @code{'} and
194 @code{,} to pitch names, it is easy to accidentally put a pitch in
195 the wrong octave. The relative octave mode prevents these errors
196 since most of the time it is not necessary to indicate any octaves
197 at all. Furthermore, in absolute mode, a single mistake may be
198 difficult to spot; in relative mode, a single error puts the rest
199 of the piece off by one octave.
203 Snippets: @lsrdir{pitch}
208 The relative conversion will not affect @code{\transpose},
209 @code{\chordmode} or @code{\relative} sections in its argument.
210 To use relative within transposed music, an additional
211 @code{\relative} must be placed inside @code{\transpose}.
214 If no @var{startpitch} is specified for @code{\relative}, then
215 @code{c'} is assumed. However, this is a deprecated option and
216 may disappear in future versions, so its use is discouraged.
221 @unnumberedsubsubsec Accidentals
223 @warning{New users are sometimes confused about accidentals and
224 key signatures. In LilyPond, note names are the raw input; key
225 signatures and clefs determine how this raw input is displayed.
226 An unaltered note like @code{c} means @q{C natural}, regardless of
227 the key signature or clef. For more information, see
228 @rlearning{Accidentals and key signatures}.}
230 @cindex note names, Dutch
231 @cindex note names, default
233 A @notation{sharp} pitch is made by adding @code{is} to the name,
234 and a @notation{flat} pitch by adding @code{es}. As you might
235 expect, a @notation{double sharp} or @notation{double flat} is
236 made by adding @code{isis} or @code{eses}. This syntax derived
237 from note naming conventions in Nordic and Germanic languages,
238 like German and Dutch. To use other names for accidentals, see
239 @ref{Note names in other languages}.
241 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
247 These are the Dutch note names. In Dutch, @code{aes} is
248 contracted to @code{as}, but both forms are accepted. Similarly,
249 both @code{es} and @code{ees} are accepted:
251 @lilypond[fragment,quote,ragged-right,verbatim,relative=2]
255 A natural will cancel the effect of an accidental or key
256 signature. However, naturals are not encoded into the note name
257 syntax with a suffix; a natural pitch is shown as a simple note
260 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
265 @cindex accidental, reminder
266 @cindex accidental, cautionary
267 @cindex accidental, parenthesized
268 @cindex reminder accidental
270 @cindex cautionary accidental
271 @cindex parenthesized accidental
274 Normally accidentals are printed automatically, but you may also
275 print them manually. A reminder accidental can be forced by
276 adding an exclamation mark @code{!} after the pitch. A cautionary
277 accidental (i.e., an accidental within parentheses) can be
278 obtained by adding the question mark @code{?} after the pitch.
279 These extra accidentals can be used to produce natural signs, too.
281 @lilypond[quote,ragged-right,fragment,verbatim,relative=1]
282 cis cis cis! cis? c c? c! c
286 @cindex quarter tones
287 @cindex semi-flats, semi-sharps
289 Half-flats and half-sharps are formed by adding @code{eh} and
290 @code{ih}; the following is a series of Cs with increasing
293 @lilypond[verbatim,ragged-right,quote,relative=2,fragment]
294 \set Staff.extraNatural = ##f
298 Micro tones are also exported to the MIDI file.
303 In accordance with standard typesetting rules, a natural sign is
304 printed before a sharp or flat if a previous accidental needs to
305 be cancelled. To change this behavior, use
307 @lilypond[fragment,quote,ragged-right,verbatim,relative=2]
309 \set Staff.extraNatural = ##f
316 Music glossary: @rglos{sharp}, @rglos{flat}, @rglos{double sharp},
319 Notation reference: @ref{Automatic accidentals}, @ref{Musica ficta
322 Snippets: @lsrdir{pitch}
327 There are no generally accepted standards for denoting
328 three-quarter flats, so LilyPond's symbol does not conform to any
333 @node Note names in other languages
334 @unnumberedsubsubsec Note names in other languages
336 There are predefined sets of note names for various other
337 languages. To use them, include the language specific init file.
338 For example, add @code{\include "english.ly"} to the top of the
339 input file. The available language files and the note names they
342 @cindex note names, other languages
345 @multitable @columnfractions .2 .6 .05 .05 .05 .05
348 @tab sharp @tab flat @tab double sharp @tab double flat
350 @tab c d e f g a bes b
351 @tab -is @tab -es @tab -isis @tab -eses
353 @tab c d e f g a bf b
354 @tab -s/-sharp @tab -f/-flat @tab -ss/-x/-sharpsharp
358 @tab -is @tab -es @tab -isis @tab -eses
361 @tab -iss/-is @tab -ess/-es @tab -ississ/-isis
365 @tab -iss @tab -ess @tab -ississ @tab -essess
367 @tab do re mi fa sol la sib si
368 @tab -d @tab -b @tab -dd @tab -bb
370 @tab do re mi fa sol la sib si
371 @tab -d/-s @tab -b @tab -dd/-ss @tab -bb
373 @tab do re mi fa sol la sib si
374 @tab -s @tab -b @tab -ss @tab -bb
379 Note that in Dutch, German, Norwegian, and Swedish, the flat
380 alterations of @code{a} like for example @code{aes} and
381 @code{aeses} are usually contracted to @code{as} and @code{ases}
382 (or more commonly @code{asas}). Sometimes only these contracted
383 names are defined in the corresponding language files (this also
384 applies to the suffixes for quartertones below).
387 Some music uses microtones whose alterations are fractions of a
388 @q{normal} sharp or flat. The note names for quartertones defined
389 in the various language files are listed in the following table.
390 Here the prefixes @q{semi-} and @q{sesqui-} mean @q{half} and
391 @q{one and a half}, respectively. For Norwegian, Swedish, Catalan
392 and Spanish no special names have been defined yet.
395 @c What about Turkish Maquam music and similar microtonal systems?
397 @c Note that the term "three-quarter-sharp/-flat" used in lilypond's source code
398 @c is actually misleading since the alteration is in fact one and a half
399 @c of a regular sharp/flat. Whence the naming "sesqui-sharp/-flat" used below.
402 @multitable @columnfractions .2 .6 .05 .05 .05 .05
405 @tab semi- @tab semi- @tab sesqui- @tab sesqui-
408 @tab c d e f g a bes b
409 @tab -ih @tab -eh @tab -isih @tab -eseh
411 @tab c d e f g a bf b
412 @tab -qs @tab -qf @tab -tqs @tab -tqf
415 @tab -ih @tab -eh @tab -isih @tab -eseh
417 @c @tab c d e f g a b h
419 @c @tab c d e f g a b h
421 @tab do re mi fa sol la sib si
422 @tab -sd @tab -sb @tab -dsd @tab -bsb
424 @c @tab do re mi fa sol la sib si
426 @c @tab do re mi fa sol la sib si
432 Snippets: @lsrdir{pitch}
436 @node Changing multiple pitches
437 @subsection Changing multiple pitches
439 This section discusses how to modify pitches.
447 @unnumberedsubsubsec Octave check
451 In relative mode, it is easy to forget an octave changing mark.
452 Octave checks make such errors easier to correct. A note may be
453 followed by @code{=}@var{quotes} to indicate what its absolute
454 octave should be. In the following example,
457 \relative c'' @{ c g d='' @}
461 the @code{d} will generate a warning, because a
462 @code{d''} is expected, as indicated by the octave check
463 @code{=''}, but a @code{d'} is found, since both @code{c}-@code{g}
464 and @code{g}-@code{d} without octavation marks are descending
465 fourths. In the output, the octave is corrected to be a
466 @code{d''} and the next note is calculated relative to @code{d''}
467 instead of @code{d'}.
469 There is also an octave check that produces no visible output.
473 @var{pitch} \octave @var{controlpitch}
476 where @var{pitch} is a regular note within a music expression in
477 relative mode and @var{controlpitch} is a pitch in absolute mode.
478 This checks that @var{pitch} lies within the octave surrounding
479 @var{controlpitch}, i.e. not more than a fourth above or below it.
480 If this is not the case, a warning is printed and the octave is
481 corrected. The @var{controlpitch} is not printed as a note.
483 In the example below, the first check passes without incident,
484 since the @code{e} (in @code{relative} mode) is within the octave
485 range of @code{a'}. However, the second check produces a warning,
486 since the @code{e} is not within the octave range of @code{b'}.
487 The warning message is printed, and the octave is adjusted so that
488 the following notes are in the correct octave once again.
499 The octave of a note following an @code{\octave} check is
500 determined with respect to the note preceding it, as modified by
501 the outcome of the octave check. In the next fragment, the first
502 note, an @code{e'}, lies within the octave of @code{b}, and the
503 @code{\octave} check passes successfully. The second note is then
504 calculated relative to (absolute) @code{e'}, which yields an
505 @code{a'}, above middle C. In this case, the check had no
506 influence on the output of the piece.
508 The second @code{\octave} check fails: @code{a'} is not within the
509 range of @code{b}. A warning is issued, and the last note is
510 calculated relative to @code{a}, not to @code{a'}, and we get a
511 @code{d'}. Without the last @code{\octave} check, the last note
512 would have been a @code{d''}
514 @lilypond[quote,ragged-right,verbatim,fragment]
526 Snippets: @lsrdir{pitch}
530 @unnumberedsubsubsec Transpose
533 @cindex Transposition of pitches
536 A music expression can be transposed with @code{\transpose}. The
540 \transpose @var{from} @var{to} @var{musicexpr}
543 This means that @var{musicexpr} is transposed by the interval
544 between the pitches @var{from} and @var{to}: any note with pitch
545 @var{from} is changed to @var{to} and any other note is transposed
546 by the same interval.
548 Consider a piece written in the key of D-major. If this piece is
549 a little too low for its performer, it can be transposed up to
553 \transpose d e @dots{}
556 Consider a part written for violin (a C instrument). If this part
557 is to be played on the A clarinet (for which an A is notated as a
558 C, and thus sounds a minor third lower than notated), the
559 following transposition will produce the appropriate part:
562 \transpose a c @dots{}
565 @code{\transpose} will also transpose key signatures:
567 @lilypond[quote,ragged-right,verbatim]
568 mus = { \key d \major cis d fis g }
577 @code{\transpose} distinguishes between enharmonic pitches: both
578 @code{\transpose c cis} or @code{\transpose c des} will transpose
579 up half a tone. The first version will print sharps and the notes
580 will remain on the same scale step, the second version will print
581 flats on the scale step above.
583 @lilypond[quote,ragged-right,verbatim]
586 \transpose c cis { \relative c' \mus }
587 \transpose c des { \relative c' \mus }
591 @code{\transpose} may also be used to input written notes for a
592 transposing instrument. The previous examples show how to enter
593 pitches in C (or @notation{concert pitch}) and typeset them for a
594 transposing instrument, but the opposite is also possible if you
595 for example have a set of instrumental parts and want to print a
596 conductor's score. For example, when entering music for a B-flat
597 trumpet which begins on a notated E (concert D), one would write:
600 musicInBflat = @{ e4 @dots{} @}
601 \transpose c bes \musicInBflat
604 To print this music in F (e.g., rearranging to a french horn) you
605 would wrap the existing music with another @code{\transpose}
608 musicInBflat = @{ e4 @dots{} @}
609 \transpose f c @{ \transpose c bes \musicInBflat @}
614 Snippets: @lsrdir{pitch}, @lsr{scheme,
615 transpose-pitches-with-minimum-accidentals.ly}.
617 Program reference: @internalsref{TransposedMusic}.
621 If you want to use both @code{\transpose} and @code{\relative},
622 you must put @code{\transpose} outside of @code{\relative}, since
623 @code{\relative} will have no effect on music that appears inside
624 a @code{\transpose}. See the previous example.
627 @node Displaying pitches
628 @subsection Displaying pitches
630 This section discusses how to alter the output of pitches.
636 * Instrument transpositions::
637 * Automatic accidentals::
641 @unnumberedsubsubsec Clef
655 @cindex mezzosoprano clef
656 @cindex baritone clef
657 @cindex varbaritone clef
660 The clef is set with the @code{\clef} @var{clefname}
663 @lilypond[quote,ragged-right,fragment,verbatim]
666 % treble clef by default
680 The clef can also be changed inside the staff:
682 @lilypond[quote,ragged-right,fragment,verbatim]
693 c,8 r \clef treble g''4
698 These same clef symbols are used in different positions on
699 the staff to change the range of notes shown by that staff.
700 The treble (alto, bass) clef is always positioned to show
701 the line on which a g' (c', f) note is printed.
703 Supported clefs include
705 @multitable @columnfractions .4 .6
706 @headitem Clef @tab Position
707 @item @code{treble, violin, G, G2} @tab
708 G clef (g') on 2nd line
709 @item @code{alto, C} @tab
710 C clef (c') on 3rd line
711 @item @code{tenor} @tab
712 C clef (c') on 4th line.
713 @item @code{bass, F} @tab
714 F clef (f) on 4th line
715 @item @code{french} @tab
716 G clef (g') on 1st line, so-called French violin clef
717 @item @code{soprano} @tab
718 C clef (c') on 1st line
719 @item @code{mezzosoprano} @tab
720 C clef (c') on 2nd line
721 @item @code{baritone} @tab
722 C clef (c') on 5th line
723 @item @code{varbaritone} @tab
724 F clef (f) on 3rd line
725 @item @code{subbass} @tab
726 F clef (f) on 5th line
727 @item @code{percussion} @tab
729 @item @code{tab} @tab
733 Further supported clefs are described under @ref{Ancient clefs}.
735 By adding @code{_8} or @code{^8} to the clef name, the clef is
736 transposed one octave down or up, respectively, and @code{_15} and
737 @code{^15} transposes by two octaves. The argument @var{clefname}
738 must be enclosed in quotes when it contains underscores or digits.
741 @cindex choral tenor clef
743 @lilypond[quote,ragged-right,verbatim,fragment,relative=1]
749 When a clef change takes place at a line break the new clef symbol
750 is printed at both the end of the previous line and the beginning
751 of the new line by default. If the warning clef at the end of the
752 previous line in not required it can be suppressed by setting the
753 @code{explicitClefVisibility} Staff property to the value
754 @var{end-of-line-invisible}: @code{\set
755 Staff.explicitClefVisibility = #end-of-line-invisible} The default
756 behaviour can be recovered with @code{\unset
757 Staff.explicitClefVisibility}
759 The command @code{\clef "treble_8"} is equivalent to setting
760 @code{clefGlyph}, @code{clefPosition} (which controls the Y
761 position of the clef), @code{middleCPosition} and
762 @code{clefOctavation}. A clef is printed when either the
763 @code{clefGlyph}, @code{clefPosition} or @code{clefOctavation}
764 properties are changed. Note that changing the glyph, the
765 position of the clef, or the octavation, does not in itself change
766 the position of subsequent notes on the staff: the position of
767 middle C must also be specified to do this. The positional
768 parameters are relative to the staff centre line, positive numbers
769 displacing upwards, counting 1 for each line and space. The
770 clefOctavation value would normally be set to 7, -7, 15 or -15,
771 but other values are not invalid.
773 The following examples show the possibilities when setting these
774 properties manually. First some manual changes which preserve the
775 standard relative positioning of clefs and notes:
777 @lilypond[quote,ragged-right,verbatim]
779 % The default treble clef
781 % The standard bass clef
782 \set Staff.clefGlyph = #"clefs.F"
783 \set Staff.clefPosition = #2
784 \set Staff.middleCPosition = #6
787 \set Staff.clefGlyph = #"clefs.C"
788 \set Staff.clefPosition = #4
789 \set Staff.middleCPosition = #4
791 % The standard choral tenor clef
792 \set Staff.clefGlyph = #"clefs.G"
793 \set Staff.clefPosition = #-2
794 \set Staff.clefOctavation = #-7
795 \set Staff.middleCPosition = #1
797 % A non-standard clef
798 \set Staff.clefPosition = #0
799 \set Staff.clefOctavation = #0
800 \set Staff.middleCPosition = #-4
805 and some which do not:
807 @lilypond[quote,ragged-right,verbatim]
809 \set Staff.clefGlyph = #"clefs.F"
810 \set Staff.clefPosition = #2
812 \set Staff.clefGlyph = #"clefs.G"
814 \set Staff.clefGlyph = #"clefs.C"
816 \set Staff.clefOctavation = #7
818 \set Staff.clefOctavation = #0
819 \set Staff.clefPosition = #0
821 \set Staff.middleCPosition = #4
828 Notation reference: @ref{Ancient clefs}.
830 Snippets: @lsrdir{pitch}
832 Program reference: @internalsref{Clef}.
836 @unnumberedsubsubsec Key signature
838 @cindex Key signature
841 @warning{New users are sometimes confused about accidentals and
842 key signatures. In LilyPond, note names are the raw input; key
843 signatures and clefs determine how this raw input is displayed.
844 An unaltered note like @code{c} means @q{C natural}, regardless of
845 the key signature or clef. For more information, see
846 @rlearning{Accidentals and key signatures}.}
848 The key signature indicates the tonality in which a piece is
849 played. It is denoted by a set of alterations (flats or sharps)
850 at the start of the staff.
852 Setting or changing the key signature is done with the @code{\key}
856 \key @var{pitch} @var{type}
865 @funindex \mixolydian
871 Here, @var{type} should be @code{\major} or @code{\minor} to get
872 @var{pitch}-major or @var{pitch}-minor, respectively. You may
873 also use the standard mode names (also called @q{church modes}):
874 @code{\ionian}, @code{\locrian}, @code{\aeolian},
875 @code{\mixolydian}, @code{\lydian}, @code{\phrygian}, and
878 @lilypond[quote,ragged-right,verbatim,relative=2,fragment]
887 A natural sign is printed to cancel any previous accidentals.
890 @lilypond[quote,fragment,ragged-right,verbatim,relative=2]
895 \set Staff.printKeyCancellation = ##f
902 The @code{\key} command sets the context property
903 @code{Staff.keySignature}. Non-standard key signatures can be
904 specified by setting this property directly. The format of this
908 \set Staff.keySignature = #'((@var{octave} . @var{step}) . @var{alter})
912 where, for each element in the list, @var{octave} specifies the
913 octave (0 being the octave from middle C to the B above),
914 @var{step} specifies the note within the octave (0 means C and 6
915 means B), and @var{alter} is ,SHARP ,FLAT ,DOUBLE-SHARP etc.
916 (Note the leading comma.) Here is an example of a possible key
917 signature for generating a whole-tone scale:
919 @lilypond[quote,ragged-right,verbatim]
922 \set Staff.keySignature =
923 #`(((0 . 3) . ,SHARP) ((0 . 5) . ,FLAT) ((0 . 6) . ,FLAT))
930 Music glossary: @rglos{Church mode}, @rglos{scordatura}.
932 Snippets: @lsrdir{pitch},
933 FIXME link to snippet 248,
934 FIXME link to a snippet about scordatura.
936 Program reference: @internalsref{KeyCancellation},
937 @internalsref{KeySignature}, @internalsref{Key_engraver}
940 @node Ottava brackets
941 @unnumberedsubsubsec Ottava brackets
949 @notation{Ottava brackets} introduce an extra transposition of an
950 octave for the staff:
952 @lilypond[quote,ragged-right,verbatim,fragment]
962 The @code{set-octavation} function also takes -1 (for 8va bassa),
963 2@tie{}(for 15ma), and -2 (for 15ma bassa) as arguments.
964 Internally the function sets the properties @code{ottavation}
965 (e.g., to @code{"8va"} or @code{"8vb"}) and
966 @code{middleCPosition}. To override the text of the bracket, set
967 @code{ottavation} after invoking @code{set-octavation}, i.e.,
969 @lilypond[quote,ragged-right,verbatim]
972 \set Staff.ottavation = #"8"
980 Snippets: @lsrdir{pitch}
982 Program reference: @internalsref{OttavaBracket}.
987 @code{set-octavation} will get confused when clef changes happen
988 during an octavation bracket.
991 @node Instrument transpositions
992 @unnumberedsubsubsec Instrument transpositions
994 @cindex transposition, MIDI
995 @cindex transposition, instrument
997 The key of a @notation{transposing instrument} can be specified.
998 This applies to many wind instruments, for example, clarinets
999 (B-flat, A, and E-flat), horn (F) and trumpet (B-flat, C, D, and
1002 The transposition is entered with the command
1005 \transposition @var{pitch}
1009 where @var{pitch} specifies the key in which the instrument plays.
1010 For example, a part for B-flat clarinet would include
1016 This command sets the property @code{instrumentTransposition}.
1017 The value of this property is used for MIDI output and quotations.
1018 MIDI output is transposed to play at concert pitch, and cue notes
1019 and quotations are automatically transposed to the key of the
1020 instrument in which they are quoted. For more information about
1021 quotations, see @ref{Quoting other voices}.
1023 The pitch to use for @code{\transposition} should correspond to
1024 the real sound heard when a @code{c'} written on the staff is
1025 played by the transposing instrument. @code{\transposition}
1026 should be used when the music is entered from an orchestral part
1027 written for the instrument. For example, in classical horn parts,
1028 the tuning of the instrument is often changed during a piece.
1029 Here are a few notes for a violin and a B-flat clarinet where the
1030 parts have been entered using the notes and key as they appear in
1031 each part or the conductor's score:
1033 @lilypond[quote,ragged-right,verbatim]
1035 \new Staff = "Violin I" {
1036 \set Staff.instrumentName = "Vln"
1037 \set Staff.midiInstrument="violin"
1040 g'4( c''8) r c'' r c''4
1042 \new Staff = "Clarinet" {
1043 \set Staff.instrumentName = "Cl"
1044 \set Staff.midiInstrument="clarinet"
1047 a'4( d''8) r d'' r d''4
1052 Without the @code{\transposition} command the midi output of this
1053 music would play the notes a tone apart; with it the notes are
1054 played correctly in unison.
1056 However, when entering the notes of a score in concert pitch, when
1057 all voices are entered in C, they may be prefaced by (the default)
1058 @code{\transposition c'}:
1072 to serve as a reminder that these parts are written in C.
1077 Notation reference: @ref{Quoting other voices}, @ref{Transpose}.
1079 Snippets: @lsrdir{pitch}
1082 @node Automatic accidentals
1083 @unnumberedsubsubsec Automatic accidentals
1084 @cindex Automatic accidentals
1086 Common rules for typesetting accidentals have been placed in a
1087 function. This function is called as follows
1089 @funindex set-accidental-style
1091 #(set-accidental-style 'STYLE)
1094 @c TODO: check the context stuff below
1095 @c -does it *really* work?
1096 @c -the default contexts as specified in
1097 @c scm/music-function.scm seem to be different -vv
1099 Optionally, the function can take two arguments: the name of the
1100 accidental style, and an optional argument that denotes the context that
1104 #(set-accidental-style 'STYLE #('CONTEXT#))
1107 If no context name is supplied, @code{Staff} is the default,
1108 but you may wish to apply the accidental style to a single @code{Voice}
1111 The following accidental styles are supported:
1115 This is the default typesetting behavior. It corresponds
1116 to 18th century common practice: Accidentals are
1117 remembered to the end of the measure in which they occur and
1118 only on their own octave.
1120 @lilypond[quote,ragged-right]
1121 musicA = { << \relative { cis'8 fis, d'4 <a cis>8 f bis4 | cis2. <c, g'>4 | } \\
1122 \relative { ais'2 cis, | fis8 b a4 cis2 | } >> }
1124 musicB = { \clef bass \new Voice { \voiceTwo \relative { < fis, a cis>4
1125 \change Staff = up cis' \change Staff = down <fis, a>
1126 \change Staff = up dis' | \change Staff = down <fis, a cis>4 gis
1131 << \context Staff = "up" {
1132 %#(set-accidental-style 'default)
1134 \context Staff = "down"{
1135 %#(set-accidental-style 'default)
1137 \header { piece = \markup {\fill-line { \fontsize #3 "'default" }}}
1142 The normal behavior is to remember the accidentals on
1143 Staff-level. This variable, however, typesets accidentals
1144 individually for each voice. Apart from that, the rule is similar to
1149 #(set-accidental-style 'voice)
1154 As a result, accidentals from one voice do not get canceled in other
1155 voices, which is often an unwanted result: in the following example, it
1156 is hard to determine whether the second @samp{a} should be played
1159 @lilypond[quote,ragged-right]
1160 musicA = { << \relative { cis'8 fis, d'4 <a cis>8 f bis4 | cis2. <c, g'>4 | } \\
1161 \relative { ais'2 cis, | fis8 b a4 cis2 | } >> }
1163 musicB = { \clef bass \new Voice { \voiceTwo \relative { < fis, a cis>4
1164 \change Staff = up cis' \change Staff = down <fis, a>
1165 \change Staff = up dis' | \change Staff = down <fis, a cis>4 gis
1170 << \context Staff = "up" {
1171 #(set-accidental-style 'voice)
1173 \context Staff = "down"{
1174 #(set-accidental-style 'voice)
1176 \header { piece = \markup {\fill-line { \fontsize #3 "'voice" }}}
1180 The @code{voice} option should be used if the voices
1181 are to be read solely by individual musicians. If the staff is to be
1182 used by one musician (e.g., a conductor) then
1183 @code{modern} or @code{modern-cautionary}
1184 should be used instead.
1187 @funindex modern style accidentals
1188 This rule corresponds to the common practice in the 20th century. This rule
1189 prints the same accidentals as @code{default}, but temporary
1190 accidentals also are canceled in other octaves. Furthermore,
1191 in the same octave, they also get canceled in the following
1192 measure: in the following example, notice the two natural signs which appear
1193 in the second bar of the upper staff.
1195 @lilypond[quote,ragged-right]
1196 musicA = { << \relative { cis'8 fis, d'4 <a cis>8 f bis4 | cis2. <c, g'>4 | } \\
1197 \relative { ais'2 cis, | fis8 b a4 cis2 | } >> }
1199 musicB = { \clef bass \new Voice { \voiceTwo \relative { < fis, a cis>4
1200 \change Staff = up cis' \change Staff = down <fis, a>
1201 \change Staff = up dis' | \change Staff = down <fis, a cis>4 gis
1206 << \context Staff = "up" {
1207 #(set-accidental-style 'modern)
1209 \context Staff = "down"{
1210 #(set-accidental-style 'modern)
1212 \header { piece = \markup {\fill-line { \fontsize #3 "'modern" }}}
1216 @item @code{modern-cautionary}
1217 @funindex modern-cautionary
1218 This rule is similar to @code{modern}, but the @q{extra} accidentals
1219 (the ones not typeset by @code{default}) are typeset as cautionary
1220 accidentals. They are printed in reduced size or (by default)
1221 with parentheses -- this can be set by definig the @code{cautionary-style}
1222 property of the @internalsref{AccidentalSuggestion} object.
1224 @lilypond[quote,ragged-right]
1225 musicA = { << \relative { cis'8 fis, d'4 <a cis>8 f bis4 | cis2. <c, g'>4 | } \\
1226 \relative { ais'2 cis, | fis8 b a4 cis2 | } >> }
1228 musicB = { \clef bass \new Voice { \voiceTwo \relative { < fis, a cis>4
1229 \change Staff = up cis' \change Staff = down <fis, a>
1230 \change Staff = up dis' | \change Staff = down <fis, a cis>4 gis
1235 << \context Staff = "up" {
1236 #(set-accidental-style 'modern-cautionary)
1238 \context Staff = "down"{
1239 #(set-accidental-style 'modern-cautionary)
1241 \header { piece = \markup {\fill-line { \fontsize #3 "'modern-cautionary" }}}
1245 @funindex modern-voice
1247 This rule is used for multivoice accidentals to be read both by musicians
1248 playing one voice and musicians playing all voices. Accidentals are
1249 typeset for each voice, but they @emph{are} canceled across voices in
1250 the same @internalsref{Staff}.
1252 @lilypond[quote,ragged-right]
1253 musicA = { << \relative { cis'8 fis, d'4 <a cis>8 f bis4 | cis2. <c, g'>4 | } \\
1254 \relative { ais'2 cis, | fis8 b a4 cis2 | } >> }
1256 musicB = { \clef bass \new Voice { \voiceTwo \relative { < fis, a cis>4
1257 \change Staff = up cis' \change Staff = down <fis, a>
1258 \change Staff = up dis' | \change Staff = down <fis, a cis>4 gis
1263 << \context Staff = "up" {
1264 #(set-accidental-style 'modern-voice)
1266 \context Staff = "down"{
1267 #(set-accidental-style 'modern-voice)
1269 \header { piece = \markup {\fill-line { \fontsize #3 "'modern-voice" }}}
1273 @funindex modern-voice-cautionary
1274 @item modern-voice-cautionary
1275 This rule is the same as @code{modern-voice}, but with the extra
1276 accidentals (the ones not typeset by @code{voice}) typeset
1277 as cautionaries. Even though all accidentals typeset by
1278 @code{default} @emph{are} typeset by this variable,
1279 some of them are typeset as cautionaries.
1281 @lilypond[quote,ragged-right]
1282 musicA = { << \relative { cis'8 fis, d'4 <a cis>8 f bis4 | cis2. <c, g'>4 | } \\
1283 \relative { ais'2 cis, | fis8 b a4 cis2 | } >> }
1285 musicB = { \clef bass \new Voice { \voiceTwo \relative { < fis, a cis>4
1286 \change Staff = up cis' \change Staff = down <fis, a>
1287 \change Staff = up dis' | \change Staff = down <fis, a cis>4 gis
1292 << \context Staff = "up" {
1293 #(set-accidental-style 'modern-voice-cautionary)
1295 \context Staff = "down"{
1296 #(set-accidental-style 'modern-voice-cautionary)
1298 \header { piece = \markup {\fill-line { \fontsize #3 "'modern-voice-cautionary" }}}
1303 @funindex piano accidentals
1304 This accidental style takes place in a GrandStaff context. However, you have to
1305 explicitly set it for @emph{each} individual Staff of the GrandStaff:
1308 \new GrandStaff @{ <<
1309 \new Staff = "up" @{ <<
1310 #(set-accidental-style 'piano)
1313 \new Staff = "down"@{ <<
1314 #(set-accidental-style 'piano)
1320 This rule reflects 20th century practice for piano notation. Its behavior is very
1321 similar to @code{modern} style, but here accidentals also get canceled
1322 across the staves in the same @internalsref{GrandStaff} or
1323 @internalsref{PianoStaff}.
1325 @lilypond[quote,ragged-right]
1326 musicA = { << \relative { cis'8 fis, d'4 <a cis>8 f bis4 | cis2. <c, g'>4 | } \\
1327 \relative { ais'2 cis, | fis8 b a4 cis2 | } >> }
1329 musicB = { \clef bass \new Voice { \voiceTwo \relative { < fis, a cis>4
1330 \change Staff = up cis' \change Staff = down <fis, a>
1331 \change Staff = up dis' | \change Staff = down <fis, a cis>4 gis
1336 << \context Staff = "up" {
1337 #(set-accidental-style 'piano)
1339 \context Staff = "down"{
1340 #(set-accidental-style 'piano)
1342 \header { piece = \markup {\fill-line { \fontsize #3 "'piano" }}}
1346 @item piano-cautionary
1347 @funindex #(set-accidental-style 'piano-cautionary)
1348 Same as @code{#(set-accidental-style 'piano)} but with the extra
1349 accidentals typeset as cautionaries.
1351 @lilypond[quote,ragged-right]
1352 musicA = { << \relative { cis'8 fis, d'4 <a cis>8 f bis4 | cis2. <c, g'>4 | } \\
1353 \relative { ais'2 cis, | fis8 b a4 cis2 | } >> }
1355 musicB = { \clef bass \new Voice { \voiceTwo \relative { < fis, a cis>4
1356 \change Staff = up cis' \change Staff = down <fis, a>
1357 \change Staff = up dis' | \change Staff = down <fis, a cis>4 gis
1362 << \context Staff = "up" {
1363 #(set-accidental-style 'piano-cautionary)
1365 \context Staff = "down"{
1366 #(set-accidental-style 'piano-cautionary)
1368 \header { piece = \markup {\fill-line { \fontsize #3 "'piano-cautionary" }}}
1373 @funindex no-reset accidental style
1374 This is the same as @code{default} but with accidentals lasting
1375 @q{forever} and not only until the next measure:
1376 @lilypond[quote,ragged-right]
1377 musicA = { << \relative { cis'8 fis, d'4 <a cis>8 f bis4 | cis2. <c, g'>4 | } \\
1378 \relative { ais'2 cis, | fis8 b a4 cis2 | } >> }
1380 musicB = { \clef bass \new Voice { \voiceTwo \relative { < fis, a cis>4
1381 \change Staff = up cis' \change Staff = down <fis, a>
1382 \change Staff = up dis' | \change Staff = down <fis, a cis>4 gis
1387 << \context Staff = "up" {
1388 #(set-accidental-style 'no-reset)
1390 \context Staff = "down"{
1391 #(set-accidental-style 'no-reset)
1393 \header { piece = \markup {\fill-line { \fontsize #3 "'no-reset" }}}
1398 This is sort of the opposite of @code{no-reset}: Accidentals
1399 are not remembered at all -- and hence all accidentals are
1400 typeset relative to the key signature, regardless of what was
1403 @lilypond[quote,ragged-right]
1404 musicA = { << \relative { cis'8 fis, d'4 <a cis>8 f bis4 | cis2. <c, g'>4 | } \\
1405 \relative { ais'2 cis, | fis8 b a4 cis2 | } >> }
1407 musicB = { \clef bass \new Voice { \voiceTwo \relative { < fis, a cis>4
1408 \change Staff = up cis' \change Staff = down <fis, a>
1409 \change Staff = up dis' | \change Staff = down <fis, a cis>4 gis
1414 << \context Staff = "up" {
1415 #(set-accidental-style 'forget)
1417 \context Staff = "down"{
1418 #(set-accidental-style 'forget)
1420 \header { piece = \markup {\fill-line { \fontsize #3 "'forget" }}}
1428 Program reference: @internalsref{Accidental_engraver},
1429 @internalsref{Accidental}, @internalsref{AccidentalSuggestion} and @internalsref{AccidentalPlacement}.
1434 Simultaneous notes are considered to be entered in sequential
1435 mode. This means that in a chord the accidentals are typeset as if the
1436 notes in the chord happen one at a time, in the order in which
1437 they appear in the input file. This is a problem when accidentals
1438 in a chord depend on each other,
1439 which does not happen for the default accidental style. The problem
1440 can be solved by manually inserting @code{!} and @code{?} for the