5 * move some stuff to refman
6 * merge some stuff with refman entries
8 * add @ref{}s to lilypond-internals:
10 @reng{Name} to engraver
12 there's a very simple, very general noXXX mechanism; try
14 noop \property Staff.VoltaBrace = #'()
15 yes: \property Staff.VoltaBracket = #'((meta . ((interfaces . ()))))
28 * Glissando:: Glissando
29 * Manual beam settings:: Manual beam settings
30 * Slur attachments:: Slur attachments
31 * Text spanner:: Text spanner
32 * Engraver hacking:: Engraver hacking
33 * Part combiner:: Part combiner
34 * Markup text:: Markup text
35 * Apply hacking:: Apply hacking
36 * Output property:: Output property
37 * Embedded TeX:: Embedded TeX
38 * Embedded PostScript:: Embedded PostScript
39 @c * Index:: Checking Feature index
47 @cindex broken arpeggio
49 You can specify an @rgrob{Arpeggio} sign on a chord by issuing an
51 @c @code{\arpeggio}@indexcode{\arpeggio} request:
52 @code{\arpeggio} request:
56 @lilypond[fragment,relative,verbatim]
57 \context Voice <c'\arpeggio e g c>
61 Typesetting of simultanious chords with arpeggios can be controlled with
62 the property @code{PianoStaff.connectArpeggios} @footnote{ FIXME:
63 connectArpeggios. Can't find the English terms for two kinds of
64 arpeggio (Dutch: gebroken arpeggio vs doorlopend arpeggio).} By
65 default, LilyPond prints broken arpeggios; when set to true, one
66 extended arpeggio sign is printed.
69 @lilypond[fragment,relative,verbatim]
71 \property PianoStaff.connectArpeggios = ##t
72 \context Staff \context Voice <c''\arpeggio e g c>
73 \context Staff=other \context Voice <c,\arpeggio e g>
82 A @rgrob{Glissando} line can be requested by issuing a
84 @c @code{\glissando}@indexcode{\glissando} request:
85 @code{\glissando} request:
89 @lilypond[fragment,relative,verbatim]
94 Printing of the additional text @samp{gliss.} is currently not
98 @subsection Follow Thread
100 @cindex staff switching
103 @c Documented here because it looks like a glissando...
104 A glissando-like line can be printed to connect notes whenever a thread
105 switches to another staff. This is enabled if the property
106 @code{PianoStaff.followThread}@indexcode{followThread} is set to true:
109 @lilypond[fragment,relative,verbatim]
110 \context PianoStaff <
111 \property PianoStaff.followThread = ##t
112 \context Staff \context Voice {
114 \translator Staff=two
117 \context Staff=two {\clef bass; \skip 1*2;}
122 @node Manual beam settings
123 @section Manual beam settings
125 @cindex beam settings
131 In some cases it may be necessary to override LilyPond's automatic
132 beaming algorithm. For example, the auto beamer will not beam over
133 rests, so if you want that, specify the begin and end point manually
134 using @code{[}@indexcode{[} and @code{]}@indexcode{]}:
137 @lilypond[fragment,relative,verbatim]
144 Similarly, for beams over bar lines:
147 @lilypond[fragment,relative,verbatim]
154 If you have specific wishes for the number of beams, you can fully
155 control the number of beams through the properties
156 @code{Voice.stemLeftBeamCount}@indexcode{stemLeftBeamCount};
159 @lilypond[fragment,relative,verbatim]
162 [f8 r16 \property Voice.stemLeftBeamCount = #1 f g a]
167 and @code{Voice.stemRightBeamCount}@indexcode{stemRightBeamCount}:
170 @lilypond[fragment,relative,verbatim]
173 \property Voice.autoBeamSettings
174 \set #'(end * * * *) = #(make-moment 1 4)
178 \property Voice.stemRightBeamCount = #1 b
179 \property Voice.stemLeftBeamCount = #1 b
184 Conventionally, stems extend to the middle staff line, and thus so do
185 beams. The extending of the stems can be controlled through
186 @code{Voice.Stem}'s grob-property
187 @code{no-stem-extend}@indexcode{no-stem-extend}:
190 @lilypond[fragment,relative,verbatim]
192 \property Voice.Stem \set #'no-stem-extend = ##t
197 The beam symbol can be tweaked through @code{Voice.Beam}'s
198 grob-properties @code{height-hs} and @code{y-position-hs}.
200 Set @code{height-hs} to zero, to get horizontal beams:
203 @lilypond[fragment,relative,verbatim]
204 \property Voice.Beam \set #'direction = #1
205 \property Voice.Beam \set #'height-hs = #0
210 Both are in half spaces. Here's how you'd specify a weird looking beam
211 that instead of beaing horizontal, falls two staff spaces (ie, four half
215 @lilypond[fragment,relative,verbatim]
216 \property Voice.Beam \set #'y-position-hs = #4
217 \property Voice.Beam \set #'height-hs = #-4
222 The direction of a perfectly centred beams can be
223 controlled through @code{Voice.Beam}'s grob-property
224 @code{default-neutral-direction}@indexcode{default-neutral-direction}
227 @lilypond[fragment,relative,verbatim]
229 \property Voice.Beam \set #'default-neutral-direction = #-1
234 There are several ways to calculate the direction of a beam.
236 [Ross] states that the majority of the notes dictates the
237 direction (and not the mean of "center distance")
239 But is that because it really looks better, or because he wants
240 to provide some real simple hands-on rules?
242 We have our doubts, so we simply provide all sensible alternatives:
246 number count of up or down notes
248 mean centre distance of all notes
250 mean centre distance weighted per note
253 You can spot the differences of these settings from these simple
257 @lilypond[fragment,relative,verbatim]
259 \property Voice.Beam \set #'dir-function = #beam-dir-mean
261 \property Voice.Beam \set #'dir-function = #beam-dir-median
267 @lilypond[fragment,relative,verbatim]
270 \property Voice.Beam \set #'dir-function = #beam-dir-mean
272 \property Voice.Beam \set #'dir-function = #beam-dir-median
277 These beam direction functions are defined in @file{scm/beam.scm}. If
278 your favourite algorithm isn't one of these, you can hook up your own.
282 @node Slur attachments
283 @section Slur attachments
285 The ending of a slur should whenever possible be attached to a note
286 head. Only in some instances where beams are involved, LilyPond may
287 attach a slur to a stem end. In some cases, you may want to override
288 LilyPond's decision, eg to attach the slur to the stem end. This can be
289 done through @code{Voice.Slur}'s grob-property @code{attachment}:
290 @c FIXME: make @ref{} to backend doco
293 @lilypond[fragment,relative,verbatim]
294 \property Voice.Slur \set #'direction = #1
295 \property Voice.Stem \set #'length = #5.5
298 \property Voice.Slur \set #'attachment = #'(stem . stem)
304 Trying Before | After example...
305 @c Fix rolled into 4.0a prerelease
308 @multitable @columnfractions .40 .40
311 @lilypond[fragment,relative,verbatim]
313 \set #'direction = #1
318 @lilypond[fragment,relative,verbatim]
320 \set #'direction = #1
324 \set #'attachment = #'(stem . stem)
331 Similarly, slurs can be attached to note heads even when beams are
332 involved (aka Ophee slurs):
335 @lilypond[fragment,relative,verbatim]
336 \property Voice.Slur \set #'direction = #1
337 \property Voice.Slur \set #'attachment = #'(head . head)
338 g''16()g()g()g()d'()d()d()d
342 If a slur would strike through a stem or beam, LilyPond will move the
343 slur away vertically (upward or downward). In some cases, this may
344 cause ugly slurs that you may want to correct:
347 @lilypond[fragment,relative,verbatim]
348 \property Voice.Stem \set #'direction = #1
349 \property Voice.Slur \set #'direction = #1
351 \property Voice.Slur \set #'attachment = #'(stem . stem)
356 LilyPond will increase the curvature of a slur trying to stay free of
357 note heads and stems. However, if the curvature would increase too much,
358 the slur will be reverted to its default shape. This decision is based
359 on @code{Voice.Slur}'s grob-property @code{beautiful} value. In some
360 cases, you may find ugly slurs beautiful, and tell LilyPond so by
361 increasing the @code{beautiful} value:
366 \notes \context PianoStaff <
368 \context Staff=up { s1 * 6/4 }
369 \context Staff=down <
371 \autochange Staff \context Voice
373 d,8( a' d f a d f d a f d )a
381 Slur \override #'beautiful = #5.0
382 Slur \override #'direction = #1
383 Stem \override #'direction = #-1
384 autoBeamSettings \override #'(end * * * *)
389 VerticalAlignment \override #'threshold = #'(5 . 5)
398 @section Text spanner
402 Have crescendo set a text spanner iso hairpin
405 @lilypond[fragment,relative,verbatim]
407 \property Voice.crescendoText = "cresc."
408 \property Voice.crescendoSpanner = #'dashed-line
415 @lilypond[fragment,relative,verbatim]
417 \property Voice.TextSpanner \set #'type = #'dotted-line
418 \property Voice.TextSpanner \set #'edge-height = #'(0 . 1.5)
419 \property Voice.TextSpanner \set #'edge-text = #'("8va " . "")
420 \property Staff.centralCPosition = #-13
421 a\spanrequest \start "text" b c a \spanrequest \stop "text"
426 @node Engraver hacking
427 @section Engraver hacking
429 No time signature, no barlines...
432 \notes \relative c'' {
441 \remove "Time_signature_engraver";
447 No staff, no clef, squash pitches
450 \notes { c4 c4 c8 c8 }
455 \remove Staff_symbol_engraver;
456 \consists Pitch_squash_engraver;
457 \remove Clef_engraver;
465 @section Part combiner
469 \context Staff = flauti <
471 \context Voice=one \partcombine Voice
472 \context Thread=one \notes\relative c'' {
473 c4 d e f | b,4 d c d | r2 e4 f | c4 d e f |
474 c4 r e f | c4 r e f | c4 r a r | a a r a |
475 a2 \property Voice.soloADue = ##f a |
477 \context Thread=two \notes\relative c'' {
478 g4 b d f | r2 c4 d | a c c d | a4. b8 c4 d
479 c r e r | r2 s2 | a,4 r a r | a r r a |
480 a2 \property Voice.soloADue = ##f a |
484 linewidth = 80 * \staffspace;
487 \consists Rest_engraver;
491 \remove Rest_engraver;
508 #(define note '(rows (music "noteheads-2" ((kern . -0.1) "flags-stem"))))
509 #(define eight-note `(rows ,note ((kern . -0.1) (music ((raise . 3.5) "flags-u3")))))
510 #(define dotted-eight-note `(rows ,eight-note (music "dots-dot")))
513 \notes\relative c'' {
514 a1^#`(rows ,dotted-eight-note " = 64")
520 TextScript \override #'font-shape = #'upright
527 @node Output property
528 @section Output property
530 @lilypond[fragment,relative,verbatim]
531 \outputproperty #(make-type-checker 'note-head-interface)
532 #'extra-offset = #'(2 . 3)
536 Don't move the finger 2, only text "m.d." ...
538 #(define (make-text-checker text)
539 (lambda (grob) (equal? text (ly-get-elt-property grob 'text))))
542 \notes\relative c''' {
543 \property Voice.Stem \set #'direction = #1
544 \outputproperty #(make-text-checker "m.d.")
545 #'extra-offset = #'(-3.5 . -4.5)
548 \paper { linewidth = -1.; }
557 @section Apply hacking
560 music = \notes { c'4 d'4( e'4 f'4 }
562 #(define (reverse-music music)
563 (let* ((elements (ly-get-mus-property music 'elements))
564 (reversed (reverse elements))
565 (span-dir (ly-get-mus-property music 'span-direction)))
567 (ly-set-mus-property music 'elements reversed)
570 (ly-set-mus-property music 'span-direction (- span-dir)))
572 (map reverse-music reversed)
579 \apply #reverse-music \music
581 \paper { linewidth = -1.; }
586 Here's a copy of my feature request :
588 Your task, if you accept it is to implement a \smarttranspose
589 command> that would translate such oddities into more natural
590 notations. Double accidentals should be removed, as well as #E
591 (-> F), bC (-> B), bF (-> E), #B (-> C).
594 You mean like this. (Sorry 'bout the nuked indentation.)
599 #(define (unhair-pitch p)
600 (let* ((o (pitch-octave p))
601 (a (pitch-alteration p))
602 (n (pitch-notename p)))
605 ((and (> a 0) (or (eq? n 6) (eq? n 2)))
606 (set! a (- a 1)) (set! n (+ n 1)))
607 ((and (< a 0) (or (eq? n 0) (eq? n 3)))
608 (set! a (+ a 1)) (set! n (- n 1))))
611 ((eq? a 2) (set! a 0) (set! n (+ n 1)))
612 ((eq? a -2) (set! a 0) (set! n (- n 1))))
614 (if (< n 0) (begin (set! o (- o 1)) (set! n (+ n 7))))
615 (if (> n 7) (begin (set! o (+ o 1)) (set! n (- n 7))))
619 #(define (smart-transpose music pitch)
620 (let* ((es (ly-get-mus-property music 'elements))
621 (e (ly-get-mus-property music 'element))
622 (p (ly-get-mus-property music 'pitch))
623 (body (ly-get-mus-property music 'body))
624 (alts (ly-get-mus-property music 'alternatives)))
629 (map (lambda (x) (smart-transpose x pitch)) es)))
634 (smart-transpose alts pitch)))
639 (smart-transpose body pitch)))
644 (smart-transpose e pitch)))
648 (set! p (unhair-pitch (Pitch::transpose p pitch)))
649 (ly-set-mus-property music 'pitch p)))
654 music = \notes \relative c' { c4 d e f g a b c }
657 \notes \context Staff {
658 \transpose ais' \music
659 \apply #(lambda (x) (smart-transpose x (make-pitch 0 5 1)))
662 \paper { linewidth = -1.; }
668 @section Embedded TeX
669 @lilypond[fragment,relative,verbatim]
670 a''^"3 $\\times$ \\`a deux"
673 @node Embedded PostScript
674 @section Embedded PostScript
676 Arbitrary lines and curves not supported...
678 [TODO:] Make a direct postscript command?
682 \notes \relative c'' {
683 a-#"\\embeddedps{3 4 moveto 5 3 rlineto stroke}"
684 -#"\\embeddedps{ [ 0 1 ] 0 setdash 3 5 moveto 5 -3 rlineto stroke}"
685 b-#"\\embeddedps{3 4 moveto 0 0 1 2 8 4 20 3.5 rcurveto stroke}"
689 \paper { linewidth = 70 * \staffspace; }
695 @section Checking Feature index