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