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