]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/user/features.tely
patch::: 1.3.118.jcn2
[lilypond.git] / Documentation / user / features.tely
1 \input texinfo @c -*-texinfo-*-
2 @setfilename features.info
3 @settitle GNU LilyPond Features
4
5 @ignore
6 TODO
7   * add more un/badly documented features
8   * write some text
9   * add to/merge with refman
10 @end ignore
11
12 @node Top
13 @chapter Features
14
15 @menu
16 * Arpeggio::                       Arpeggio
17 * Glissando::                      Glissando
18 * Manual beam settings::           Manual beam settings
19 * Slur attachments::               Slur attachments
20 * Text spanner::                   Text spanner
21 * Engraver hacking::               Engraver hacking
22 * Part combiner::                  Part combiner
23 * Markup text::                    Markup text
24 * Output property::                Output property
25 * Embedded TeX::                   Embedded TeX
26 * Embedded PostScript::            Embedded PostScript
27 @end menu
28
29 Testin'' a b c...
30 @lilypond[fragment,relative,verbatim,center]
31   a'' b c
32 @end lilypond
33
34 @node Arpeggio
35 @section Arpeggio
36
37 @lilypond[fragment,relative,verbatim,center]
38   \context Voice <c'\arpeggio e g c>
39 @end lilypond
40
41 @lilypond[fragment,relative,verbatim,center]
42   \context PianoStaff <
43     \property PianoStaff.connectArpeggios = ##t
44     \context Staff \context Voice <c''\arpeggio e g c>
45     \context Staff=other \context Voice <c,\arpeggio e g>
46   >  
47 @end lilypond
48
49
50 @node Glissando
51 @section Glissando
52
53
54 @lilypond[fragment,relative,verbatim,center]
55   c'' \glissando c'
56 @end lilypond
57
58 @subsection Follow Thread
59 @lilypond[fragment,relative,verbatim,center]
60   \context PianoStaff <
61     \property PianoStaff.followThread = ##t
62     \context Staff \context Voice {
63       c'1
64       \translator Staff=two
65       b2 a
66     }
67     \context Staff=two {\clef bass; \skip 1*2;}
68   >  
69 @end lilypond
70
71 @node Manual beam settings
72 @section Manual beam settings
73
74
75 Beams over rests...
76
77 @lilypond[fragment,relative,verbatim,center]
78   \context Staff {
79     r4 [r8 g'' a]
80   }
81 @end lilypond
82
83
84 Control number of beams...
85
86 @lilypond[fragment,relative,verbatim,center]
87   \context Staff {
88     [f'8 r16 f g a]
89     [f8 r16 \property Voice.stemLeftBeamCount = #1 f g a]
90   }
91 @end lilypond
92
93 @lilypond[fragment,relative,verbatim,center]
94     f'32 g a b b a g f
95     
96     \property Voice.autoBeamSettings
97       \set #'(end * * * *) = #(make-moment 1 4)
98     f32 g a b b a g f
99     
100     f32 g a
101     \property Voice.stemRightBeamCount = #1 b
102     \property Voice.stemLeftBeamCount = #1 b
103     a g f
104 @end lilypond
105
106 Don't extend to middle line esp. for grace
107
108 @lilypond[fragment,relative,verbatim,center]
109     \grace a'8 a4
110     \property Voice.Stem \set #'no-stem-extend = ##t
111     \grace g8 g4
112 @end lilypond
113   
114 Beam slope (height)
115
116 Horizontal beam
117
118 @lilypond[fragment,relative,verbatim,center]
119   \property Voice.Beam \set #'direction = #1
120   \property Voice.Beam \set #'height-hs = #0
121   [a''8 e' d c]
122 @end lilypond
123
124 beam start-y beam-height
125
126 Weird beam
127 @lilypond[fragment,relative,verbatim,center]
128   \property Voice.Beam \set #'y-position-hs = #4
129   \property Voice.Beam \set #'height-hs = #-4
130   [c'8 c] 
131 @end lilypond
132
133
134 Like stem...
135
136 @lilypond[fragment,relative,verbatim,center]
137   [b''8 b]
138   \property Voice.Beam \set #'default-neutral-direction = #-1
139   [b b]
140 @end lilypond
141
142 There are several ways to calculate the direction of a beam.
143
144 [Ross] states that the majority of the notes dictates the
145 direction (and not the mean of "center distance")
146
147 But is that because it really looks better, or because he wants
148 to provide some real simple hands-on rules?
149      
150 We have our doubts, so we simply provide all sensible alternatives:
151
152 @table @samp
153 @item majority
154 number count of up or down notes
155 @item mean
156 mean centre distance of all notes
157 @item median
158 mean centre distance weighted per note
159 @end table
160
161 You can spot the difference of these settings quite easily from these simple examples:
162
163 @lilypond[fragment,relative,verbatim,center]
164   [d''8 a]
165   \property Voice.Beam \set #'dir-function = #beam-dir-mean
166   [d a] 
167   \property Voice.Beam \set #'dir-function = #beam-dir-median
168   [d a]
169 @end lilypond
170     
171 @lilypond[fragment,relative,verbatim,center]
172   \time 3/8;
173   [d''8 a a]
174   \property Voice.Beam \set #'dir-function = #beam-dir-mean
175   [d a a] 
176   \property Voice.Beam \set #'dir-function = #beam-dir-median
177   [d a a] 
178 @end lilypond
179
180
181 @node Slur attachments
182 @section Slur attachments
183
184 Override attachments...
185 @lilypond[fragment,relative,verbatim,center]
186     \property Voice.Slur \set #'direction = #1
187     \property Voice.Stem \set #'length = #5.5
188     g''8(g)g4
189     g4(g8)g
190     \property Voice.Slur \set #'attachment = #'(stem . stem)
191     g8(g)g4
192     g4(g8)g
193 @end lilypond
194
195
196 Test Before, after
197
198 @c Ugh, ugh @multitable is broken in texinfo-4.0
199 @c Fixed in 4.0.jcn3
200 @c We'll have to postpone this before/after representation until
201 @c jcn3 is rolled into texinfo...
202
203 @multitable @columnfractions .50 .50
204 @item
205 @noindent
206 @lilypond[fragment,relative,verbatim,center]
207 \property Voice.Slur
208   \set #'direction = #1
209 g''8(g)g4
210 g4(g8)g
211 @end lilypond
212 @tab
213 @lilypond[fragment,relative,verbatim,center]
214 \property Voice.Slur
215   \set #'direction = #1
216 \property Voice.Stem
217   \set #'length = #5.5
218 \property Voice.Slur
219   \set #'attachment = #'(stem . stem)
220 g''8(g)g4
221 g4(g8)g
222 @end lilypond
223 @end multitable
224
225         
226 Ophee slurs...
227 @lilypond[fragment,relative,verbatim,center]
228     \property Voice.Slur \set #'direction = #1
229     \property Voice.Slur \set #'attachment = #'(head . head)
230     g''16()g()g()g()d'()d()d()d
231 @end lilypond
232
233
234 Steep slur correct...
235 @lilypond[fragment,relative,verbatim,center]
236   \property Voice.Stem \set #'direction = #1
237   \property Voice.Slur \set #'direction = #1
238   d'32( d'4 )d8..
239   \property Voice.Slur \set #'attachment = #'(stem . stem)
240   d,32( d'4 )d8..
241 @end lilypond
242
243 @c  high slurs, eg from gnossienes
244
245
246 @node Text spanner
247 @section Text spanner
248
249 Have crescendo set a text spanner iso hairpin
250 @lilypond[fragment,relative,verbatim,center]
251   \context Voice {
252     \property Voice.crescendoText = "cresc."
253     \property Voice.crescendoSpanner = #'dashed-line
254     a''2\mf\< a a \!a 
255   }
256 @end lilypond
257
258 @subsection Ottava
259
260 @lilypond[fragment,relative,verbatim,center]
261     a'''' b c a
262     \property Voice.TextSpanner \set #'type = #'dotted-line
263     \property Voice.TextSpanner \set #'edge-height = #'(0 . 1.5)
264     \property Voice.TextSpanner \set #'edge-text = #'("8va " . "")
265     \property Staff.centralCPosition = #-13
266     a\spanrequest \start "text" b c a \spanrequest \stop "text"
267 @end lilypond
268
269
270
271 @node Engraver hacking
272 @section Engraver hacking
273
274 No time signature, no barlines... 
275 @lilypond[verbatim,center]
276 \score {
277   \notes \relative c'' {
278     a b c d
279     d c b a
280   }
281   \paper {
282     linewidth = -1.;
283     \translator {
284       \StaffContext
285       whichBar = #""
286       \remove "Time_signature_engraver";
287     }
288   }
289 }
290 @end lilypond
291
292 No staff, no clef, squash pitches
293 @lilypond[verbatim,center]
294 \score {
295   \notes { c4 c4 c8 c8 }
296   \paper {
297     linewidth = -1.;
298     \translator {
299       \StaffContext
300       \remove Staff_symbol_engraver;
301       \consists Pitch_squash_engraver;
302       \remove Clef_engraver;
303     }
304   }
305 }
306 @end lilypond
307
308
309 @node Part combiner
310 @section Part combiner
311
312 @lilypond[verbatim,center]
313 \score{
314   \context Staff = flauti <
315     \time 4/4;
316     \context Voice=one \partcombine Voice
317     \context Thread=one \notes\relative c'' {
318       c4 d e f | b,4 d c d | r2 e4 f | c4 d e f |
319       c4 r e f | c4 r e f | c4 r a r | a a r a |
320       a2 \property Voice.soloADue = ##f a |
321     }
322     \context Thread=two \notes\relative c'' {
323       g4 b d f | r2 c4 d | a c c d | a4. b8 c4 d
324       c r e r | r2 s2 | a,4 r a r | a r r a |
325       a2 \property Voice.soloADue = ##f a |
326     }
327   >
328   \paper{
329     linewidth = 80 * \staffspace;
330     \translator{
331       \ThreadContext
332       \consists Rest_engraver;
333     }
334     \translator{
335       \VoiceContext
336       \remove Rest_engraver;
337     }
338   }
339 }
340 @end lilypond
341
342
343
344
345 @node Markup text
346 @section Markup text
347
348 @c markup text hacking
349
350 Metrome hack...
351
352 @lilypond[verbatim,center]
353 #(define note '(rows (music "noteheads-2" ((kern . -0.1) "flags-stem"))))
354 #(define eight-note `(rows ,note ((kern . -0.1) (music ((raise . 3.5) "flags-u3")))))
355 #(define dotted-eight-note `(rows ,eight-note (music "dots-dot")))
356
357 \score {
358   \notes\relative c'' {
359     a1^#`(rows ,dotted-eight-note " = 64")
360   }
361   \paper {
362     linewidth = -1.;
363     \translator{
364       \ScoreContext
365       TextScript \override #'font-shape = #'upright
366     }
367   }
368 }
369 @end lilypond
370
371
372 @node Output property
373 @section Output property
374
375 @lilypond[fragment,relative,verbatim,center]
376     \outputproperty #(make-type-checker 'note-head-interface) 
377       #'extra-offset = #'(2 . 3)
378     c''2 c
379 @end lilypond
380
381 Don't move the finger 2, only text "m.d." ...
382 @lilypond[verbatim,center]
383 #(define (make-text-checker text)
384    (lambda (grob) (equal? text (ly-get-elt-property grob 'text))))
385
386 \score {    
387   \notes\relative c''' {
388     \property Voice.Stem \set #'direction = #1
389     \outputproperty #(make-text-checker "m.d.")
390       #'extra-offset = #'(-3.5 . -4.5)
391     a^2^"m.d."    
392   }
393   \paper { linewidth = -1.; }
394 }
395 @end lilypond
396
397 @c subsection no clefs
398
399 @c  equalizer
400
401
402 @c \apply hacking
403 @c reverse
404 @c smart transpose
405
406  
407
408 @c Embedded TeX
409
410 @node Embedded TeX
411 @section Embedded TeX
412 @lilypond[fragment,relative,verbatim,center]
413   a''^"3 $\\times$ \\`a deux"
414 @end lilypond
415
416 @node Embedded PostScript
417 @section Embedded PostScript
418
419 Arbitrary lines and curves not supported...
420 [TODO:] Make a direct postscript command?
421
422 @lilypond[verbatim,center]
423 \score {
424   \notes \relative c'' {
425     a-#"\\embeddedps{3 4 moveto 5 3 rlineto stroke}"
426     -#"\\embeddedps{ [ 0 1 ] 0 setdash 3 5 moveto 5 -3 rlineto stroke}"
427     b-#"\\embeddedps{3 4 moveto 0 0 1 2 8 4 20 3.5 rcurveto stroke}"
428     s2
429     a'1
430   }
431   \paper {
432     linewidth = 70.0*\staffspace;
433   }
434 }
435 @end lilypond
436
437 @bye
438
439
440