]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/user/keyboards.itely
Merge branch 'master' of ssh+git://git.sv.gnu.org/srv/git/lilypond
[lilypond.git] / Documentation / user / keyboards.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 @c \version "2.11.38"
10
11 @node Keyboard instruments
12 @section Keyboard instruments
13 @c@node Piano music
14 @c@section Piano music
15
16 @menu
17 * Piano sections::              
18 @end menu
19
20 @node Piano sections
21 @subsection Piano sections
22
23 Piano staves are two normal staves coupled with a brace.  The staves
24 are largely independent, but sometimes voices can cross between the
25 two staves.  The same notation is also used for harps and other key
26 instruments.  The @internalsref{PianoStaff} is especially built to
27 handle this cross-staffing behavior.  In this section we discuss the
28 @internalsref{PianoStaff} and some other pianistic peculiarities.
29
30 @menu
31 * Automatic staff changes::     
32 * Manual staff switches::       
33 * Pedals::                      
34 * Staff switch lines::          
35 * Cross staff stems::           
36 @end menu
37
38 @knownissues
39
40 Dynamics are not centered, but workarounds do exist.  See the
41 @q{piano centered dynamics} template in @rlearning{Piano templates}.
42
43 @cindex cross staff stem
44 @cindex stem, cross staff
45 @cindex distance between staves in piano music
46
47
48 @node Automatic staff changes
49 @subsubsection Automatic staff changes
50 @cindex Automatic staff changes
51
52 Voices can be made to switch automatically between the top and the bottom
53 staff.  The syntax for this is
54
55 @quotation
56 @example
57 \autochange @dots{}@var{music}@dots{}
58 @end example
59 @end quotation
60
61 @noindent
62 This will create two staves inside the current PianoStaff, called
63 @code{up} and @code{down}.  The lower staff will be in bass clef by
64 default.
65
66 A @code{\relative} section that is outside of @code{\autochange} has
67 no effect on the pitches of @var{music}, so, if necessary, put
68 @code{\relative} inside @code{\autochange} like
69
70 @quotation
71 @example
72 \autochange \relative @dots{} @dots{}
73 @end example
74 @end quotation
75
76
77 The autochanger switches on basis of the pitch (middle C is the turning
78 point), and it looks ahead skipping over rests to switch in
79 advance.  Here is a practical example
80
81 @lilypond[quote,verbatim,ragged-right]
82 \new PianoStaff
83   \autochange \relative c'
84   {
85     g4 a b c d r4 a g
86   }
87 @end lilypond
88
89
90 @seealso
91
92 Notation Reference: @ref{Manual staff switches}.
93
94 Internals Reference: @internalsref{AutoChangeMusic}.
95
96
97
98 @knownissues
99
100 The staff switches may not end up in optimal places.  For high
101 quality output, staff switches should be specified manually.
102
103
104 @code{\autochange} cannot be inside @code{\times}.
105
106
107 @node Manual staff switches
108 @subsubsection Manual staff switches
109
110 @cindex manual staff switches
111 @cindex staff switch, manual
112
113 Voices can be switched between staves manually, using the command
114 @example
115 \change Staff = @var{staffname} @var{music}
116 @end example
117
118 @noindent
119 The string @var{staffname} is the name of the staff.  It switches the
120 current voice from its current staff to the Staff called
121 @var{staffname}.  Typically @var{staffname} is @code{"up"} or
122 @code{"down"}.  The @code{Staff} referred to must already exist, so
123 usually the setup for a score will start with a setup of the staves,
124
125 @example
126 <<
127   \new Staff = "up" @{
128     \skip 1 * 10  % @emph{keep staff alive}
129     @}
130   \new Staff = "down" @{
131     \skip 1 * 10  % @emph{idem}
132     @}
133 >>
134 @end example
135
136
137 and the @code{Voice} is inserted afterwards
138
139 @example
140 \context Staff = down
141   \new Voice @{ @dots{} \change Staff = up @dots{} @}
142 @end example
143
144
145 @node Pedals
146 @subsubsection Pedals
147 @cindex Pedals
148
149 Pianos have pedals that alter the way sound is produced.  Generally, a
150 piano has three pedals, sustain, una corda, and sostenuto.
151
152
153 Piano pedal instruction can be expressed by attaching
154 @code{\sustainDown}, @code{\sustainUp}, @code{\unaCorda},
155 @code{\treCorde}, @code{\sostenutoDown} and @code{\sostenutoUp} to a
156 note or chord
157
158 @lilypond[quote,ragged-right,fragment,verbatim]
159 c'4\sustainDown c'4\sustainUp
160 @end lilypond
161
162 What is printed can be modified by setting @code{pedal@var{X}Strings},
163 where @var{X} is one of the pedal types: @code{Sustain},
164 @code{Sostenuto} or @code{UnaCorda}.  Refer to
165 @internalsref{SustainPedal} in the program reference for more
166 information.
167
168 Pedals can also be indicated by a sequence of brackets, by setting the
169 @code{pedalSustainStyle} property to bracket objects
170
171 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
172 \set Staff.pedalSustainStyle = #'bracket
173 c\sustainDown d e
174 b\sustainUp\sustainDown
175 b g \sustainUp a \sustainDown \bar "|."
176 @end lilypond
177
178 A third style of pedal notation is a mixture of text and brackets,
179 obtained by setting the @code{pedalSustainStyle} property to
180 @code{mixed}
181
182 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
183 \set Staff.pedalSustainStyle = #'mixed
184 c\sustainDown d e
185 b\sustainUp\sustainDown
186 b g \sustainUp a \sustainDown \bar "|."
187 @end lilypond
188
189 The default @q{*Ped.} style for sustain and damper pedals corresponds to
190 style @code{#'text}.  The sostenuto pedal uses @code{mixed} style by
191 default.
192
193 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
194 c\sostenutoDown d e c, f g a\sostenutoUp
195 @end lilypond
196
197 For fine-tuning the appearance of a pedal bracket, the properties
198 @code{edge-width}, @code{edge-height}, and @code{shorten-pair} of
199 @code{PianoPedalBracket} objects (see
200 @internalsref{PianoPedalBracket} in the Internals Reference) can be
201 modified.  For example, the bracket may be extended to the right edge
202 of the note head
203
204 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
205 \override Staff.PianoPedalBracket #'shorten-pair = #'(0 . -1.0)
206 c\sostenutoDown d e c, f g a\sostenutoUp
207 @end lilypond
208
209 @seealso
210
211 Notation Reference: @ref{Ties} (laissez vibrer).
212
213 @node Staff switch lines
214 @subsubsection Staff switch lines
215
216
217 @cindex follow voice
218 @cindex staff switching
219 @cindex cross staff
220
221 @funindex followVoice
222
223 Whenever a voice switches to another staff, a line connecting the notes
224 can be printed automatically.  This is switched on by setting
225 @code{followVoice} to true
226
227 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
228 \new PianoStaff <<
229   \new Staff="one" {
230     \set followVoice = ##t
231     c1
232     \change Staff=two
233     b2 a
234   }
235   \new Staff="two" { \clef bass \skip 1*2 }
236 >>
237 @end lilypond
238
239 @seealso
240
241 Internals Reference: @internalsref{VoiceFollower}.
242
243 @predefined
244
245 @funindex \showStaffSwitch
246 @code{\showStaffSwitch},
247 @funindex \hideStaffSwitch
248 @code{\hideStaffSwitch}.
249
250
251 @node Cross staff stems
252 @subsubsection Cross staff stems
253
254 Chords that cross staves may be produced by increasing the length
255 of the stem in the lower staff, so it reaches the stem in the upper
256 staff, or vice versa.
257
258 @lilypond[ragged-right,verbatim,quote]
259 stemExtend = {
260   \once \override Stem #'length = #10
261   \once \override Stem #'cross-staff = ##t
262 }
263 noFlag = \once \override Stem #'flag-style = #'no-flag
264 \new PianoStaff <<
265   \new Staff {
266     \stemDown \stemExtend
267     f'4
268     \stemExtend \noFlag
269     f'8
270   }
271   \new Staff {
272     \clef bass
273     a4 a8
274   }
275 >>
276 @end lilypond
277
278
279
280