]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/user/pitches.itely
Remove obsolete @refcommand from macros.
[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 This section discusses how to specify the pitch of notes.
14
15 @lilypondfile[ragged-right,line-width=16\cm,staffsize=16,quote]
16 {pitches-headword.ly}
17
18 @menu
19 * Writing pitches::             
20 * Changing multiple pitches::   
21 * Displaying pitches::          
22 @end menu
23
24
25 @node Writing pitches
26 @subsection Writing pitches
27
28 Intro text.
29
30 @menu
31 * Absolute octave entry::       
32 * Relative octave entry::       
33 * Accidentals::                 
34 * Note names in other languages::  
35 @end menu
36
37
38 @node Absolute octave entry
39 @unnumberedsubsubsec Absolute octave entry
40
41 @cindex Pitch names
42 @cindex pitches
43
44 A pitch name is specified using lowercase letters @code{a} through
45 @code{g}.  An ascending C-major scale is engraved with
46
47 @lilypond[quote,fragment,verbatim,ragged-right]
48 \clef bass
49 c d e f g a b c'
50 @end lilypond
51
52 There are two different ways to enter these note names with regard
53 to octave placement: absolute and relative.  The relative mode
54 will in most cases be the most convenient, but the absolute mode
55 is more fundamental and will be presented first.
56
57 @cindex Absolute
58 @cindex Absolute octave specification
59
60 In absolute mode, every note is placed explicitly in a certain
61 octave.  The note names @code{c} to @code{b} are engraved in the
62 octave below middle C, as in the previous example.
63
64 @lilypond[quote,fragment,verbatim,ragged-right]
65 \clef treble
66 c1
67 \clef bass
68 c1
69 @end lilypond
70
71 @funindex '
72 @funindex ,
73
74 If a note should be in another octave than this, an octave
75 specification must be given.  It takes the form of a series of
76 single quote (@samp{'}) or comma (@samp{,}) characters.  Each
77 @samp{'} raises the pitch by one octave; each @samp{,} lowers the
78 pitch by an octave.
79
80 @lilypond[quote,ragged-right,fragment,verbatim]
81 \clef treble
82 c' c'' e' g d'' d' d c
83 \clef bass
84 c, c,, e, g d,, d, d c
85 @end lilypond
86
87
88 @node Relative octave entry
89 @unnumberedsubsubsec Relative octaves entry
90
91 @cindex Relative
92 @cindex Relative octave specification
93 @funindex \relative
94
95 The absolute mode requires a lot of octave specifications, which
96 not only becomes tedious but also easily leads to errors.
97 Therefore, it is usually more convenient to let notes be entered
98 relative to the previous note.  This is done with the relative
99 mode.  
100
101 @example
102 \relative @var{startpitch} @var{musicexpr}
103 @end example
104
105 In relative mode, each note is assumed to be as close to the
106 previous note as possible.  This means that the octave of notes
107 that appear in @var{musicexpr} are calculated as follows:
108
109 @itemize
110 @item 
111 The pitch of the first note is relative to @code{\relative
112 @var{startpitch} }.  
113
114 @item
115 If no octave changing marks are used, the basic interval between a
116 note and the one that precedes it is always taken to be a fourth
117 or less.
118
119 @item
120 This distance is determined without regarding alterations or the
121 actual sounding pitches; a @code{fisis} following a @code{ceses}
122 will be put above the @code{ceses}.  In other words, a
123 doubly-augmented fourth is considered a smaller interval than a
124 diminished fifth, even though the doubly-augmented fourth spans
125 seven semitones while the diminished fifth only spans six
126 semitones.
127
128 @item
129 The octave changing marks @code{'} and @code{,} can be added to
130 raise or lower the pitch by an extra octave from the basic
131 interval.
132
133 @item
134 Multiple octave changing marks can be used.  @code{''} will raise
135 the pitch by two octaves.
136
137 @end itemize 
138
139 Here is the relative mode shown in action:
140
141 @lilypond[quote,fragment,ragged-right,verbatim]
142 \relative c'' {
143   b c d c b c bes a
144 }
145 @end lilypond
146
147 Octave changing marks are used for intervals greater than a
148 fourth:
149
150 @lilypond[quote,ragged-right,fragment,verbatim]
151 \relative c'' {
152   c g c f, c' a, e''
153 }
154 @end lilypond
155
156 A note sequence without a single octave mark can nevertheless span
157 large intervals:
158
159 @lilypond[quote,ragged-right,fragment,verbatim]
160 \relative c {
161   c f b e a d g
162 }
163 @end lilypond
164
165 If the preceding item is a chord, the first note of the chord is
166 used as the reference point for the octave placement of a
167 following note or chord:
168
169 @lilypond[quote,ragged-right,fragment,verbatim]
170 \relative c' {
171   c <c e g>
172   <c' e g>
173   <c, e' g> c
174 }
175 @end lilypond
176
177 The @var{startpitch} (after @code{\relative}) is a note name in
178 absolute mode.  In principle it can be any note name, but common
179 practice is to use @code{c} in various octave positions. 
180
181 When octaves are specified as above by adding @code{'} and
182 @code{,} to pitch names, it is easy to accidentally put a pitch in
183 the wrong octave.  The relative octave mode prevents these errors
184 since most of the time it is not necessary to indicate any octaves
185 at all.  Furthermore, in absolute mode, a single mistake may be
186 difficult to spot; in relative mode, a single error puts the rest
187 of the piece off by one octave.
188
189 @seealso
190
191 Snippets: @lsrdir{pitch}
192
193
194 @refbugs
195
196 The relative conversion will not affect @code{\transpose},
197 @code{\chordmode} or @code{\relative} sections in its argument.
198 To use relative within transposed music, an additional
199 @code{\relative} must be placed inside @code{\transpose}.
200
201 @c DEPRECATED
202 If no @var{startpitch} is specified for @code{\relative}, then
203 @code{c'} is assumed.  However, this is a deprecated option and
204 may disappear in future versions, so its use is discouraged.
205
206
207
208
209 @node Accidentals
210 @unnumberedsubsubsec Accidentals
211
212 @cindex note names, Dutch
213 @cindex note names, default
214
215 @c following paragraph changed to match Tutorial and Accidental
216 @c and Key Signature pages.  
217
218 A @rglos{sharp} pitch is made by adding @samp{is} to the name, and
219 a @rglos{flat} pitch by adding @samp{es}.  As you might expect,
220 a @rglos{double sharp} or @rglos{double flat} is made by adding
221 @samp{isis} or @samp{eses}.  This syntax derived from note naming
222 conventions in Nordic and Germanic languages, like German and
223 Dutch.  To use other names for accidentals, see @ref{Note names
224 in other languages}.
225
226 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
227 a2 ais a aes
228 a2 aisis a aeses
229 @end lilypond
230
231 @noindent
232 These are the Dutch note names.  In Dutch, @code{aes} is
233 contracted to @code{as}, but both forms are accepted.  Similarly,
234 both @code{es} and @code{ees} are accepted:
235
236 @lilypond[fragment,quote,ragged-right,verbatim,relative=2]
237 a2 as e es
238 @end lilypond
239
240 A natural will cancel the effect of an accidental or key
241 signature.  However, naturals are not encoded into the note name
242 syntax with a suffix; a natural pitch is shown as a simple note
243 name:
244
245 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
246 a4 aes a2
247 @end lilypond
248
249 The input @code{d e f} is interpreted as @q{print a D-natural,
250 E-natural, and an F-natural,} regardless of the key signature.
251 For more information about the distinction between musical content
252 and the presentation of that content, see @rlearning{Accidentals
253 and key signatures}.
254
255 @lilypond[fragment,quote,ragged-right,verbatim,relative]
256 \key d \major
257 d e f g
258 d e fis g
259 @end lilypond
260
261
262
263 @cindex accidental, reminder
264 @cindex accidental, cautionary
265 @cindex accidental, parenthesized
266 @cindex reminder accidental
267 @funindex ?
268 @cindex cautionary accidental
269 @cindex parenthesized accidental
270 @funindex !
271
272 Normally accidentals are printed automatically, but you may also
273 print them manually.  A reminder accidental can be forced by
274 adding an exclamation mark @code{!} after the pitch.  A cautionary
275 accidental (i.e., an accidental within parentheses) can be
276 obtained by adding the question mark @samp{?} after the pitch.
277 These extra accidentals can be used to produce natural signs, too.
278
279 @lilypond[quote,ragged-right,fragment,verbatim,relative=1]
280 cis cis cis! cis? c c? c! c
281 @end lilypond
282
283
284 @cindex quarter tones
285 @cindex semi-flats, semi-sharps
286
287 Half-flats and half-sharps are formed by adding @code{-eh} and
288 @code{-ih}; the following is a series of Cs with increasing
289 pitches
290
291 @lilypond[verbatim,ragged-right,quote,relative=2,fragment]
292 \set Staff.extraNatural = ##f
293 ceseh ceh cih cisih
294 @end lilypond
295
296 Micro tones are also exported to the MIDI file.
297
298
299 @commonprop
300
301 In accordance with standard typesetting rules, a natural sign is
302 printed before a sharp or flat if a previous accidental needs to
303 be cancelled.  To change this behavior, use @code{\set
304 Staff.extraNatural = ##f}
305
306 @lilypond[fragment,quote,ragged-right,verbatim,relative=2]
307 ceses4 ces cis c
308 \set Staff.extraNatural = ##f
309 ceses4 ces cis c
310 @end lilypond
311
312
313 @seealso
314
315 The automatic production of accidentals can be tuned in many ways
316 concerning for how long an accidental is considered to last.  For
317 more information, see @ref{Automatic accidentals}.
318
319 For @emph{musica ficta}, editorial accidentals placed above the
320 staff commonly used in editions of early music, see @ref{Musica
321 ficta accidentals}.
322
323 Program reference: @internalsref{LedgerLineSpanner},
324 @internalsref{NoteHead}.
325
326
327 @refbugs
328
329 There are no generally accepted standards for denoting
330 three-quarter flats, so LilyPond's symbol does not conform to any
331 standard.
332
333
334
335 @node Note names in other languages
336 @unnumberedsubsubsec Note names in other languages
337
338 There are predefined sets of note names for various other
339 languages.  To use them, include the language specific init file.
340 For example, add @code{\include "english.ly"} to the top of the
341 input file.  The available language files and the note names they
342 define are:
343
344 @cindex note names, other languages
345
346 @example
347 @multitable @columnfractions .2 .6 .05 .05 .05 .05
348 @headitem Language
349   @tab Note names
350   @tab sharp @tab flat @tab double sharp @tab double flat
351 @item netherlands.ly
352   @tab c d e f g a bes b
353   @tab -is @tab -es @tab -isis @tab -eses
354 @item english.ly
355   @tab c d e f g a bf b 
356   @tab -s/-sharp @tab -f/-flat @tab -ss/-x/-sharpsharp
357     @tab -ff/-flatflat
358 @item deutsch.ly
359   @tab c d e f g a b h 
360   @tab -is @tab -es @tab -isis @tab -eses
361 @item norsk.ly
362   @tab c d e f g a b h 
363   @tab -iss/-is @tab -ess/-es @tab -ississ/-isis
364     @tab -essess/-eses
365 @item svenska.ly
366   @tab c d e f g a b h 
367   @tab -iss @tab -ess @tab -ississ @tab -essess
368 @item italiano.ly
369   @tab do re mi fa sol la sib si 
370   @tab -d @tab -b @tab -dd @tab -bb
371 @item catalan.ly
372   @tab do re mi fa sol la sib si 
373   @tab -d/-s @tab -b @tab -dd/-ss @tab -bb
374 @item espanol.ly
375   @tab do re mi fa sol la sib si 
376   @tab -s @tab -b @tab -ss @tab -bb
377 @end multitable
378 @end example
379
380 @noindent
381 Note that in Dutch, German, Norwegian, and Swedish, the flat
382 alterations of @samp{a} like for example @code{aes} and
383 @code{aeses} are usually contracted to @code{as} and @code{ases}
384 (or more commonly @code{asas}).  Sometimes only these contracted
385 names are defined in the corresponding language files (this also
386 applies to the suffixes for quartertones below).
387
388 @noindent
389 Some music uses microtones whose alterations are fractions of a
390 @q{regular} sharp or flat.  The note names for quartertones
391 defined in the various language files are listed in the following
392 table.  Here the prefixes @q{semi-} and @q{sesqui-} mean @q{half}
393 and @q{one and a half}, respectively.  For Norwegian, Swedish,
394 Catalan and Spanish no special names have been defined yet.
395
396
397 @c What about Turkish Maquam music and similar microtonal systems?
398 @c
399 @c Note that the term "three-quarter-sharp/-flat" used in lilypond's source code 
400 @c is actually misleading since the alteration is in fact one and a half
401 @c of a regular sharp/flat.  Whence the naming "sesqui-sharp/-flat" used below.
402
403 @example
404 @multitable @columnfractions .2 .6 .05 .05 .05 .05
405 @headitem Language
406   @tab Note names
407   @tab semi- @tab semi- @tab sesqui- @tab sesqui-
408
409 @item nederlands.ly
410   @tab c d e f g a bes b 
411   @tab -ih @tab -eh @tab -isih @tab -eseh
412 @item english.ly
413   @tab c d e f g a bf b 
414   @tab -qs @tab -qf @tab -tqs @tab -tqf
415 @item deutsch.ly
416   @tab c d e f g a b h 
417   @tab -ih @tab -eh @tab -isih @tab -eseh
418 @c @item norsk.ly
419 @c   @tab c d e f g a b h 
420 @c @item svenska.ly
421 @c   @tab c d e f g a b h 
422 @item italiano.ly
423   @tab do re mi fa sol la sib si 
424   @tab -sd @tab -sb @tab -dsd @tab -bsb
425 @c @item catalan.ly 
426 @c   @tab do re mi fa sol la sib si 
427 @c @item  espanol.ly 
428 @c   @tab do re mi fa sol la sib si 
429 @end multitable
430 @end example
431
432 @node Changing multiple pitches
433 @subsection Changing multiple pitches
434
435 @menu
436 * Octave check::                
437 * Transpose::                   
438 @end menu
439
440 @node Octave check
441 @unnumberedsubsubsec Octave check
442
443 @cindex Octave check
444
445 Octave checks make octave errors easier to correct: a note may be
446 followed by @code{=}@var{quotes} which indicates what its absolute
447 octave should be.  In the following example,
448
449 @example
450 \relative c'' @{ c='' b=' d,='' @}
451 @end example
452
453 @noindent
454 the @code{d} will generate a warning, because a @code{d''} is
455 expected (because @code{b'} to @code{d''} is only a third), but a
456 @code{d'} is found.  In the output, the octave is corrected to be
457 a @code{d''} and the next note is calculated relative to
458 @code{d''} instead of @code{d'}.
459
460 There is also an octave check that produces no visible output.
461 The syntax
462
463 @example
464 \octave @var{pitch}
465 @end example
466
467 This checks that @var{pitch} (without quotes) yields @var{pitch}
468 (with quotes) in @code{\relative} mode compared to the note given
469 in the @code{\relative} command.  If not, a warning is printed,
470 and the octave is corrected.  The @var{pitch} is not printed as a
471 note.
472
473 In the example below, the first check passes without incident,
474 since the @code{e} (in @code{relative} mode) is within a fifth of
475 @code{a'}.  However, the second check produces a warning, since
476 the @code{e} is not within a fifth of @code{b'}.  The warning
477 message is printed, and the octave is adjusted so that the
478 following notes are in the correct octave once again.
479
480 @example
481 \relative c' @{
482   e
483   \octave a'
484   \octave b'
485 @}
486 @end example
487
488
489 The octave of a note following an octave check is determined with
490 respect to the note preceding it.  In the next fragment, the last
491 note is an @code{a'}, above middle C.  That means that the
492 @code{\octave} check passes successfully, so the check could be
493 deleted without changing the output of the piece.
494
495 @lilypond[quote,ragged-right,verbatim,fragment]
496 \relative c' {
497   e
498   \octave b
499   a
500 }
501 @end lilypond
502
503
504 @node Transpose
505 @unnumberedsubsubsec Transpose
506
507 @cindex Transpose
508 @cindex Transposition of pitches
509 @funindex \transpose
510
511 A music expression can be transposed with @code{\transpose}.  The
512 syntax is
513
514 @example
515 \transpose @var{from} @var{to} @var{musicexpr}
516 @end example
517
518 This means that @var{musicexpr} is transposed by the interval
519 between the pitches @var{from} and @var{to}: any note with pitch
520 @code{from} is changed to @code{to} and any other note is
521 transposed by the same interval.
522
523 Consider a piece written in the key of D-major.  If this piece is
524 a little too low for its performer, it can be transposed up to
525 E-major with
526
527 @example
528 \transpose d e @dots{}
529 @end example
530
531 Consider a part written for violin (a C instrument).  If this part
532 is to be played on the A clarinet (for which an A is notated as a
533 C, and which sounds a minor third lower than notated), the
534 following transposition will produce the appropriate part:
535
536 @example
537 \transpose a c @dots{}
538 @end example
539
540 @code{\transpose} will also transpose key signatures:
541
542 @lilypond[quote,ragged-right,verbatim]
543 mus = { \key d \major cis d fis g }
544 \new Staff {
545   \clef "F" \mus
546   \clef "G"
547   \transpose c g' \mus
548   \transpose c f' \mus
549 }
550 @end lilypond
551
552 @code{\transpose} distinguishes between enharmonic pitches: both
553 @code{\transpose c cis} or @code{\transpose c des} will transpose
554 up half a tone.  The first version will print sharps and the notes
555 will remain on the same scale step, the second version will print
556 flats on the scale step above.
557
558 @lilypond[quote,ragged-right,verbatim]
559 mus = { c d e f }
560 \new Staff {
561   \transpose c cis { \relative c' \mus }
562   \transpose c des { \relative c' \mus }
563 }
564 @end lilypond
565
566
567
568 @code{\transpose} may also be used to input written notes for a
569 transposing instrument.  Pitches are normally entered into
570 LilyPond in C (or @q{concert pitch}), but they may be entered in
571 another key.  For example, when entering music for a B-flat
572 trumpet which begins on concert D, one would write
573
574 @example
575 \transpose c bes @{ e4 @dots{} @}
576 @end example
577
578 To print this music in B-flat again (i.e., producing a trumpet
579 part, instead of a concert pitch conductor's score) you would wrap
580 the existing music with another @code{transpose}
581
582 @example
583 \transpose bes c @{ \transpose c bes @{ e4 @dots{} @} @}
584 @end example
585
586
587 @seealso
588
589 Program reference: @internalsref{TransposedMusic}.
590
591 Example:
592 @lsr{scheme,transpose-pitches-with-minimum-accidentals.ly}.
593
594
595 @refbugs
596
597 If you want to use both @code{\transpose} and @code{\relative},
598 you must put @code{\transpose} outside of @code{\relative}, since
599 @code{\relative} will have no effect on music that appears inside
600 a @code{\transpose}.
601
602
603 @node Displaying pitches
604 @subsection Displaying pitches
605
606 @menu
607 * Clef::                        
608 * Key signature::               
609 * Ottava brackets::             
610 * Instrument transpositions::   
611 @end menu
612
613 @node Clef
614 @unnumberedsubsubsec Clef
615
616 @funindex \clef
617
618 The clef indicates which lines of the staff correspond to which
619 pitches.  The clef is set with the @code{\clef} command
620
621 @lilypond[quote,ragged-right,fragment,verbatim]
622 { c''2 \clef alto g'2 }
623 @end lilypond
624
625 @cindex treble clef
626 @cindex violin clef
627 @cindex alto clef
628 @cindex tenor clef
629 @cindex bass clef
630 @cindex french clef
631 @cindex soprano clef
632 @cindex mezzosoprano clef
633 @cindex baritone clef
634 @cindex varbaritone clef
635 @cindex subbass clef
636
637 Supported clefs include
638
639 @multitable @columnfractions .33 .66
640 @headitem Clef @tab Position
641 @item @code{treble}, violin, G, G2 @tab
642 G clef on 2nd line
643 @item @code{alto, C} @tab
644 C clef on 3rd line
645 @item @code{tenor} @tab
646 C clef on 4th line.
647 @item @code{bass, F} @tab
648 F clef on 4th line
649 @item @code{french} @tab
650 G clef on 1st line, so-called French violin clef
651 @item @code{soprano} @tab
652 C clef on 1st line
653 @item @code{mezzosoprano} @tab
654 C clef on 2nd line
655 @item @code{baritone} @tab
656 C clef on 5th line
657 @item @code{varbaritone} @tab
658 F clef on 3rd line
659 @item @code{subbass} @tab
660 F clef on 5th line
661 @item @code{percussion} @tab
662 percussion clef
663 @item @code{tab} @tab
664 tablature clef
665 @end multitable
666
667 By adding @code{_8} or @code{^8} to the clef name, the clef is
668 transposed one octave down or up, respectively, and @code{_15} and
669 @code{^15} transposes by two octaves.  The argument @var{clefname}
670 must be enclosed in quotes when it contains underscores or digits.
671 For example,
672
673 @cindex choral tenor clef
674 @lilypond[quote,ragged-right,verbatim,fragment,relative=1]
675 \clef "G_8" c4
676 @end lilypond
677
678
679 @commonprop
680
681 The command @code{\clef "treble_8"} is equivalent to setting
682 @code{clefGlyph}, @code{clefPosition} (which controls the Y
683 position of the clef), @code{middleCPosition} and
684 @code{clefOctavation}.  A clef is printed when any of these
685 properties are changed.  The following example shows possibilities
686 when setting properties manually.
687
688 @lilypond[quote,ragged-right,verbatim]
689 {
690   \set Staff.clefGlyph = #"clefs.F"
691   \set Staff.clefPosition = #2
692   c'4
693   \set Staff.clefGlyph = #"clefs.G"
694   c'4
695   \set Staff.clefGlyph = #"clefs.C"
696   c'4
697   \set Staff.clefOctavation = #7
698   c'4
699   \set Staff.clefOctavation = #0
700   \set Staff.clefPosition = #0
701   c'4
702   \clef "bass"
703   c'4
704   \set Staff.middleCPosition = #4
705   c'4
706 }
707 @end lilypond
708
709
710 @seealso
711
712 Program reference: @internalsref{Clef}.
713
714 This manual: @ref{Ancient clefs}.
715
716
717 @node Key signature
718 @unnumberedsubsubsec Key signature
719
720 @cindex Key signature
721 @funindex \key
722
723 The key signature indicates the tonality in which a piece is
724 played.  It is denoted by a set of alterations (flats or sharps)
725 at the start of the staff.
726
727 Setting or changing the key signature is done with the @code{\key}
728 command:
729
730 @example
731 @code{\key} @var{pitch} @var{type}
732 @end example
733
734 @funindex \minor
735 @funindex \major
736 @funindex \minor
737 @funindex \ionian
738 @funindex \locrian
739 @funindex \aeolian
740 @funindex \mixolydian
741 @funindex \lydian
742 @funindex \phrygian
743 @funindex \dorian
744 @cindex church modes
745
746 Here, @var{type} should be @code{\major} or @code{\minor} to get
747 @var{pitch}-major or @var{pitch}-minor, respectively.  You may
748 also use the standard mode names (also called @q{church modes}):
749 @code{\ionian}, @code{\locrian}, @code{\aeolian},
750 @code{\mixolydian}, @code{\lydian}, @code{\phrygian}, and
751 @code{\dorian}.
752
753 This command sets the context property @code{Staff.keySignature}.
754 Non-standard key signatures can be specified by setting this
755 property directly.  See @internalsref{Key_engraver}, and for an
756 example TODO.
757 @c TODO: LSR snippet 248.  leave this here for now -gp
758
759 @warning{The relationship between accidentals and key signatures can
760 be confusing to new users who think of the note letters as scale
761 steps and not as absolute pitches.  The note names that are
762 entered in a music expression are the raw material; key signatures
763 and clefs decide how this raw material is displayed.  Thus,
764 unaltered notes may get natural signs depending on the key
765 signature.  For more information, see @ref{Accidentals} and
766 @rlearning{Accidentals and key signatures}.}
767
768 @lilypond[quote,ragged-right,verbatim,relative=2,fragment]
769 \key g \major
770 f1
771 fis
772 @end lilypond
773
774
775 @commonprop
776
777 A natural sign is printed to cancel any previous accidentals.
778 This can be suppressed by setting the
779 @code{Staff.printKeyCancellation} property.
780
781 @lilypond[quote,fragment,ragged-right,verbatim,relative=2]
782 \key d \major
783 a b cis d
784 \key g \minor
785 a bes c d
786 \set Staff.printKeyCancellation = ##f
787 \key d \major
788 a b cis d
789 \key g \minor
790 a bes c d
791 @end lilypond
792
793
794 @seealso
795
796 Program reference: @internalsref{KeyCancellation},
797 @internalsref{KeySignature}.
798
799
800 @node Ottava brackets
801 @unnumberedsubsubsec Ottava brackets
802
803 @q{Ottava} brackets introduce an extra transposition of an octave
804 for the staff.  They are created by invoking the function
805 @code{set-octavation}
806
807 @cindex ottava
808 @cindex 15ma
809 @cindex 8va
810 @cindex 8ve
811 @cindex octavation
812
813 @lilypond[quote,ragged-right,verbatim,fragment]
814 \relative c''' {
815   a2 b
816   #(set-octavation 1)
817   a b
818   #(set-octavation 0)
819   a b
820 }
821 @end lilypond
822
823 The @code{set-octavation} function also takes -1 (for 8va bassa),
824 2@tie{}(for 15ma), and -2 (for 15ma bassa) as arguments.
825 Internally the function sets the properties @code{ottavation}
826 (e.g., to @code{"8va"} or @code{"8vb"}) and
827 @code{centralCPosition}.  To override the text of the bracket, set
828 @code{ottavation} after invoking @code{set-octavation}, i.e.,
829
830 @lilypond[quote,ragged-right,verbatim]
831 {
832   #(set-octavation 1)
833   \set Staff.ottavation = #"8"
834   c'''
835 }
836 @end lilypond
837
838
839 @seealso
840
841 Program reference: @internalsref{OttavaBracket}.
842
843
844 @refbugs
845
846 @code{set-octavation} will get confused when clef changes happen
847 during an octavation bracket.
848
849
850 @node Instrument transpositions
851 @unnumberedsubsubsec Instrument transpositions
852
853 @cindex transposition, MIDI
854 @cindex transposition, instrument
855
856 The key of a transposing instrument can also be specified.  This
857 applies to many wind instruments, for example, clarinets (B-flat,
858 A, and E-flat), horn (F) and trumpet (B-flat, C, D, and E-flat).
859
860 The transposition is entered after the keyword
861 @code{\transposition}
862
863 @example
864 \transposition bes   %% B-flat clarinet
865 @end example
866
867 @noindent
868 This command sets the property @code{instrumentTransposition}.
869 The value of this property is used for MIDI output and quotations.
870 It does not affect how notes are printed in the current staff.  To
871 change the printed output, see @ref{Transpose}.
872
873 The pitch to use for @code{\transposition} should correspond to
874 the real sound heard when a @code{c'} written on the staff is
875 played by the transposing instrument.  For example, when entering
876 a score in concert pitch, typically all voices are entered in C,
877 so they should be entered as
878
879 @example
880 clarinet = @{
881   \transposition c'
882   ...
883 @}
884 saxophone = @{
885   \transposition c'
886   ...
887 @}
888 @end example
889
890 The command @code{\transposition} should be used when the music is
891 entered from a (transposed) orchestral part.  For example, in
892 classical horn parts, the tuning of the instrument is often
893 changed during a piece.  When copying the notes from the part, use
894 @code{\transposition}, e.g.,
895
896 @example
897 \transposition d'
898 c'4^"in D"
899 ...
900 \transposition g'
901 c'4^"in G"
902 ...
903 @end example
904