]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/user/advanced-notation.itely
Minor addition.
[lilypond.git] / Documentation / user / advanced-notation.itely
1 @c -*- coding: latin-1; mode: texinfo; -*-
2 @c This file is part of lilypond.tely
3
4 @c A menu is needed before every deeper *section nesting of @node's; run 
5 @c     M-x texinfo-all-menus-update
6 @c to automatically fill in these menus before saving changes
7
8
9 @node Advanced notation
10 @chapter Advanced notation
11
12 This chapter deals with rarely-used and advanced notation.
13
14 @menu
15 * Text::                        
16 * Even more than notes::        
17 * Preparing parts::             
18 * Orchestral music::            
19 * Contemporary notation::       
20 * Educational use::             
21 * Automatic notation::          
22 @end menu
23
24
25 @node Text
26 @section Text
27
28 This section explains how to include text (with various formatting) in
29 your scores.
30
31 @menu
32 * Text scripts::                
33 * Text spanners::               
34 * Text markup::                 
35 * Text encoding::               
36 * Nested scores::               
37 * Overview of text markup commands::  
38 * New dynamic marks::           
39 * Other text markup issues::    
40 @end menu
41
42
43 @node Text scripts
44 @subsection Text scripts
45 @cindex Text scripts
46
47 @cindex text items, non-empty
48 @cindex non-empty texts
49
50 It is possible to place arbitrary strings of text or markup text (see
51 @ref{Text markup}) above or below notes by using a string
52 @code{c^"text"}.  By default, these indications do not influence the
53 note spacing, but by using the command @code{\fatText}, the widths
54 will be taken into account
55
56 @lilypond[quote,fragment,raggedright,verbatim,relative=1]
57 c4^"longtext" \fatText c4_"longlongtext" c4
58 @end lilypond
59
60 More complex formatting may also be added to a note by using the
61 markup command,
62 @lilypond[fragment,raggedright,verbatim,quote]
63 c'4^\markup { bla \bold bla }
64 @end lilypond
65
66 The @code{\markup} is described in more detail in
67 @ref{Text markup}.
68
69
70 @refcommands
71
72 @cindex @code{\fatText}
73 @code{\fatText},
74 @cindex @code{\emptyText}
75 @code{\emptyText}.
76
77 @seealso
78
79 In this manual: @ref{Text markup}.
80
81 Program reference: @internalsref{TextScriptEvent}, @internalsref{TextScript}.
82
83
84 @node Text spanners
85 @subsection Text spanners
86 @cindex Text spanners
87
88 Some performance indications, e.g., @i{rallentando} or @i{accelerando},
89 are written as text and are extended over many measures with dotted
90 lines.  Such texts are created using text spanners; attach
91 @code{\startTextSpan} and @code{\stopTextSpan} to the first and last
92 notes of the spanner.
93
94 The string to be printed, as well as the style, is set through object
95 properties
96
97 @lilypond[quote,raggedright,fragment,relative=1,verbatim]
98 c1
99 \textSpannerDown
100 \override TextSpanner #'edge-text = #'("rall " . "")
101 c2\startTextSpan b c\stopTextSpan a
102 @end lilypond
103
104 @refcommands
105
106 @cindex textSpannerUp
107 @code{textSpannerUp},
108 @cindex textSpannerDown 
109 @code{textSpannerDown},
110 @cindex textSpannerNeutral
111 @code{textSpannerNeutral}.
112
113 @seealso
114
115 Internals @internalsref{TextSpanEvent},
116 @internalsref{TextSpanner}.
117
118 Examples: @inputfileref{input/@/regression,text@/-spanner@/.ly}.
119
120
121 @node Text markup
122 @subsection Text markup
123 @cindex text markup
124 @cindex markup text
125
126 @cindex typeset text
127
128 The internal mechanism to typeset texts is accessed with the keyword
129 @code{\markup}.  Within markup mode, you can enter texts similar to
130 lyrics.  They are simply entered, while commands use the backslash @code{\}.
131 @cindex markup
132
133 @lilypond[quote,verbatim,fragment,relative=1]
134 c1^\markup { hello }
135 c1_\markup { hi there }
136 c1^\markup { hi \bold there, is \italic anyone home? }
137 @end lilypond
138
139 @cindex font switching
140
141 The markup in the example demonstrates font switching commands.  The
142 command @code{\bold} and @code{\italic} apply to the first following 
143 word only; enclose a set of texts with braces to apply a command
144 to more words:
145 @example
146 \markup @{ \bold @{ hi there @} @}
147 @end example
148
149 @noindent
150 For clarity, you can also do this for single arguments, e.g.,
151
152 @example
153 \markup @{ is \italic @{ anyone @} home @}
154 @end example
155
156 @cindex font size, texts
157
158
159 In markup mode you can compose expressions, similar to mathematical
160 expressions, XML documents, and music expressions.  You can stack
161 expressions grouped vertically with the command @code{\column}.
162 Similarly, @code{\center-align} aligns texts by their center lines:
163
164 @lilypond[quote,verbatim,fragment,relative=1]
165 c1^\markup { \column { a bbbb \line { c d } } }
166 c1^\markup { \center-align { a bbbb c } }
167 c1^\markup { \line { a b c } }
168 @end lilypond
169
170
171 Markups can be stored in variables and these variables
172 may be attached to notes, like
173 @example
174 allegro = \markup @{ \bold \large @{ Allegro @} @}
175  @{ a^\allegro b c d @}
176 @end example
177
178
179 Some objects have alignment procedures of their own, which cancel out
180 any effects of alignments applied to their markup arguments as a
181 whole.  For example, the @internalsref{RehearsalMark} is horizontally
182 centered, so using @code{\mark \markup @{ \left-align .. @}} has no
183 effect.
184
185
186 @seealso
187
188 Program reference: @internalsref{TextScriptEvent}, @internalsref{TextScript}.
189
190 Init files: @file{scm/@/new@/-markup@/.scm}.
191
192 @refbugs
193
194 Kerning or generation of ligatures is only done when the @TeX{}
195 backend is used.  In this case, LilyPond does not account for them so
196 texts will be spaced slightly too wide.
197
198 Syntax errors for markup mode are confusing.
199
200
201 @node Text encoding
202 @subsection Text encoding
203
204 LilyPond uses the Pango library to format multi-lingual texts, and
205 does not perform any input-encoding conversions.  This means that any
206 text, be it title, lyric text, or musical instruction containing
207 non-ASCII characters, must be utf-8.  Easiest to enter such texts is
208 by using a Unicode-aware editor, and save using utf-8 encoding.  Most
209 popular modern editors have utf-8 support, for example, vim, Emacs,
210 jEdit, and GEdit do.
211
212 Depending on the fonts installed, the following fragment shows Hebrew
213 and Cyrillic lyrics,
214
215 @cindex Cyrillic
216 @cindex Hebrew
217 @cindex ASCII, non
218
219 @lilypondfile[fontload]{utf-8.ly}
220
221
222 The @TeX{} backend does not handle encoding specially at all.  Strings
223 in the input are put in the output as-is.  Extents of text items in the
224 @TeX{} backend, are determined by reading a file created via the
225 @file{texstr} backend,
226
227 @example
228 lilypond -b texstr input/les-nereides.ly
229 latex les-nereides.texstr
230 @end example
231
232 The last command produces @file{les-nereides.textmetrics}, which is
233 read when you execute
234
235 @example
236 lilypond -b tex input/les-nereides.ly
237 @end example
238
239 Both @file{les-nereides.texstr} and @file{les-nereides.tex} need
240 suitable LaTeX wrappers to load appropriate La@TeX{} packages for
241 interpreting non-ASCII strings.
242
243 @seealso
244
245 @inputfileref{input/regression,utf-8.ly}
246
247
248 @node Nested scores
249 @subsection Nested scores
250
251 It is possible to nest music inside markups, by adding a @code{\score}
252 block to a markup expression.  Such a score must contain a @code{\layout}
253 block.
254
255 @lilypond[quote,verbatim,raggedright]
256 \relative {
257   c4 d^\markup {
258     \score {
259       \relative { c4 d e f }
260       \layout { }
261     }
262   }
263   e f
264 }
265 @end lilypond
266  
267
268
269 @node Overview of text markup commands
270 @subsection Overview of text markup commands
271
272 The following commands can all be used inside @code{\markup @{ @}}.
273
274 @include markup-commands.tely
275
276
277 @node New dynamic marks
278 @subsection New dynamic marks
279
280 It is possible to print new dynamic marks or text that should be aligned
281 with dynamics.  Use @code{make-dynamic-script} to create these marks.
282
283 @cindex make-dynamic-script
284
285 @lilypond[quote,verbatim,raggedright]
286 sfzp = #(make-dynamic-script "sfzp")
287 \relative c' {
288   c4 c c\sfzp c
289 }
290 @end lilypond
291
292 @cindex Dynamics, editorial
293 @cindex Dynamics, parenthesis
294
295 It is also possible to print dynamics in round parenthesis or square
296 brackets.  These are often used for adding editorial dynamics.
297
298 @lilypond[quote,verbatim,raggedright]
299 rndf = \markup{ \center-align {\line { \bold{\italic (}
300   \dynamic f \bold{\italic )} }} }
301 boxf = \markup{ \bracket { \dynamic f } }
302 { c'1_\rndf c'1_\boxf }
303 @end lilypond
304
305
306 @node Other text markup issues
307 @subsection Other text markup issues
308
309 To use a normal font within a title, you must define it manually
310
311 @example
312 #(def-markup-command (normal-font layout props arg) (markup?)
313   "Switch to normal text font"
314   (interpret-markup layout (cons '((font-series . 'medium) (font-shape . 'upright)) props) arg))
315
316 \header@{
317   title = \markup@{ ABCD \normal-font ABCD @}
318 @}
319 @end example
320
321
322 @c  really bad section name.  :(
323 @node Even more than notes
324 @section Even more than notes
325
326 @menu
327 * Transpose::                   
328 * Ottava brackets::             
329 * Multi measure rests::         
330 * Time administration::         
331 @end menu
332
333
334
335 @node Transpose
336 @subsection Transpose
337 @cindex Transpose
338 @cindex transposition of pitches
339 @cindex @code{\transpose}
340
341 A music expression can be transposed with @code{\transpose}.  The
342 syntax is
343 @example
344 \transpose @var{from} @var{to} @var{musicexpr}
345 @end example
346
347 This means that @var{musicexpr} is transposed by the interval between
348 the pitches @var{from} and @var{to}: any note with pitch @code{from}
349 is changed to @code{to}.
350
351
352 For example, consider a piece written in the key of D-major.  If
353 this piece is a little too low for its performer, it can be
354 transposed up to E-major with
355 @example
356 \transpose d e @dots{}
357 @end example
358
359 Consider a part written for violin (a C instrument).  If
360 this part is to be played on the A clarinet, the following
361 transposition will produce the appropriate part
362
363 @example
364 \transpose a c @dots{}
365 @end example
366
367 @code{\transpose} distinguishes between enharmonic pitches: both
368 @code{\transpose c cis} or @code{\transpose c des} will transpose up
369 half a tone.  The first version will print sharps and the second
370 version will print flats
371
372 @lilypond[quote,raggedright,verbatim]
373 mus = { \key d \major cis d fis g }
374 \context Staff {
375   \clef "F" \mus
376   \clef "G"
377   \transpose c g' \mus
378   \transpose c f' \mus
379 }
380 @end lilypond
381
382 @code{\transpose} may also be used to input written notes for a
383 transposing instrument.  Pitches are normally entered into LilyPond
384 in C (or ``concert pitch''), but they may be entered in another
385 key.  For example, when entering music for a B-flat trumpet which
386 begins on concert D, one would write
387
388 @example
389 \transpose c bes @{ e4 @dots{} @}
390 @end example
391
392 To print this music in B-flat again (ie producing a trumpet part,
393 instead of a concert pitch conductor's score) you would wrap the
394 existing music with another @code{transpose}
395
396 @example
397 \transpose bes c @{ \transpose c bes @{ e4 @dots{} @} @}
398 @end example
399
400
401
402 @seealso
403
404 Program reference: @internalsref{TransposedMusic}, and
405 @internalsref{UntransposableMusic}.
406
407 @refbugs
408
409 If you want to use both @code{\transpose} and @code{\relative},
410 you must put @code{\transpose} outside of @code{\relative}, since
411 @code{\relative} will have no effect music that appears inside a
412 @code{\transpose}.
413
414
415 @node Ottava brackets
416 @subsection Ottava brackets
417
418 `Ottava' brackets introduce an extra transposition of an octave for
419 the staff.  They are created by invoking the function
420 @code{set-octavation}
421
422 @cindex ottava
423 @cindex 15ma
424 @cindex octavation
425
426 @lilypond[quote,raggedright,verbatim,fragment]
427 \relative c''' {
428   a2 b
429   #(set-octavation 1)
430   a b
431   #(set-octavation 0)
432   a b
433 }
434 @end lilypond
435
436 The @code{set-octavation} function also takes -1 (for 8va bassa) and 2
437 (for 15ma) as arguments.  Internally the function sets the properties
438 @code{ottavation} (e.g., to @code{"8va"}) and
439 @code{centralCPosition}.  For overriding the text of the bracket, set
440 @code{ottavation} after invoking @code{set-octavation}, i.e.,
441
442 @lilypond[quote,raggedright,verbatim]
443 {
444   #(set-octavation 1)
445   \set Staff.ottavation = #"8"
446   c'''
447 }
448 @end lilypond
449
450 @seealso
451
452 Program reference: @internalsref{OttavaBracket}.
453
454 Examples: @inputfileref{input/@/regression,ottava@/.ly},
455 @inputfileref{input/@/regression,ottava@/-broken@/.ly}.
456
457 @refbugs
458
459 @code{set-octavation} will get confused when clef changes happen
460 during an octavation bracket.
461
462
463 @node Multi measure rests
464 @subsection Multi measure rests
465 @cindex multi measure rests
466 @cindex Rests, multi measure
467
468 @cindex @code{R}
469
470 Multi-measure rests are entered using `@code{R}'.  It is specifically
471 meant for full bar rests and for entering parts: the rest can expand
472 to fill a score with rests, or it can be printed as a single
473 multi-measure rest.  This expansion is controlled by the property
474 @code{Score.skipBars}.  If this is set to true, empty measures will not
475 be expanded, and the appropriate number is added automatically
476
477 @lilypond[quote,raggedright,fragment,verbatim]
478 \time 4/4 r1 | R1 | R1*2
479 \set Score.skipBars = ##t R1*17 R1*4
480 @end lilypond
481
482 The @code{1} in @code{R1} is similar to the duration notation used for
483 notes.  Hence, for time signatures other than 4/4, you must enter other
484 durations.  This can be done with augmentation dots or fractions
485
486 @lilypond[quote,raggedright,fragment,verbatim]
487 \set Score.skipBars = ##t
488 \time 3/4
489 R2. | R2.*2
490 \time 13/8
491 R1*13/8
492 R1*13/8*12 |
493 \time 10/8 R4*5*4 |
494 @end lilypond
495
496 An @code{R} spanning a single measure is printed as either a whole rest
497 or a breve, centered in the measure regardless of the time signature.
498
499 If there are only a few measures of rest, LilyPond prints ``church rests''
500 (a series of rectangles) in the staff.  To replace that with a simple
501 rest, use @code{MultiMeasureRest.expand-limit}.
502
503 @lilypond[quote,raggedright,fragment,verbatim]
504 \set Score.skipBars = ##t
505 R1*2 | R1*5 | R1*9
506 \override MultiMeasureRest #'expand-limit = 1
507 R1*2 | R1*5 | R1*9
508 @end lilypond
509
510
511 @cindex text on multi-measure rest
512 @cindex script on multi-measure rest
513 @cindex fermata on multi-measure rest
514
515 Texts can be added to multi-measure rests by using the
516 @var{note}-@code{markup} syntax (see @ref{Text markup}).
517 A variable (@code{\fermataMarkup}) is provided for
518 adding fermatas
519
520 @lilypond[quote,raggedright,verbatim,fragment]
521 \set Score.skipBars = ##t
522 \time 3/4
523 R2.*10^\markup { \italic "ad lib." }
524 R2.^\fermataMarkup
525 @end lilypond
526
527 If you want to have text on the left end of a multi-measure rest,
528 attach the text to a zero-length skip note, i.e.,
529
530 @example
531 s1*0^"Allegro"
532 R1*4
533 @end example
534
535
536 @cindex whole rests for a full measure
537
538 @seealso
539
540 Program reference: @internalsref{MultiMeasureRestEvent},
541 @internalsref{MultiMeasureTextEvent},
542 @internalsref{MultiMeasureRestMusicGroup}, and
543 @internalsref{MultiMeasureRest}.
544
545 The layout object @internalsref{MultiMeasureRestNumber} is for the
546 default number, and @internalsref{MultiMeasureRestText} for user
547 specified texts.
548
549 @refbugs
550
551 It is not possible to use fingerings (e.g., @code{R1-4}) to put numbers
552 over multi-measure rests.  And the pitch of multi-measure rests (or
553 staff-centered rests) can not be influenced.
554
555 @cindex condensing rests
556
557 There is no way to automatically condense multiple rests into a single
558 multi-measure rest.  Multi-measure rests do not take part in rest
559 collisions.
560
561 Be careful when entering multi-measure rests followed by whole
562 notes.  The following will enter two notes lasting four measures each
563 @example
564 R1*4 cis cis
565 @end example
566 When @code{skipBars} is set, the result will look OK, but the bar
567 numbering will be off.
568
569
570 @node Time administration
571 @subsection Time administration
572
573 Time is administered by the @internalsref{Time_signature_engraver},
574 which usually lives in the @internalsref{Score} context.
575 The bookkeeping deals with the following variables
576
577 @table @code
578 @item currentBarNumber
579 The measure number.
580
581 @item measureLength
582 The length of the measures in the current time signature.  For a 4/4
583 time this is@tie{}1, and for 6/8 it is 3/4.
584
585 @item measurePosition
586 The point within the measure where we currently are.  This quantity
587 is reset to@tie{}0 whenever it exceeds @code{measureLength}.  When that
588 happens, @code{currentBarNumber} is incremented.
589
590 @item timing
591 If set to true, the above variables are updated for every time
592 step.  When set to false, the engraver stays in the current measure
593 indefinitely.
594 @end table
595
596 Timing can be changed by setting any of these variables explicitly.
597 In the next example, the 4/4 time signature is printed, but
598 @code{measureLength} is set to 5/4.  After a while, the measure is
599 shortened by 1/8, by setting @code{measurePosition} to 7/8 at 2/4
600 in the measure, so the next bar line will fall at 2/4 + 3/8.  The
601 3/8 arises because 5/4 normally has 10/8, but we have manually
602 set the measure position to be 7/8 and 10/8 - 7/8 = 3/8.
603
604 @lilypond[quote,raggedright,verbatim,relative,fragment]
605 \set Score.measureLength = #(ly:make-moment 5 4)
606 c1 c4
607 c1 c4
608 c4 c4
609 \set Score.measurePosition = #(ly:make-moment 7 8)
610 b8 b b
611 c4 c1
612 @end lilypond
613
614
615
616 @node Preparing parts
617 @section Preparing parts
618
619 This section describes various notation that are useful for preparing
620 individual parts.
621
622 @menu
623 * Metronome marks::             
624 * Rehearsal marks::             
625 * Bar numbers::                 
626 * Instrument names::            
627 * Instrument transpositions::   
628 * Different editions from one source::  
629 @end menu
630
631
632 @node Metronome marks
633 @subsection Metronome marks
634
635 @cindex Tempo
636 @cindex beats per minute
637 @cindex metronome marking
638
639 Metronome settings can be entered as follows
640 @example
641 \tempo @var{duration} = @var{per-minute}
642 @end example
643
644 In the MIDI output, they are interpreted as a tempo change.  In the
645 layout output, a metronome marking is printed
646 @cindex @code{\tempo}
647 @lilypond[quote,raggedright,verbatim,fragment]
648 \tempo 8.=120 c''1
649 @end lilypond
650
651 To change the tempo in the MIDI output without printing anything, make
652 the metronome marking invisible
653 @example
654 \once \override Score.MetronomeMark #'transparent = ##t
655 @end example
656
657 To print other metronome markings, use these markup commands
658 @lilypond[quote,raggedright,verbatim,relative,fragment]
659 c4^\markup {
660   "("
661   \smaller \general-align #Y #DOWN \note #"16." #1
662   "="
663   \smaller \general-align #Y #DOWN \note #"8" #1"
664   ")" }
665 @end lilypond
666
667 @noindent
668 See @ref{Text markup} for more details.
669
670
671 @seealso
672
673 Program reference: @internalsref{MetronomeChangeEvent}
674 @internalsref{MetronomeMark}.
675
676 @refbugs
677
678 Collisions are not checked.  If you have notes above the top line of
679 the staff (or notes with articulations, slurs, text, etc), then the
680 metronome marking may be printed on top of musical symbols.  If this
681 occurs, increase the padding of the metronome mark to place it 
682 further away from the staff.
683
684 @example
685 \override Score.MetronomeMark #'padding = #2.5
686 @end example
687
688
689 @node Rehearsal marks
690 @subsection Rehearsal marks
691 @cindex Rehearsal marks
692 @cindex mark
693 @cindex @code{\mark}
694
695 To print a rehearsal mark, use the @code{\mark} command
696
697 @lilypond[quote,raggedright,fragment,verbatim,relative=2]
698 c1 \mark \default
699 c1 \mark \default
700 c1 \mark #8
701 c1 \mark \default
702 c1 \mark \default
703 @end lilypond
704
705 @noindent
706 (The letter@tie{}`I' is skipped in accordance with engraving traditions.)
707 @c umm, is the manual the right place for feature requests?  :)  -gp
708 @c FIXME - should make that tunable.
709
710 The mark is incremented automatically if you use @code{\mark
711 \default}, but you can also use an integer argument to set the mark
712 manually.  The value to use is stored in the property
713 @code{rehearsalMark}.
714
715 The style is defined by the property @code{markFormatter}.  It is a
716 function taking the current mark (an integer) and the current context
717 as argument.  It should return a markup object.  In the following
718 example, @code{markFormatter} is set to a canned procedure.  After a
719 few measures, it is set to function that produces a boxed number.
720
721 @lilypond[fragment,quote,raggedright,verbatim,relative=2]
722 \set Score.markFormatter = #format-mark-numbers
723 c1 \mark \default
724 c1 \mark \default
725 \set Score.markFormatter = #format-mark-box-numbers
726 c1 \mark \default
727 c1 \mark \default
728 c1
729 @end lilypond
730
731 The file @file{scm/@/translation@/-functions@/.scm} contains the definitions
732 of @code{format-mark-numbers} (the default format), @code{format-mark-box-numbers},
733 @code{format-mark-letters} and @code{format-mark-box-letters}.
734 These can be used as inspiration for other formatting functions.
735
736
737 @cindex coda on bar line
738 @cindex segno on bar line
739 @cindex fermata on bar line
740 @cindex bar lines, symbols on
741
742 The @code{\mark} command can also be used to put signs like coda,
743 segno, and fermata on a bar line.  Use @code{\markup} to
744 access the appropriate symbol
745
746 @lilypond[fragment,quote,raggedright,verbatim,relative=2]
747 c1 \mark \markup { \musicglyph #"scripts.ufermata" }
748 c1
749 @end lilypond
750
751 If the mark occurs at a line break, the mark will be printed at the
752 beginning of the next line.
753 @c  IMO this is a bug; hopefully it'll be fixed soon, so I can
754 @c  delete this sentence.   -gp
755 If there is no next line, then the mark will not be printed at all.
756 To print the mark at the end of the current line, use
757
758 @example
759 \override Score.RehearsalMark
760   #'break-visibility = #begin-of-line-invisible
761 @end example
762
763 @code{\mark} is often useful for adding text to the end of bar.  In
764 such cases, changing the @code{#'self-alignment} is very useful
765
766 @lilypond[fragment,quote,raggedright,verbatim,relative=2]
767 \override Score.RehearsalMark
768   #'break-visibility = #begin-of-line-invisible
769 c4 c c c
770 \once \override Score.RehearsalMark #'self-alignment-X = #right
771 \mark "D.S. al Fine "
772 @end lilypond
773
774
775 @cindex fermatas
776 @cindex coda
777 @cindex segno
778 @cindex bar lines, putting symbols on
779
780 @seealso
781
782 Program reference: @internalsref{MarkEvent}, @internalsref{RehearsalMark}.
783
784 Init files: @file{scm/@/translation@/-functions@/.scm} contains the
785 definition of @code{format-mark-numbers} and
786 @code{format-mark-letters}.  They can be used as inspiration for other
787 formatting functions.
788
789 Examples: @inputfileref{input/@/regression,rehearsal@/-mark@/-letter@/.ly},
790
791 @inputfileref{input/@/regression,rehearsal@/-mark@/-number@/.ly}.
792
793
794 @node Bar numbers
795 @subsection Bar numbers
796
797
798 @cindex Bar numbers
799 @cindex measure numbers
800 @cindex @code{currentBarNumber}
801
802 Bar numbers are printed by default at the start of the line.  The
803 number itself is stored in the @code{currentBarNumber} property, which
804 is normally updated automatically for every measure.
805
806 Bar numbers can be typeset at regular intervals instead of at the
807 beginning of each line.  This is illustrated in the following example,
808 whose source is available as
809 @inputfileref{input/@/test,bar@/-number@/-regular@/-interval@/.ly}
810
811 @lilypondfile[raggedright,quote]{bar-number-regular-interval.ly}
812
813 Bar numbers can be typeset manually by tweaking the
814 @code{markFormatter} property
815
816 @lilypond[verbatim,raggedright,quote]
817 \relative c' {
818   \set Score.markFormatter
819     = #(lambda (mark context)
820       (make-bold-markup
821         (make-box-markup
822           (number->string (ly:context-property context
823                                                'currentBarNumber)))))
824
825   c1 \bar "||" \mark \default c1 c1 \mark \default c1 \bar "|."
826 }
827 @end lilypond
828
829 Bar numbers can be manually changed by setting the
830 @code{Staff.currentBarNumber} property
831
832 @lilypond[verbatim,raggedright,quote]
833 \relative c' {
834   \repeat unfold 4 {c4 c c c} \break
835   \set Score.currentBarNumber = #50
836   \repeat unfold 4 {c4 c c c}
837 }
838 @end lilypond
839
840 @seealso
841
842 Program reference: @internalsref{BarNumber}.
843
844 Examples:
845 @inputfileref{input/@/test,bar@/-number@/-every@/-five@/-reset@/.ly},
846 and @inputfileref{input/@/test,bar@/-number@/-regular@/-interval@/.ly}.
847
848 @refbugs
849
850 Bar numbers can collide with the @internalsref{StaffGroup} bracket, if
851 there is one at the top.  To solve this, the
852 @code{padding} property of @internalsref{BarNumber} can be
853 used to position the number correctly.
854
855
856 @node Instrument names
857 @subsection Instrument names
858
859 In an orchestral score, instrument names are printed at the left side
860 of the staves.
861
862 This can be achieved by setting @internalsref{Staff}.@code{instrument}
863 and @internalsref{Staff}.@code{instr}.  This will print a string before
864 the start of the staff.  For the first staff, @code{instrument} is
865 used, for the following ones, @code{instr} is used.
866
867 @lilypond[quote,verbatim,raggedright,relative=1,fragment]
868 \set Staff.instrument = "Ploink "
869 \set Staff.instr = "Plk "
870 c1
871 \break
872 c''
873 @end lilypond
874
875 You can also use markup texts to construct more complicated instrument
876 names, for example
877
878 @lilypond[quote,fragment,verbatim,raggedright]
879 \set Staff.instrument = \markup {
880   \column { "Clarinetti"
881             \line { "in B" \smaller \flat } } }
882 c''1
883 @end lilypond
884
885 For longer instrument names, it may be useful to increase the
886 @code{indent} setting in the @code{\layout} block.
887
888 @seealso
889
890 Program reference: @internalsref{InstrumentName}.
891
892 @refbugs
893
894 When you put a name on a grand staff or piano staff, the width of the
895 brace is not taken into account.  You must add extra spaces to the end of
896 the name to avoid a collision.
897
898
899 @node Instrument transpositions
900 @subsection Instrument transpositions
901 @cindex transposition, MIDI
902 @cindex transposition, instrument
903
904 The key of a transposing instrument can also be specified.  This
905 applies to many wind instruments, for example, clarinets (B-flat, A, and
906 E-flat), horn (F) and trumpet (B-flat, C, D, and E-flat).
907
908 The transposition is entered after the keyword @code{\transposition}
909
910 @example
911 \transposition bes   %% B-flat clarinet
912 @end example
913
914 @noindent
915 This command sets the property @code{instrumentTransposition}.  The value of
916 this property is used for MIDI output and quotations.  It does not
917 affect how notes are printed in the current staff.  To change the printed
918 output, see @ref{Transpose}.
919
920 The pitch to use for @code{\transposition} should correspond to the
921 transposition of the notes.  For example, when entering a score in
922 concert pitch, typically all voices are entered in C, so
923 they should be entered as
924
925 @example
926 clarinet = @{
927   \transposition c'
928   ...
929 @}
930 saxophone = @{
931   \transposition c'
932   ...
933 @}
934 @end example
935
936 The command @code{\transposition} should be used when the music is
937 entered from a (transposed) orchestral part.  For example, in
938 classical horn parts, the tuning of the instrument is often changed
939 during a piece.  When copying the notes from the part, use
940 @code{\transposition}, e.g.,
941
942 @example
943 \transposition d'
944 c'4^"in D"
945 ...
946 \transposition g'
947 c'4^"in G"
948 ...
949 @end example
950
951
952 @node Different editions from one source
953 @subsection Different editions from one source
954
955 @cindex tag
956 The @code{\tag} command marks music expressions with a name.  These
957 tagged expressions can be filtered out later.  With this mechanism it
958 is possible to make different versions of the same music source.
959
960 In the following example, we see two versions of a piece of music, one
961 for the full score, and one with cue notes for the instrumental part
962
963 @example
964 c1
965 <<
966   \tag #'part <<
967     R1 \\
968     @{
969       \set fontSize = #-1
970       c4_"cue" f2 g4 @}
971   >>
972   \tag #'score R1
973 >>
974 c1
975 @end example
976
977 The same can be applied to articulations, texts, etc.: they are
978 made by prepending
979 @example
980 -\tag #@var{your-tag}
981 @end example
982 to an articulation, for example,
983 @example
984 c1-\tag #'part ^4
985 @end example
986
987 This defines a note with a conditional fingering indication.
988
989 @cindex keepWithTag
990 @cindex removeWithTag
991 By applying the @code{\keepWithTag} and @code{\removeWithTag}
992 commands, tagged expressions can be filtered.  For example,
993 @example
994 <<
995   @var{the music}
996   \keepWithTag #'score @var{the music}
997   \keepWithTag #'part @var{the music}
998 >>
999 @end example
1000 would yield
1001
1002 @lilypondfile[raggedright,quote]{tag-filter.ly}
1003
1004
1005 The argument of the @code{\tag} command should be a symbol, or a list
1006 of symbols, for example,
1007 @example
1008 \tag #'(original-part transposed-part) @dots{}
1009 @end example
1010
1011
1012
1013 @seealso
1014
1015 Examples: @inputfileref{input/@/regression,tag@/-filter@/.ly}.
1016
1017 @refbugs
1018
1019 Multiple rests are not merged if you create the score with both tagged
1020 sections.
1021  
1022
1023 @node Orchestral music
1024 @section Orchestral music
1025
1026 Orchestral music involves some special notation, both in the full
1027 score and the individual parts.  This section explains how to tackle
1028 some common problems in orchestral music.
1029
1030 @menu
1031 * Automatic part combining::    
1032 * Hiding staves::               
1033 * Quoting other voices::        
1034 * Formatting cue notes::        
1035 * Aligning to cadenzas::        
1036 @end menu
1037
1038
1039 @node Automatic part combining
1040 @subsection Automatic part combining
1041 @cindex automatic part combining
1042 @cindex part combiner
1043
1044 Automatic part combining is used to merge two parts of music onto a
1045 staff.  It is aimed at typesetting orchestral scores.  When the two
1046 parts are identical for a period of time, only one is shown.  In
1047 places where the two parts differ, they are typeset as separate
1048 voices, and stem directions are set automatically.  Also, solo and
1049 @emph{a due} parts are identified and can be marked.
1050
1051 The syntax for part combining is
1052
1053 @example
1054 \partcombine @var{musicexpr1} @var{musicexpr2}
1055 @end example
1056
1057
1058 The following example demonstrates the basic functionality of the part
1059 combiner: putting parts on one staff, and setting stem directions and
1060 polyphony
1061
1062 @lilypond[quote,verbatim,raggedright,fragment]
1063 \new Staff \partcombine
1064   \relative g' { g g a( b) c c r r }
1065   \relative g' { g g r4 r e e g g }
1066 @end lilypond
1067
1068 The first @code{g} appears only once, although it was
1069 specified twice (once in each part).  Stem, slur, and tie directions are
1070 set automatically, depending whether there is a solo or unisono.  The
1071 first part (with context called @code{one}) always gets up stems, and
1072 `Solo', while the second (called @code{two}) always gets down stems and
1073 `Solo II'.
1074
1075 If you just want the merging parts, and not the textual markings, you
1076 may set the property @code{printPartCombineTexts} to false
1077
1078 @lilypond[quote,verbatim,raggedright,fragment,relative=2]
1079 \new Staff <<
1080   \set Staff.printPartCombineTexts = ##f
1081   \partcombine
1082     \relative g' { g a( b) r }
1083     \relative g' { g r4 r f }
1084 >>
1085 @end lilypond
1086
1087 To change the text that is printed for solos or merging, you may
1088 set the @code{soloText}, @code{soloIIText}, and @code{aDueText}
1089 properties.
1090
1091 @lilypond[quote,verbatim,raggedright,fragment,relative=2]
1092 \new Staff <<
1093   \set Score.soloText = #"ichi"
1094   \set Score.soloIIText = #"ni"
1095   \set Score.aDueText = #"tachi"
1096   \partcombine
1097     \relative g' { g4 g a( b) r }
1098     \relative g' { g4 g r r f }
1099 >>
1100 @end lilypond
1101
1102 Both arguments to @code{\partcombine} will be interpreted as
1103 @internalsref{Voice} contexts.  If using relative octaves,
1104 @code{\relative} should be specified for both music expressions, i.e.,
1105
1106 @example
1107 \partcombine
1108   \relative @dots{} @var{musicexpr1}
1109   \relative @dots{} @var{musicexpr2}
1110 @end example
1111
1112 @noindent
1113 A @code{\relative} section that is outside of @code{\partcombine} has
1114 no effect on the pitches of @var{musicexpr1} and @var{musicexpr2}.
1115
1116 @seealso
1117
1118 Program reference: @internalsref{PartCombineMusic},
1119 @internalsref{SoloOneEvent}, and
1120 @internalsref{SoloTwoEvent}, and
1121 @internalsref{UnisonoEvent}.
1122
1123 @refbugs
1124
1125 When @code{printPartCombineTexts} is set, when the two voices play the
1126 same notes on and off, the part combiner may typeset @code{a2} more
1127 than once in a measure.
1128
1129 @code{\partcombine} cannot be inside @code{\times}.
1130
1131 @code{\partcombine} cannot be inside @code{\relative}.
1132
1133 Internally, the @code{\partcombine} interprets both arguments as
1134 @code{Voice}s named @code{one} and @code{two}, and then decides when
1135 the parts can be combined.  Consequently, if the arguments switch to
1136 differently named @internalsref{Voice} contexts, the events in those
1137 will be ignored.
1138
1139
1140 @node Hiding staves
1141 @subsection Hiding staves
1142
1143 @cindex Frenched scores
1144 @cindex Hiding staves
1145
1146 In orchestral scores, staff lines that only have rests are usually
1147 removed; this saves some space.  This style is called `French Score'.
1148 For @internalsref{Lyrics},
1149 @internalsref{ChordNames} and @internalsref{FiguredBass}, this is
1150 switched on by default.  When the lines of these contexts turn out
1151 empty after the line-breaking process, they are removed.
1152
1153 For normal staves, a specialized @internalsref{Staff} context is
1154 available, which does the same: staves containing nothing (or only
1155 multi-measure rests) are removed.  The context definition is stored in
1156 @code{\RemoveEmptyStaffContext} variable.  Observe how the second staff
1157 in this example disappears in the second line
1158
1159 @lilypond[quote,raggedright,verbatim]
1160 \layout {
1161   \context { \RemoveEmptyStaffContext }
1162 }
1163
1164 {
1165   \relative c' <<
1166     \new Staff { e4 f g a \break c1 }
1167     \new Staff { c4 d e f \break R1 }
1168   >>
1169 }
1170 @end lilypond
1171
1172 The first system shows all staves in full.  If empty staves should be
1173 removed from the first system too, set @code{remove-first} to true in
1174 @internalsref{RemoveEmptyVerticalGroup}.
1175
1176 @example
1177 \override Score.RemoveEmptyVerticalGroup #'remove-first = ##t
1178 @end example
1179
1180 To remove other types of contexts, use @code{\AncientRemoveEmptyStaffContext}
1181 or @code{\RemoveEmptyRhythmicStaffContext}.
1182
1183 Another application is making ossia sections, i.e., alternative
1184 melodies on a separate piece of staff, with help of a Frenched
1185 staff.  See @inputfileref{input/@/test,ossia@/.ly} for an example.
1186
1187
1188 @node Quoting other voices
1189 @subsection Quoting other voices
1190
1191 With quotations, fragments of other parts can be inserted into a part
1192 directly.  Before a part can be quoted, it must be marked especially as
1193 quotable.  This is done with the @code{\addquote} command.
1194
1195 @example
1196 \addquote @var{name} @var{music}
1197 @end example
1198
1199
1200 @noindent
1201 Here, @var{name} is an identifying string.  The @var{music} is any kind
1202 of music.  Here is an example of @code{\addquote}
1203
1204 @example
1205 \addquote clarinet \relative c' @{
1206   f4 fis g gis
1207 @}
1208 @end example
1209
1210 This command must be entered at toplevel, i.e., outside any music
1211 blocks.
1212
1213 After calling @code{\addquote}, the quotation may then be done with
1214 @code{\quoteDuring} or @code{\cueDuring},
1215
1216 @example
1217 \quoteDuring #@var{name} @var{music}
1218 @end example
1219
1220 During a part, a piece of music can be quoted with the @code{\quoteDuring}
1221 command.
1222
1223 @example
1224 \quoteDuring #"clarinet" @{ s2. @}
1225 @end example
1226
1227 This would cite three quarter notes (the duration of @code{s2.})  of
1228 the previously added @code{clarinet} voice.
1229
1230
1231 More precisely, it takes the current time-step of the part being
1232 printed, and extracts the notes at the corresponding point of the
1233 @code{\addquote}d voice.  Therefore, the argument to @code{\addquote}
1234 should be the entire part of the voice to be quoted, including any
1235 rests at the beginning.
1236
1237 Quotations take into account the transposition of both source and target
1238 instruments, if they are specified using the @code{\transposition} command.
1239
1240 @lilypond[quote,raggedright,verbatim]
1241 \addquote clarinet \relative c' {
1242   \transposition bes
1243   f4 fis g gis
1244 }
1245
1246 {
1247   e'8 f'8 \quoteDuring #"clarinet" { s2 }
1248 }
1249 @end lilypond
1250
1251 The type of events that are present in cue notes can be trimmed with
1252 the @code{quotedEventTypes} property.  The default value is
1253 @code{(note-event rest-event)}, which means that only notes and
1254 rests of the cued voice end up in the @code{\quoteDuring}.
1255 Setting
1256
1257 @example
1258 \set Staff.quotedEventTypes =
1259        #'(note-event articulation-event dynamic-event)
1260 @end example
1261
1262 @noindent
1263 will quote notes (but no rests), together with scripts and dynamics.
1264
1265 @refbugs
1266
1267 Only the contents of the first @internalsref{Voice} occurring in an
1268 @code{\addquote} command will be considered for quotation, so
1269 @var{music} can not contain @code{\new} and @code{\context Voice}
1270 statements that would switch to a different Voice.
1271
1272 Quoting grace notes is broken and can even cause LilyPond to crash.
1273
1274 @seealso
1275
1276 In this manual: @ref{Instrument transpositions}.
1277
1278 Examples: @inputfileref{input/@/regression,quote@/.ly}
1279 @inputfileref{input/@/regression,quote@/-transposition@/.ly}
1280
1281 Program reference: @internalsref{QuoteMusic}.
1282
1283
1284 @node Formatting cue notes
1285 @subsection Formatting cue notes
1286
1287 The previous section deals with inserting notes from another voice.
1288 There is a more advanced music function called @code{\cueDuring},
1289 which makes formatting cue notes easier.
1290
1291 The syntax is
1292
1293 @example
1294   \cueDuring #@var{name} #@var{updown} @var{music}
1295 @end example
1296
1297 This will insert notes from the part @var{name} into a
1298 @internalsref{Voice} called @code{cue}.  This happens simultaneously
1299 with @var{music}, which usually is a rest.  When the cue notes start,
1300 the staff in effect becomes polyphonic for a moment.  The argument
1301 @var{updown} determines whether the cue notes should be notated as a
1302 first or second voice.
1303
1304
1305 @lilypond[verbatim,raggedright]
1306 smaller = {
1307   \set fontSize = #-2
1308   \override Stem #'length = #5.5
1309   \override Beam #'thickness = #0.384
1310   \override Beam #'space-function =
1311     #(lambda (beam mult) (* 0.8 (Beam::space_function beam mult)))
1312 }
1313
1314 \addquote clarinet \relative {
1315   R1*20
1316   r2 r8 c f f
1317
1318
1319 \new Staff \relative  <<
1320
1321   % setup a context for  cue  notes.
1322   \context Voice = cue { \smaller \skip 1*21 }
1323   
1324   \set Score.skipBars = ##t
1325   
1326   \new Voice {
1327     R1*20
1328     \cueDuring #"clarinet" #1 {
1329       R1
1330     }
1331     g4 g2. 
1332   }
1333 >>
1334 @end lilypond 
1335
1336
1337 Here are a couple of hints for successful cue notes
1338
1339 @itemize @bullet
1340 @item
1341 Cue notes have smaller font sizes.
1342 @item
1343  the cued part is marked with the instrument playing the cue.
1344 @item
1345  when the original part takes over again, this should be marked with
1346  the name of the original instrument.
1347
1348  @c really?  Are you sure about that last point?  I'll check after 3.0 -gp
1349
1350 @c Yes, this is good practice.  Otherwise, the start of the original
1351 @c part can only be seen from the font size.  This is not good enough
1352 @c for sight-reading.  It is possilbe to use other
1353 @c markers (eg. a big close-bracket over the staff) to indicate the cue notes are
1354 @c finished.
1355 @c -hwn
1356
1357
1358  any other changes introduced by the cued part should also be
1359 undone.  For example, if the cued instrument plays in a different clef,
1360 the original clef should be stated once again.
1361
1362 @end itemize
1363
1364
1365 @node Aligning to cadenzas
1366 @subsection Aligning to cadenzas
1367
1368 In an orchestral context, cadenzas present a special problem:
1369 when constructing a score that includes a cadenza, all other
1370 instruments should skip just as many notes as the length of the
1371 cadenza, otherwise they will start too soon or too late.
1372
1373 A solution to this problem are the functions @code{mmrest-of-length}
1374 and @code{skip-of-length}.  These Scheme functions take a piece of music
1375 as argument, and generate a @code{\skip} or multi-rest, exactly as
1376 long as the piece.  The use of @code{mmrest-of-length} is demonstrated
1377 in the following example.
1378
1379 @lilypond[verbatim,raggedright,quote]
1380 cadenza = \relative c' {
1381   c4 d8 << { e f g } \\ { d4. } >>
1382   g4 f2 g4 g
1383 }
1384
1385 \new GrandStaff <<
1386   \new Staff { \cadenza c'4 }
1387   \new Staff {
1388     #(ly:export (mmrest-of-length cadenza))
1389     c'4
1390   }
1391 >>
1392 @end lilypond
1393
1394
1395
1396
1397 @node Contemporary notation
1398 @section Contemporary notation
1399
1400 In the 20th century, composers have greatly expanded the musical
1401 vocabulary.  With this expansion, many innovations in musical notation
1402 have been tried.  The book ``Music Notation in the 20th century'' by
1403 Kurt Stone gives a comprehensive overview (see @ref{Literature
1404 list}).  In general, the use of new, innovative notation makes a piece
1405 harder to understand and perform and its use should therefore be
1406 avoided.  For this reason, support for contemporary notation in
1407 LilyPond is limited.
1408
1409
1410 @menu
1411 * Polymetric notation::         
1412 * Clusters::                    
1413 * Special fermatas::            
1414 * Feathered beams::             
1415 * Improvisation::               
1416 @end menu
1417
1418 @node Polymetric notation
1419 @subsection Polymetric notation
1420
1421 Double time signatures are not supported explicitly, but they can be
1422 faked.  In the next example, the markup for the time signature is
1423 created with a markup text.  This markup text is inserted in the
1424 @internalsref{TimeSignature} grob.
1425
1426 @lilypond[verbatim,raggedright]
1427 % create 2/4 + 5/8
1428 tsMarkup =\markup {
1429   \number {
1430     \column { "2" "4" }
1431     \musicglyph #"scripts.stopped"
1432     \bracket \column { "5" "8" }
1433   }
1434 }
1435
1436 {
1437   \override Staff.TimeSignature #'print-function = #Text_interface::print
1438   \override Staff.TimeSignature #'text = #tsMarkup
1439   \time 3/2
1440   c'2 \bar ":" c'4 c'4.
1441 }
1442 @end lilypond
1443
1444 Each staff can also have its own time signature.  This is done by
1445 moving the @internalsref{Timing_engraver} to the @internalsref{Staff}
1446 context.
1447
1448 @example
1449 \layout @{
1450   \context @{ \Score \remove "Timing_engraver" @}
1451   \context @{ \Staff \consists "Timing_engraver" @}
1452 @}
1453 @end example
1454
1455
1456 Now, each staff has its own time signature.
1457 @example
1458 <<
1459   \new Staff @{
1460     \time 3/4
1461     c4 c c | c c c |
1462   @}
1463   \new Staff @{
1464     \time 2/4
1465     c4 c | c c | c c
1466   @}
1467   \new Staff @{
1468     \time 3/8
1469     c4. c8 c c c4. c8 c c
1470   @}
1471 >>
1472 @end example
1473
1474 @lilypond[quote,raggedright]
1475 \layout{
1476   \context{ \Score \remove "Timing_engraver" }
1477   \context{ \Staff \consists "Timing_engraver" }
1478 }
1479
1480 \relative c' <<
1481   \new Staff {
1482     \time 3/4
1483     c4 c c | c c c |
1484   }
1485   \new Staff {
1486     \time 2/4
1487     c4 c | c c | c c
1488   }
1489   \new Staff {
1490     \time 3/8
1491     c4. c8 c c c4. c8 c c
1492   }
1493 >>
1494 @end lilypond
1495
1496
1497 A different form of polymetric notation is where note lengths have
1498 different values across staves.
1499
1500 This notation can be created by setting a common time signature for
1501 each staff but replacing it manually using
1502 @code{timeSignatureFraction} to the desired fraction.  Then the printed
1503 durations in each staff are scaled to the common time signature.
1504 The latter is done with @code{\compressmusic}, which is similar to
1505 @code{\times}, but does not create a tuplet bracket.
1506
1507
1508 In this example, music with the time signatures of 3/4, 9/8, and 10/8 are
1509 used in parallel.  In the second staff, shown durations are multiplied by
1510 2/3, so that 2/3 * 9/8 = 3/4, and in the third staff, shown durations are
1511 multiplied by 3/5, so that 3/5 * 10/8 = 3/4.
1512
1513 @lilypond[quote,raggedright,verbatim,fragment]
1514 \relative c' { <<
1515   \new Staff {
1516     \time 3/4
1517     c4 c c | c c c |
1518   }
1519   \new Staff {
1520     \time 3/4
1521     \set Staff.timeSignatureFraction = #'(9 . 8)
1522     \compressmusic #'(2 . 3)
1523       \repeat unfold 6 { c8[ c c] }
1524   }
1525   \new Staff {
1526     \time 3/4
1527     \set Staff.timeSignatureFraction = #'(10 . 8)
1528     \compressmusic #'(3 . 5) {
1529       \repeat unfold 2 { c8[ c c] }
1530       \repeat unfold 2 { c8[ c] }
1531       | c4. c4. \times 2/3 { c8 c c } c4
1532     }
1533   }
1534 >> }
1535 @end lilypond
1536
1537
1538
1539
1540 @refbugs
1541
1542 When using different time signatures in parallel, the spacing is
1543 aligned vertically, but bar lines distort the regular spacing.
1544
1545
1546
1547 @node Clusters
1548 @subsection Clusters
1549
1550 @cindex cluster
1551
1552 A cluster indicates a continuous range of pitches to be played.  They
1553 can be denoted as the envelope of a set of notes.  They are entered by
1554 applying the function @code{makeClusters} to a sequence of
1555 chords, e.g.,
1556 @lilypond[quote,raggedright,relative=2,fragment,verbatim]
1557 \makeClusters { <c e > <b f'> }
1558 @end lilypond
1559
1560 The following example (from
1561 @inputfileref{input/@/regression,cluster@/.ly}) shows what the result
1562 looks like
1563
1564 @lilypondfile[raggedright,quote]{cluster.ly}
1565
1566 Ordinary notes and clusters can be put together in the same staff,
1567 even simultaneously.  In such a case no attempt is made to
1568 automatically avoid collisions between ordinary notes and clusters.
1569
1570 @seealso
1571
1572 Program reference: @internalsref{ClusterSpanner},
1573 @internalsref{ClusterSpannerBeacon},
1574 @internalsref{Cluster_spanner_engraver}, and
1575 @internalsref{ClusterNoteEvent}.
1576
1577 Examples: @inputfileref{input/@/regression,cluster@/.ly}.
1578
1579 @refbugs
1580
1581 Music expressions like @code{<< @{ g8 e8 @} a4 >>} are not printed
1582 accurately.  Use @code{<g a>8 <e a>8} instead.
1583
1584
1585
1586 @node Special fermatas
1587 @subsection Special fermatas
1588
1589 @cindex fermatas, special
1590
1591 In contemporary music notation, special fermata symbols denote breaks
1592 of differing lengths.  The following fermatas are supported
1593
1594 @lilypond[quote,raggedright]
1595 <<
1596   \oldaddlyrics {
1597     b'2
1598     ^\shortfermata
1599     _\shortfermata
1600     r
1601
1602     b'
1603     ^\fermata
1604     _\fermata
1605     r
1606
1607     b'
1608     ^\longfermata
1609     _\longfermata
1610     r
1611
1612     b'
1613     ^\verylongfermata
1614     _\verylongfermata
1615     r
1616   }
1617   \context Lyrics \lyricmode {
1618     \override LyricText #'font-family = #'typewriter
1619     "shortfermata" "fermata" "longfermata" "verylongfermata"
1620   }
1621 >>
1622 @end lilypond
1623
1624 See @ref{Articulations} for general instructions how to apply scripts
1625 such as fermatas to notes.
1626
1627 @node Feathered beams
1628 @subsection Feathered beams
1629
1630 Feathered beams are not supported natively, but they can be faked by
1631 forcing two beams to overlap.  Here is an example,
1632
1633 @c don't change relative setting witout changing positions!
1634 @lilypond[raggedright,relative=1,fragment,verbatim]
1635 \new Staff <<
1636   \new Voice
1637   {
1638     \stemUp
1639     \once \override Voice.Beam #'positions = #'(0 . 0.5)
1640     c8[ c c c c ]
1641   }
1642   \new Voice {
1643     \stemUp
1644     \once \override Voice.Beam #'positions = #'(0 . -0.5)
1645     c[ c c c c]
1646   }
1647 >>
1648 @end lilypond
1649
1650
1651 @node Improvisation
1652 @subsection Improvisation
1653
1654 Improvisation is sometimes denoted with slashed note heads.  Such note
1655 heads can be created by adding a @internalsref{Pitch_squash_engraver}
1656 to the @internalsref{Staff} or @internalsref{Voice} context.  Then, the
1657 following command
1658
1659 @example
1660 \set squashedPosition = #0
1661 \override NoteHead #'style = #'slash
1662 @end example
1663
1664 @noindent
1665 switches on the slashes.
1666
1667 There are shortcuts @code{\improvisationOn} (and an accompanying
1668 @code{\improvisationOff}) for this command sequence.  They are used in
1669 the following example
1670
1671 @lilypond[verbatim,raggedright,quote]
1672 \new Staff \with {
1673   \consists Pitch_squash_engraver
1674 } \transpose c c' {
1675   e8 e g a a16(bes)(a8) g \improvisationOn
1676   e8
1677   ~e2~e8 f4 fis8
1678   ~fis2 \improvisationOff a16(bes) a8 g e
1679 }
1680 @end lilypond
1681
1682
1683 @node Educational use
1684 @section Educational use
1685
1686 With the amount of control that LilyPond offers, one can make great
1687 teaching tools in addition to great musical scores.
1688
1689 @menu
1690 * Balloon help::                
1691 * Blank music sheet::           
1692 * Hidden notes::                
1693 * Shaped note heads ::          
1694 * Easy Notation note heads::    
1695 * Analysis brackets::           
1696 * Coloring objects::            
1697 @end menu
1698
1699 @node Balloon help
1700 @subsection Balloon help
1701
1702 Elements of notation can be marked and named with the help of a square
1703 balloon.  The primary purpose of this feature is to explain notation.
1704
1705 The following example demonstrates its use.
1706
1707 @lilypond[quote,verbatim,fragment,raggedright,relative=2]
1708 \context Voice {
1709   \applyoutput
1710     #(add-balloon-text 'NoteHead "heads, or tails?"
1711     '(1 . -3))
1712   c8
1713 }
1714 @end lilypond
1715
1716 @noindent
1717 The function @code{add-balloon-text} takes the name of a grob, the
1718 label to print, and the position where to put the label relative to
1719 the object.  In the above example, the text ``heads or tails?'' ends
1720 3 spaces below and 1 space to the right of the marked head.
1721
1722 @cindex balloon
1723 @cindex notation, explaining
1724
1725 @seealso
1726
1727 Program reference: @internalsref{text-balloon-interface}.
1728
1729 Examples: @inputfileref{input/@/regression,balloon@/.ly}.
1730
1731
1732
1733
1734 @node Blank music sheet
1735 @subsection Blank music sheet
1736
1737 A blank music sheet can be produced also by using invisible notes, and
1738 removing @code{Bar_number_engraver}.
1739
1740
1741 @lilypond[quote,verbatim]
1742 emptymusic = {
1743   \repeat unfold 2 % Change this for more lines.
1744   { s1\break }
1745   \bar "|."
1746 }
1747 \new Score \with {
1748   \override TimeSignature #'transparent = ##t
1749   defaultBarType = #""
1750   \remove Bar_number_engraver
1751 } <<
1752   \context Staff \emptymusic
1753   \context TabStaff \emptymusic
1754 >>
1755 @end lilypond
1756
1757
1758 @node Hidden notes
1759 @subsection Hidden notes
1760
1761 @cindex Hidden notes
1762 @cindex Invisible notes
1763 @cindex Transparent notes
1764
1765 @cindex @code{\hideNotes}
1766 @cindex @code{\unHideNotes}
1767 Hidden (or invisible or transparent) notes can be useful in preparing theory
1768 or composition exercises.
1769
1770 @lilypond[quote,raggedright,verbatim,relative=2,fragment]
1771 c4 d4
1772 \hideNotes
1773 e4 f4
1774 \unHideNotes
1775 g4 a
1776 @end lilypond
1777
1778 Hidden notes are also great for performing weird tricks.  For example,
1779 slurs cannot be attached to rests or spacer rests, but you may wish
1780 to include that in your score -- string instruments use this notation
1781 when doing pizzicato to indicate that the note should ring for as long
1782 as possible.
1783
1784 @lilypond[quote,raggedright,verbatim,relative=0,fragment]
1785 \clef bass
1786 << {
1787   c4^"pizz"( \hideNotes c)
1788   \unHideNotes c( \hideNotes c)
1789 } {
1790   s4 r s r
1791 } >>
1792 @end lilypond
1793
1794
1795 @node Shaped note heads 
1796 @subsection Shaped note heads 
1797
1798 In shaped note head notation, the shape of the note head corresponds
1799 to the harmonic function of a note in the scale.  This notation was
1800 popular in the 19th century American song books.
1801
1802 Shaped note heads can be produced by setting @code{\aikenHeads} or
1803 @code{\sacredHarpHeads}, depending on the style desired.
1804
1805 @lilypond[verbatim,relative=1,fragment]
1806   \aikenHeads
1807   c8 d4 e8 a2 g1
1808   \sacredHarpHeads
1809   c8 d4. e8 a2 g1
1810 @end lilypond
1811
1812 Shapes are determined on the step in the scale, where the base of the
1813 scale is determined by  the @code{\key} command
1814
1815 @findex \key
1816 @findex shapeNoteStyles
1817 @findex \aikenHeads
1818 @findex \sacredHarpHeads
1819
1820 Shaped note heads are implemented through the @code{shapeNoteStyles}
1821 property.  Its value is a vector of symbols.  The k-th element indicates
1822 the style to use for the k-th step of the scale.  Arbitrary
1823 combinations are possible, eg.,
1824
1825
1826 @lilypond[verbatim,relative=1,fragment]
1827   \set shapeNoteStyles  = ##(cross triangle fa #f mensural xcircle diamond)
1828   c8 d4. e8 a2 g1
1829 @end lilypond
1830
1831
1832 @node Easy Notation note heads
1833 @subsection Easy Notation note heads
1834
1835 @cindex easy notation
1836 @cindex Hal Leonard
1837
1838 The `easy play' note head includes a note name inside the head.  It is
1839 used in music for beginners
1840
1841 @lilypond[quote,raggedright,verbatim,fragment,staffsize=26]
1842   \setEasyHeads
1843   c'2 e'4 f' | g'1
1844 @end lilypond
1845
1846 The command @code{\setEasyHeads} overrides settings for the
1847 @internalsref{NoteHead} object.  To make the letters readable, it has
1848 to be printed in a large font size.  To print with a larger font, see
1849 @ref{Setting global staff size}.
1850
1851 @refcommands
1852
1853 @cindex @code{\setEasyHeads}
1854 @code{\setEasyHeads}
1855
1856
1857 @node Analysis brackets
1858 @subsection Analysis brackets
1859 @cindex brackets
1860 @cindex phrasing brackets
1861 @cindex musicological analysis
1862 @cindex note grouping bracket
1863
1864 Brackets are used in musical analysis to indicate structure in musical
1865 pieces.  LilyPond supports a simple form of nested horizontal
1866 brackets.  To use this, add the @internalsref{Horizontal_bracket_engraver}
1867 to @internalsref{Staff} context.  A bracket is started with
1868 @code{\startGroup} and closed with @code{\stopGroup}
1869
1870 @lilypond[quote,raggedright,verbatim]
1871 \score {
1872   \relative c'' {
1873     c4\startGroup\startGroup
1874     c4\stopGroup
1875     c4\startGroup
1876     c4\stopGroup\stopGroup
1877   }
1878   \layout {
1879     \context {
1880       \Staff \consists "Horizontal_bracket_engraver"
1881 }}}
1882 @end lilypond
1883
1884 @seealso
1885
1886 Program reference: @internalsref{HorizontalBracket},
1887 @internalsref{NoteGroupingEvent}.
1888
1889 Examples: @inputfileref{input/@/regression,note@/-group@/-bracket@/.ly}.
1890
1891
1892
1893 @ignore
1894
1895 I don't think we need this info.
1896
1897 @n ode Stems
1898 @s ubsection Stems
1899
1900 Whenever a note is found, a @internalsref{Stem} object is created
1901 automatically.  For whole notes and rests, they are also created but
1902 made invisible.
1903
1904 @refcommands
1905
1906 @cindex @code{\stemUp}
1907 @code{\stemUp},
1908 @cindex @code{\stemDown}
1909 @code{\stemDown},
1910 @cindex @code{\stemNeutral}
1911 @code{\stemNeutral}.
1912
1913 @end ignore
1914
1915
1916 @node Coloring objects
1917 @subsection Coloring objects
1918
1919 @c FIXME: need link to missing list of colors
1920 Individual objects may be assigned colors.  You may use color names
1921 listed HERE
1922
1923 @lilypond[quote,raggedright,verbatim,fragment]
1924 \override NoteHead #'color = #red
1925 c4 c
1926 \override NoteHead #'color = #(x11-color 'LimeGreen)
1927 d
1928 \override Stem #'color = #blue
1929 e
1930 @end lilypond
1931
1932 The full range of colors defined for X11 can be accessed by using the
1933 scheme function x11-color.  The function takes one argument that can be a
1934 symbol
1935
1936 @example
1937 \override Beam #'color = #(x11-color 'MediumTurquoise)
1938 @end example
1939
1940 or a string
1941
1942 @example
1943 \override Beam #'color = #(x11-color "MediumTurquoise")
1944 @end example
1945
1946 The first form is quicker to write and is more efficient.  However, using
1947 the second form it is possible to access X11 colors by the multi-word
1948 form of its name
1949
1950 @example
1951 \override Beam #'color = #(x11-color "medium turquoise")
1952 @end example
1953
1954 If x11-color cannot make sense of the parameter then the color returned
1955 defaults to black.  It should be obvious from the final score that
1956 something is wrong.
1957
1958 This example, illustrates the use of x11-color.  Notice that the stem
1959 color remains black after being set to (x11-color 'Boggle), which is
1960 deliberate nonsense.
1961
1962 @lilypond[quote,raggedright,verbatim]
1963 {
1964   \override Staff.StaffSymbol #'color = #(x11-color 'SlateBlue2)
1965   \set Staff.instrument = \markup {
1966     \with-color #(x11-color 'navy) "Clarinet"
1967   }
1968   \time 2/4
1969   gis''8 a''
1970   \override Beam #'color = #(x11-color "medium turquoise")
1971   gis'' a''
1972   \override NoteHead #'color = #(x11-color "LimeGreen")
1973   gis'' a''
1974   \override Stem #'color = #(x11-color 'Boggle)
1975   gis'' a''
1976 }
1977 @end lilypond
1978
1979
1980 @refbugs
1981 Not all x11 colors are distinguishable in a web browser.  For web use
1982 normal colors are recommended. 
1983
1984 An x11 color is not necessarily exactly the same shade as a similarly
1985 named normal color. 
1986
1987
1988 @seealso
1989
1990 COLORLIST
1991
1992
1993 @node Automatic notation
1994 @section Automatic notation
1995
1996 This section describes how to change the way that accidentals and
1997 beams are automatically displayed.
1998
1999 FIXME: this might get moved into Changing Defaults.  Please send
2000 opinions to lilypond-devel.  Thanks!  :)
2001
2002 @menu
2003 * Automatic accidentals::       
2004 * Setting automatic beam behavior::  
2005 * Beam formatting::             
2006 @end menu
2007
2008 @node Automatic accidentals
2009 @subsection Automatic accidentals
2010 @cindex Automatic accidentals
2011
2012 Common rules for typesetting accidentals have been placed in a
2013 function.  This function is called as follows
2014
2015 @cindex @code{set-accidental-style}
2016 @example
2017 #(set-accidental-style 'STYLE #('CONTEXT#))
2018 @end example
2019
2020 The function can take two arguments: the name of the accidental style,
2021 and an optional argument that denotes the context that should be
2022 changed.  If no context name is supplied, @code{Staff} is the default,
2023 but you may wish to apply the accidental style to a single @code{Voice}
2024 instead.
2025
2026 The following accidental styles are supported
2027 @table @code
2028 @item default
2029 This is the default typesetting behavior.  It corresponds
2030 to 18th century common practice: Accidentals are
2031 remembered to the end of the measure in which they occur and
2032 only on their own octave.
2033
2034 @item voice
2035 The normal behavior is to remember the accidentals on
2036 Staff-level.  This variable, however, typesets accidentals
2037 individually for each voice.  Apart from that, the rule is similar to
2038 @code{default}.
2039
2040 As a result, accidentals from one voice do not get canceled in other
2041 voices, which is often an unwanted result
2042
2043 @lilypond[quote,raggedright,relative=1,fragment,verbatim]
2044 \context Staff <<
2045   #(set-accidental-style 'voice)
2046   <<
2047     { es g } \\
2048     { c, e }
2049 >> >>
2050 @end lilypond
2051
2052 The @code{voice} option should be used if the voices
2053 are to be read solely by individual musicians.  If the staff is to be
2054 used by one musician (e.g., a conductor) then
2055 @code{modern} or @code{modern-cautionary}
2056 should be used instead.
2057
2058 @item modern
2059 @cindex @code{modern} style accidentals
2060 This rule corresponds to the common practice in the 20th century.  This rule
2061 prints the same accidentals as @code{default}, but temporary
2062 accidentals also are canceled in other octaves.  Furthermore,
2063 in the same octave, they also get canceled in the following
2064 measure
2065
2066 @lilypond[quote,raggedright,fragment,verbatim]
2067 #(set-accidental-style 'modern)
2068 cis' c'' cis'2 | c'' c'
2069 @end lilypond
2070
2071 @item @code{modern-cautionary}
2072 @cindex @code{modern-cautionary}
2073 This rule is similar to @code{modern}, but the ``extra'' accidentals
2074 (the ones not typeset by @code{default}) are typeset as cautionary
2075 accidentals.  They are printed in reduced size or with parentheses
2076 @lilypond[quote,raggedright,fragment,verbatim]
2077 #(set-accidental-style 'modern-cautionary)
2078 cis' c'' cis'2 | c'' c'
2079 @end lilypond
2080
2081 @cindex @code{modern-voice}
2082 @item modern-voice
2083 This rule is used for multivoice accidentals to be read both by musicians
2084 playing one voice and musicians playing all voices.  Accidentals are
2085 typeset for each voice, but they @emph{are} canceled across voices in
2086 the same @internalsref{Staff}.
2087
2088 @cindex @code{modern-voice-cautionary}
2089 @item modern-voice-cautionary
2090 This rule is the same as @code{modern-voice}, but with the extra
2091 accidentals (the ones not typeset by @code{voice}) typeset
2092 as cautionaries.  Even though all accidentals typeset by
2093 @code{default} @emph{are} typeset by this variable,
2094 some of them are typeset as cautionaries.
2095
2096 @item piano
2097 @cindex @code{piano} accidentals
2098 This rule reflects 20th century practice for piano notation.  Very similar to
2099 @code{modern} but accidentals also get canceled
2100 across the staves in the same @internalsref{GrandStaff} or
2101 @internalsref{PianoStaff}.
2102
2103 @item piano-cautionary
2104 @cindex @code{#(set-accidental-style 'piano-cautionary)}
2105 Same as @code{#(set-accidental-style 'piano)} but with the extra
2106 accidentals typeset as cautionaries.
2107
2108 @item no-reset
2109 @cindex @code{no-reset} accidental style
2110 This is the same as @code{default} but with accidentals lasting
2111 ``forever'' and not only until the next measure
2112 @lilypond[quote,raggedright,fragment,verbatim,relative=1]
2113 #(set-accidental-style 'no-reset)
2114 c1 cis cis c
2115 @end lilypond
2116
2117 @item forget
2118 This is sort of the opposite of @code{no-reset}: Accidentals
2119 are not remembered at all---and hence all accidentals are
2120 typeset relative to the key signature, regardless of what was
2121 before in the music
2122
2123 @lilypond[quote,raggedright,fragment,verbatim,relative=1]
2124 #(set-accidental-style 'forget)
2125 \key d\major c4 c cis cis d d dis dis
2126 @end lilypond
2127 @end table
2128
2129
2130 @seealso
2131
2132 Program reference: @internalsref{Accidental_engraver},
2133 @internalsref{Accidental}, and @internalsref{AccidentalPlacement}.
2134
2135
2136 @refbugs
2137
2138 Simultaneous notes are considered to be entered in sequential
2139 mode.  This means that in a chord the accidentals are typeset as if the
2140 notes in the chord happened once at a time - in the order in which
2141 they appear in the input file.
2142
2143 This is a problem when accidentals in a chord depend on each other,
2144 which does not happen for the default accidental style.  The problem
2145 can be solved by manually inserting @code{!} and @code{?} for the
2146 problematic notes.
2147
2148
2149 @node Setting automatic beam behavior
2150 @subsection Setting automatic beam behavior
2151
2152 @cindex @code{autoBeamSettings}
2153 @cindex @code{(end * * * *)}
2154 @cindex @code{(begin * * * *)}
2155 @cindex automatic beams, tuning
2156 @cindex tuning automatic beaming
2157
2158 @c [TODO: use \applycontext]
2159
2160 In normal time signatures, automatic beams can start on any note but can
2161 only end in a few positions within the measure: beams can end on a beat,
2162 or at durations specified by the properties in
2163 @code{autoBeamSettings}.  The defaults for @code{autoBeamSettings}
2164 are defined in @file{scm/@/auto@/-beam@/.scm}.
2165
2166 The value of @code{autoBeamSettings} is changed with three functions,
2167 @example
2168 #(override-auto-beam-setting
2169    '(@var{be} @var{p} @var{q} @var{n} @var{m}) @var{a} @var{b}
2170    [@var{context}])
2171 #(score-override-auto-beam-setting
2172    '(@var{be} @var{p} @var{q} @var{n} @var{m}) @var{a} @var{b})
2173 #(revert-auto-beam-setting '(@var{be} @var{p} @var{q} @var{n} @var{m})
2174    [@var{context}])
2175 @end example
2176 Here, @var{be} is the symbol @code{begin} or @code{end}, and
2177 @var{context} is an optional context (default: @code{'Voice}).  It
2178 determines whether the rule applies to begin or end-points.  The
2179 quantity @var{p}/@var{q} refers to the length of the beamed notes (and
2180 `@code{* *}' designates notes of any length), @var{n}/@var{M} refers
2181 to a time signature (wildcards `@code{* *}' may be entered to
2182 designate all time signatures), @var{a}/@var{b} is a duration.  By
2183 default, this command changes settings for the current voice.  It is
2184 also possible to adjust settings at higher contexts, by adding a
2185 @var{context} argument.  @code{score-override-auto-beam-setting} is
2186 equal to @code{override-auto-beam-setting} with the argument
2187 @var{context} set to @code{'Score}.
2188
2189 For example, if automatic beams should end on the first quarter note, use
2190 the following
2191 @example
2192 #(override-auto-beam-setting '(end * * * *) 1 4 'Staff)
2193 @end example
2194 Since the duration of a quarter note is 1/4 of a whole note, it is
2195 entered as @code{(ly:make-moment 1 4)}.
2196
2197 If automatic beams should end on every quarter in 5/4 time, specify
2198 all endings
2199 @example
2200 #(override-auto-beam-setting '(end * * * *) 1 4 'Staff)
2201 #(override-auto-beam-setting '(end * * * *) 1 2 'Staff)
2202 #(override-auto-beam-setting '(end * * * *) 3 4 'Staff)
2203 #(override-auto-beam-setting '(end * * * *) 5 4 'Staff)
2204 @dots{}
2205 @end example
2206
2207 The same syntax can be used to specify beam starting points.  In this
2208 example, automatic beams can only end on a dotted quarter note
2209 @example
2210 #(override-auto-beam-setting '(end * * * *) 3 8)
2211 #(override-auto-beam-setting '(end * * * *) 1 2)
2212 #(override-auto-beam-setting '(end * * * *) 7 8)
2213 @end example
2214 In 4/4 time signature, this means that automatic beams could end only on
2215 3/8 and on the fourth beat of the measure (after 3/4, that is 2 times
2216 3/8, has passed within the measure).
2217
2218 Rules can also be restricted to specific time signatures.  A rule that
2219 should only be applied in @var{N}/@var{M} time signature is formed by
2220 replacing the second asterisks by @var{N} and @var{M}.  For example, a
2221 rule for 6/8 time exclusively looks like
2222 @example
2223 #(override-auto-beam-setting '(begin * * 6 8) @dots{})
2224 @end example
2225
2226 If a rule should be to applied only to certain types of beams, use the
2227 first pair of asterisks.  Beams are classified according to the
2228 shortest note they contain.  For a beam ending rule that only applies
2229 to beams with 32nd notes (and no shorter notes), use @code{(end 1 32 *
2230 *)}.
2231
2232 For example,
2233
2234 @lilypond[quote,raggedright,relative=2,fragment,verbatim]
2235 \time 5/8
2236 #(override-auto-beam-setting '(end * * 5 8) 2 8)
2237 c8 c d d d
2238 \time 4/4
2239 e8 e f f e e d d
2240 \time 5/8
2241 c8 c d d d
2242 @end lilypond
2243
2244 @cindex automatic beam generation
2245 @cindex autobeam
2246 @cindex @code{autoBeaming}
2247 @cindex lyrics
2248
2249 If beams are used to indicate melismata in songs, then automatic
2250 beaming should be switched off.  This is done by setting
2251 @code{autoBeaming} to @code{#f}.
2252
2253 @refcommands
2254
2255 @cindex @code{\autoBeamOff}
2256 @code{\autoBeamOff},
2257 @cindex @code{\autoBeamOn}
2258 @code{\autoBeamOn}.
2259
2260
2261 @refbugs
2262
2263 If a score ends while an automatic beam has not been ended and is
2264 still accepting notes, this last beam will not be typeset at all.  The
2265 same holds polyphonic voices, entered with @code{<< @dots{} \\ @dots{}
2266 >>}.  If a polyphonic voice ends while an automatic beam is still
2267 accepting notes, it is not typeset.
2268
2269 @node Beam formatting
2270 @subsection Beam formatting
2271
2272 When a beam falls in the middle of the staff, the beams point normally
2273 down.  However, this behaviour can be altered with the
2274 @code{neutral-direction} property.
2275
2276 @lilypond[quote,raggedright,relative=2,fragment,verbatim]
2277 {
2278   b8[ b]
2279   \override Beam #'neutral-direction = #-1
2280   b[ b]
2281   \override Beam #'neutral-direction = #1
2282   b[ b]
2283 }
2284 @end lilypond
2285
2286