Next: Paper and layout, Previous: Contexts and engravers, Up: Top
These snippets illustrate the Notation Reference, section Changing defaults.
See also Learning Manual, section Tweaking output.
By setting properties in NonMusicalPaperColumn
, vertical spacing
can be adjusted per system.
By setting alignment-extra-space
or
fixed-alignment-extra-space
an individual system may be
stretched vertically.
For technical reasons, \overrideProperty
must be used for
changing these properties within a staff; \override
in a
\context
block may still be used for global overrides.
#(set-global-staff-size 13) \relative c'' \new StaffGroup << \new Staff { c1 \break c1 \break c1 \break } \new Staff { c1 | c | c } \new PianoStaff << \new Voice { \set PianoStaff.instrumentName = #"piano" \set PianoStaff.shortInstrumentName = #"pn" c1_"normal" \overrideProperty #"Score.NonMusicalPaperColumn" #'line-break-system-details #'((fixed-alignment-extra-space . 15)) c_"fixed-aligment-extra-space" \overrideProperty #"Score.NonMusicalPaperColumn" #'line-break-system-details #'((alignment-extra-space . 15)) c_"aligment-extra-space" } { c1 | c | c } >> >>
Simple horizontal analysis brackets are added below the staff by default. The following example shows a way to place them above the staff instead.
\layout { \context { \Voice \consists "Horizontal_bracket_engraver" } } \relative c'' { \once \override HorizontalBracket #'direction = #UP c2\startGroup d\stopGroup }
A caesura is sometimes denoted with a double "railtracks" breath mark with a fermata sign positioned above. This snippet should present an optically pleasing combination of railtracks and a fermata.
{ c''2. % construct the symbol \override BreathingSign #'text = \markup { \line { \musicglyph #"scripts.caesura.curved" \translate #'(-1.75 . 1.6) \musicglyph #"scripts.ufermata" } } \breathe c''4 % set the breathe mark back to normal \revert BreathingSign #'text c''2. \breathe c''4 \bar "|." }
Individual note heads in a chord can be modified with the
\tweak
command inside a chord, by altering the font-size
property.
Inside the chord (within the brackets < >
), before the note to
be altered, place the \tweak
command, followed by
#'font-size
and define the proper size like #-2
(a tiny
notehead).
\layout { ragged-right = ##t } \relative { <\tweak #'font-size #+2 c e g c \tweak #'font-size #-2 e>1^\markup { A tiny e }_\markup { A big c } }
If there are ten or fewer measures of rests, a series of longa
and breve rests (called in German "Kirchenpausen" - church rests)
is printed within the staff; otherwise a simple line is shown.
This default number of ten may be changed by overriding the
expand-limit
property:
\relative c'' { \compressFullBarRests R1*2 | R1*5 | R1*9 \override MultiMeasureRest #'expand-limit = 3 R1*2 | R1*5 | R1*9 }
The \applyOutput
command allows the tuning of any layout
object, in any context. It requires a Scheme function with three
arguments.
\layout { ragged-right = ##t } #(define (mc-squared grob grob-origin context) (let* ( (ifs (ly:grob-interfaces grob)) (sp (ly:grob-property grob 'staff-position)) ) (if (memq 'note-head-interface ifs) (begin (ly:grob-set-property! grob 'stencil ly:text-interface::print) (ly:grob-set-property! grob 'font-family 'roman) (ly:grob-set-property! grob 'text (make-raise-markup -0.5 (case sp ((-5) (make-simple-markup "m")) ((-3) (make-simple-markup "c ")) ((-2) (make-smaller-markup (make-bold-markup "2"))) (else (make-simple-markup "bla")) )))) ))) \relative c' { <d f g b>2 \applyOutput #'Voice #mc-squared <d f g b> }
The text used for crescendos and decrescendos can be
changed by modifying the context properties crescendoText
and decrescendoText
. The style of the spanner line can
be changed by modifying the 'style
property of
DynamicTextSpanner
. The default value is
'hairpin
, and other possible values include
'line
, 'dashed-line
, and
'dotted-line
:
\relative c'' { \set crescendoText = \markup { \italic { cresc. poco } } \set crescendoSpanner = #'text \override DynamicTextSpanner #'style = #'dotted-line a2\< a a2 a a2 a a2 a\mf }
The default font families for text can be overridden with
make-pango-font-tree
.
\paper { % change for other default global staff size. myStaffSize = #20 %{ run lilypond -dshow-available-fonts blabla to show all fonts available in the process log. %} #(define fonts (make-pango-font-tree "Times New Roman" "Nimbus Sans" "Luxi Mono" ;; "Helvetica" ;; "Courier" (/ myStaffSize 20))) } \relative { c'^\markup { roman: foo \bold bla \italic bar \italic \bold baz } c'_\markup { \override #'(font-family . sans) { sans: foo \bold bla \italic bar \italic \bold baz } } c'2^\markup { \override #'(font-family . typewriter) { mono: foo \bold bla \italic bar \italic \bold baz } } }
Though the simplest way to resize staves is to use
#(set-global-staff-size xx)
, an individual staff's size can be
changed by scaling the properties staff-space
and
fontSize
.
<< \new Staff \relative c'' { \dynamicDown c8\ff c c c c c c c } \new Staff \with { fontSize = #-3 \override StaffSymbol #'staff-space = #(magstep -3) } { \clef bass c8 c c c c\f c c c } >>
The vertical ordering of scripts is controlled with the
script-priority
property. The lower this number, the closer it
will be put to the note. In this example, the TextScript
(the
sharp symbol) first has the lowest priority, so it is put lowest in the
first example. In the second, the prall trill (the Script
) has
the lowest, so it is on the inside. When two objects have the same
priority, the order in which they are entered determines which one
comes first.
\relative c''' { \once \override TextScript #'script-priority = #-100 a2^\prall^\markup { \sharp } \once \override Script #'script-priority = #-100 a2^\prall^\markup { \sharp } }
The default behavior of tuplet-bracket visibility is to print a bracket
unless there is a beam of the same length as the tuplet. To control the
visibility of tuplet brackets, set the property TupletBracket
#'bracket-visibility
to either ##t
(always print a bracket),
##f
(never print a bracket) or #'if-no-beam
(only print a
bracket if there is no beam).
mus = \relative c'' { \times 2/3 { c16[ d e } f8] \times 2/3 { c8 d e } \times 2/3 { c4 d e } } \new Voice \relative c'{ << \mus s4^"default" >> \override TupletBracket #'bracket-visibility = #'if-no-beam << \mus s4^"'if-no-beam" >> \override TupletBracket #'bracket-visibility = ##t << \mus s4^"#t" >> \override TupletBracket #'bracket-visibility = ##f << \mus s4^"#f" >> }
Unlike text scripts, rehearsal marks cannot be stacked at a particular point
in a score: only one RehearsalMark
object is created. Using an
invisible measure and bar line, an extra rehearsal mark can be added, giving
the appearance of two marks in the same column.
This method may also prove useful for placing rehearsal marks at both the end of one system and the start of the following system.
{ \key a \major \set Score.markFormatter = #format-mark-box-letters \once \override Score.RehearsalMark #'outside-staff-priority = #5000 \once \override Score.RehearsalMark #'self-alignment-X = #LEFT \once \override Score.RehearsalMark #'break-align-symbols = #'(key-signature) \mark \markup { \bold { Senza denti } } % the hidden measure and bar line \once \override Score.TimeSignature #'stencil = ##f \time 1/16 s16 \bar "" \time 4/4 \once \override Score.RehearsalMark #'self-alignment-X = #LEFT \once \override Score.RehearsalMark #'break-align-symbols = #'(bar-line) \mark \markup { \box \bold Intro } d'1 \mark \default d'1 }
The \startTextSpan
and \stopTextSpan
commands allow the
creation of text spanners as easily as pedal indications or
octavations. Override some properties of the TextSpanner
object
to modify its output.
\relative c'' { \override TextSpanner #'edge-text = #'("bla" . "blu") a \startTextSpan b c a \stopTextSpan \override TextSpanner #'dash-period = #2 \override TextSpanner #'dash-fraction = #0.0 a \startTextSpan b c a \stopTextSpan \revert TextSpanner #'style \override TextSpanner #'style = #'dashed-line \override TextSpanner #'bound-details #'left #'text = \markup { \draw-line #'(0 . 1) } \override TextSpanner #'bound-details #'right #'text = \markup { \draw-line #'(0 . -2) } a \startTextSpan b c a \stopTextSpan \set Staff.middleCPosition = #-13 \override TextSpanner #'dash-period = #10 \override TextSpanner #'dash-fraction = #0.5 \override TextSpanner #'thickness = #10 a \startTextSpan b c a \stopTextSpan \set Staff.middleCPosition = #-6 }
Custodes may be engraved in various styles.
\layout { ragged-right = ##t } \new Staff \with { \consists "Custos_engraver" } \relative c' { \override Staff.Custos #'neutral-position = #4 \override Staff.Custos #'style = #'hufnagel c1^"hufnagel" \break <d a' f'>1 \override Staff.Custos #'style = #'medicaea c1^"medicaea" \break <d a' f'>1 \override Staff.Custos #'style = #'vaticana c1^"vaticana" \break <d a' f'>1 \override Staff.Custos #'style = #'mensural c1^"mensural" \break <d a' f'>1 }
Fret diagram properties can be set through
fret-diagram-details
. For FretBoard fret diagrams,
overrides are applied to the FretBoards.FretBoard
object.
\include "predefined-guitar-fretboards.ly" \storePredefinedDiagram \chordmode { c' } #guitar-tuning #"x;1-1-(;3-2;3-3;3-4;1-1-);" << \context ChordNames { \chordmode { c1 c c d } } \context FretBoards { % Set global properties of fret diagram \override FretBoards.FretBoard #'size = #'1.2 \override FretBoards.FretBoard #'fret-diagram-details #'finger-code = #'in-dot \override FretBoards.FretBoard #'fret-diagram-details #'dot-color = #'white \chordmode { c \once \override FretBoards.FretBoard #'size = #'1.0 \once \override FretBoards.FretBoard #'fret-diagram-details #'barre-type = #'straight \once \override FretBoards.FretBoard #'fret-diagram-details #'dot-color = #'black \once \override FretBoards.FretBoard #'fret-diagram-details #'finger-code = #'below-string c' \once \override FretBoards.FretBoard #'fret-diagram-details #'barre-type = #'none \once \override FretBoards.FretBoard #'fret-diagram-details #'number-type = #'arabic \once \override FretBoards.FretBoard #'fret-diagram-details #'orientation = #'landscape \once \override FretBoards.FretBoard #'fret-diagram-details #'mute-string = #"M" \once \override FretBoards.FretBoard #'fret-diagram-details #'label-dir = #-1 \once \override FretBoards.FretBoard #'fret-diagram-details #'dot-color = #'black c' \once \override FretBoards.FretBoard #'fret-diagram-details #'finger-code = #'below-string \once \override FretBoards.FretBoard #'fret-diagram-details #'dot-radius = #0.35 \once \override FretBoards.FretBoard #'fret-diagram-details #'dot-position = #0.5 \once \override FretBoards.FretBoard #'fret-diagram-details #'fret-count = #3 d } } \context Voice { c'1 c' c' d' } >>
Fret diagram properties can be set through
fret-diagram-details
. For markup fret diagrams, overrides
can be applied to the Voice.TextScript
object or directly
to the markup.
<< \chords { c1 c c d } \new Voice = "mel" { \textLengthOn % Set global properties of fret diagram \override Voice.TextScript #'size = #'1.2 \override Voice.TextScript #'fret-diagram-details #'finger-code = #'in-dot \override Voice.TextScript #'fret-diagram-details #'dot-color = #'white %% C major for guitar, no barre, using defaults % terse style c'1^\markup { \fret-diagram-terse #"x;3-3;2-2;o;1-1;o;" } %% C major for guitar, barred on third fret % verbose style % size 1.0 % roman fret label, finger labels below string, straight barre c'1^\markup { % standard size \override #'(size . 1.0) { \override #'(fret-diagram-details . ( (number-type . roman-lower) (finger-code . in-dot) (barre-type . straight))) { \fret-diagram-verbose #'((mute 6) (place-fret 5 3 1) (place-fret 4 5 2) (place-fret 3 5 3) (place-fret 2 5 4) (place-fret 1 3 1) (barre 5 1 3)) } } } %% C major for guitar, barred on third fret % verbose style % landscape orientation, arabic numbers, M for mute string % no barre, fret label down or left, small mute label font c'1^\markup { \override #'(fret-diagram-details . ( (finger-code . below-string) (number-type . arabic) (label-dir . -1) (mute-string . "M") (orientation . landscape) (barre-type . none) (xo-font-magnification . 0.4) (xo-padding . 0.3))) { \fret-diagram-verbose #'((mute 6) (place-fret 5 3 1) (place-fret 4 5 2) (place-fret 3 5 3) (place-fret 2 5 4) (place-fret 1 3 1) (barre 5 1 3)) } } %% simple D chord % terse style % larger dots, centered dots, fewer frets % label below string d'1^\markup { \override #'(fret-diagram-details . ( (finger-code . below-string) (dot-radius . 0.35) (dot-position . 0.5) (fret-count . 3))) { \fret-diagram-terse #"x;x;o;2-1;3-2;2-3;" } } } >>
If there is only one staff in one of the staff types
ChoirStaff
, InnerChoirStaff
, InnerStaffGroup
or StaffGroup
, the bracket and the starting bar line will not
be displayed as standard behavior. This can be changed by overriding
the relevant properties, as demonstrated in this example.
Note that in contexts such as PianoStaff
and GrandStaff
where the systems begin with a brace instead of a bracket, another
property has to be set, as shown on the second system in the example.
\markup \column { \score { \new StaffGroup << % Must be lower than the actual number of staff lines \override StaffGroup.SystemStartBracket #'collapse-height = #1 \override Score.SystemStartBar #'collapse-height = #1 \new Staff { c'1 } >> \layout { } } \score { \new PianoStaff << \override PianoStaff.SystemStartBrace #'collapse-height = #1 \override Score.SystemStartBar #'collapse-height = #1 \new Staff { c'1 } >> \layout { } } }
The print-function
can be overridden to draw a box around an
arbitrary grob.
\relative c'' { \override TextScript #'stencil = #(make-stencil-boxer 0.1 0.3 ly:text-interface::print) c'4^"foo" \override Stem #'stencil = #(make-stencil-boxer 0.05 0.25 ly:stem::print) \override Score.RehearsalMark #'stencil = #(make-stencil-boxer 0.15 0.3 ly:text-interface::print) b8 \revert Stem #'stencil c4. c4 \mark "F" c1 }
The \circle
command allows you to draw circles around various objects,
for example fingering indications. However, some objects require
specific tweaks: rehearsal marks depend on the Score.markFormatter
context, bar numbers on the Score.BarNumber
context, and so on.
You can tweak the printing of your circles by setting some properties
such as #'thickness
, #'circle-padding
or #'font-size
.
\relative c' { c1 \set Score.markFormatter = #(lambda (mark context) (make-circle-markup (format-mark-numbers mark context))) \mark \default c2 d^\markup { \circle \finger 2 } \override Score.BarNumber #'break-visibility = #all-visible \override Score.BarNumber #'stencil = #(make-stencil-circler 0.1 0.25 ly:text-interface::print) }
For fine-tuning the appearance of a pedal bracket, the properties
edge-width
, edge-height
, and shorten-pair
of
PianoPedalBracket
objects can be modified. For example, the
bracket may be extended to the right edge of the note head:
\relative c'' { \override Staff.PianoPedalBracket #'shorten-pair = #'(0 . -1.0) c4\sostenutoOn d e c, f4 g a2\sostenutoOff }
When the typesetting engine cannot cope, the force-hshift
property of the NoteColumn
object can be used to override
typesetting decisions. The measure units used here are staff spaces.
\relative c' << { <d g>2 <d g> } \\ { <b f'>2 \once \override NoteColumn #'force-hshift = #1.7 <b f'>2 } >>
This snippet shows many possibilities for obtaining and tweaking fret diagrams.
<< \chords { a2 a c2 c d1 } \new Voice = "mel" { \textLengthOn % Set global properties of fret diagram \override Voice.TextScript #'size = #1.2 \override Voice.TextScript #'fret-diagram-details #'finger-code = #'below-string \override Voice.TextScript #'fret-diagram-details #'dot-color = #'black %% A chord for ukelele a'2^\markup { \override #'(fret-diagram-details . ( (string-count . 4) (dot-color . white) (finger-code . in-dot))) { \fret-diagram #"4-2-2;3-1-1;2-o;1-o;" } } %% A chord for ukelele, with formatting defined in definition string % 1.2 * size, 4 strings, 4 frets, fingerings below string % dot radius .35 of fret spacing, dot position 0.55 of fret spacing a'2^\markup { \override #'(fret-diagram-details . ( (dot-color . white) (open-string . "o"))) { \fret-diagram #"s:1.2;w:4;h:3;f:2;d:0.35;p:0.55;4-2-2;3-1-1;2-o;1-o;" } } %% C major for guitar, barred on third fret % verbose style % roman fret label, finger labels below string, straight barre c'2^\markup { % 110% of default size \override #'(size . 1.1) { \override #'(fret-diagram-details . ( (number-type . roman-lower) (finger-code . below-string) (barre-type . straight))) { \fret-diagram-verbose #'((mute 6) (place-fret 5 3 1) (place-fret 4 5 2) (place-fret 3 5 3) (place-fret 2 5 4) (place-fret 1 3 1) (barre 5 1 3)) } } } %% C major for guitar, barred on third fret % verbose style c'2^\markup { % 110% of default size \override #'(size . 1.1) { \override #'(fret-diagram-details . ( (number-type . arabic) (dot-label-font-mag . 0.9) (finger-code . in-dot) (fret-label-font-mag . 0.6) (fret-label-vertical-offset . 0) (label-dir . -1) (mute-string . "M") (orientation . landscape) (xo-font-magnification . 0.4) (xo-padding . 0.3))) { \fret-diagram-verbose #'((mute 6) (place-fret 5 3 1) (place-fret 4 5 2) (place-fret 3 5 3) (place-fret 2 5 4) (place-fret 1 3 1) (barre 5 1 3)) } } } %% simple D chord d'1^\markup { \override #'(fret-diagram-details . ( (finger-code . below-string) (dot-radius . 0.35) (dot-position . 0.5) (fret-count . 3))) { \fret-diagram-terse #"x;x;o;2-1;3-2;2-3;" } } } >>
Some dynamic expressions involve additional text, like "sempre pp". Since lilypond aligns all dynamics centered on the note, the \pp would be displayed way after the note it applies to.
To correctly align the "sempre \pp" horizontally, so that it is aligned as if it were only the \pp, there are several approaches:
* Simply use \once\override DynamicText #'X-offset = #-9.2
before the note with the dynamics to manually shift it to the correct
position. Drawback: This has to be done manually each time you use that
dynamic markup... * Add some padding (#:hspace 7.1
) into the
definition of your custom dynamic mark, so that after lilypond
center-aligns it, it is already correctly aligned. Drawback: The
padding really takes up that space and does not allow any other markup
or dynamics to be shown in that position.
* Shift the dynamic script \once\override ... #'X-offset = ..
.
Drawback: \once\override
is needed for every invocation!
* Set the dimensions of the additional text to 0 (using
#:with-dimensions '(0 . 0) '(0 . 0)
). Drawback: To lilypond
"sempre" has no extent, so it might put other stuff there and create
collisions (which are not detected by the collision dection!). Also,
there seems to be some spacing, so it's not exactly the same alignment
as without the additional text
* Add an explicit shifting directly inside the scheme function for the dynamic-script.
* Set an explicit alignment inside the dynamic-script. By default, this
won't have any effect, only if one sets X-offset! Drawback: One needs
to set DynamicText #'X-offset
, which will apply to all dynamic
texts! Also, it is aligned at the right edge of the additional text,
not at the center of pp.
\header { title = "Horizontally aligning custom dynamics" } \layout { ragged-right = ##t } % Solution 1: Using a simple markup with a particular halign value % Drawback: It's a markup, not a dynamic command, so \dynamicDown etc. will have no effect semppMarkup = \markup { \halign #1.4 \italic "sempre" \dynamic "pp" } % Solution 2: Using a dynamic script and shifting with \once\override ... #'X-offset = .. % Drawback: \once\override needed for every invocation semppK = #(make-dynamic-script (markup #:line( #:normal-text #:italic "sempre" #:dynamic "pp"))) % Solution 3: Padding the dynamic script so the center-alignment puts it to the correct position % Drawback: the padding really reserves the space, nothing else can be there semppT = #( make-dynamic-script ( markup #:line ( #:normal-text #:italic "sempre" #:dynamic "pp" #:hspace 7.1 ) ) ) % Solution 4: Dynamic, setting the dimensions of the additional text to 0 % Drawback: To lilypond "sempre" has no extent, so it might put other stuff there => collisions % Drawback: Also, there seems to be some spacing, so it's not exactly the % same alignment as without the additional text semppM = #(make-dynamic-script (markup #:line( #:with-dimensions '(0 . 0) '(0 . 0) #:right-align #:normal-text #:italic "sempre" #:dynamic "pp"))) % Solution 5: Dynamic with explicit shifting inside the scheme function semppG = #(make-dynamic-script (markup #:hspace 0 #:translate (cons -18.85 0 ) #:line( #:normal-text #:italic "sempre" #:dynamic "pp")) ) % Solution 6: Dynamic with explicit alignment. This has only effect, if one sets X-offset! % Drawback: One needs to set DynamicText #'X-offset! % Drawback: Aligned at the right edge of the additional text, not at the center of pp semppMII = #(make-dynamic-script (markup #:line(#:right-align #:normal-text #:italic "sempre" #:dynamic "pp"))) \context StaffGroup << \context Staff="s" << \set Staff.instrumentName = "Normal" \relative c'' { \key es \major c4\pp c\p c c | c\ff c c\pp c } >> \context Staff="sMarkup" << \set Staff.instrumentName = \markup\column{"Normal" "Markup"} \relative c'' { \key es \major c4-\semppMarkup c\p c c | c\ff c c-\semppMarkup c} >> \context Staff="sK" << \set Staff.instrumentName = \markup\column{"Explicit" "shifting"} \relative c'' { \key es \major \once \override DynamicText #'X-offset = #-9.2 c4\semppK c\p c c | c\ff c \once \override DynamicText #'X-offset = #-9.2 c\semppK c } >> \context Staff="sT" << \set Staff.instrumentName = \markup\column{"Right" "padding"} \relative c'' { \key es \major c4\semppT c\p c c | c\ff c c\semppT c } >> \context Staff="sM" << \set Staff.instrumentName = \markup\column{"Setting" "dimension" "to zero"} \relative c'' { \key es \major c4\semppM c\p c c | c\ff c c\semppM c } >> \context Staff="sG" << \set Staff.instrumentName = \markup\column{"Shifting" "inside" "dynamics"} \relative c'' { \key es \major c4\semppG c\p c c | c\ff c c\semppG c} >> \context Staff="sMII" << \set Staff.instrumentName = \markup\column{"Alignment" "inside" "dynamics"} \relative c'' { \key es \major \override DynamicText #'X-offset = #0 % Setting to ##f (false) gives the same resul c4\semppMII c\p c c | c\ff c c\semppMII c } >> >>
If you want to move the position of a fret diagram, for example, to avoid collision, or to place it between two notes, you have various possibilities:
1) modify #'padding or #'extra-offset values (as shown in the first snippet)
2) you can add an invisible voice and attach the fret diagrams to the invisible notes in that voice (as shown in the second example).
If you need to move the fret according with a rythmic position inside the bar (in the example, the third beat of the measure) the second example is better, because the fret is aligned with the third beat itself.
harmonies = \chordmode { a8:13 % THE FOLLOWING IS THE COMMAND TO MOVE THE CHORD NAME \once \override ChordNames.ChordName #'extra-offset = #'(10 . 0) b8:13 s2. % THIS LINE IS THE SECOND METHOD s4 s4 b4:13 } \score { << \context ChordNames \harmonies \context Staff {a8^\markup { \fret-diagram #"6-x;5-0;4-2;3-0;2-0;1-2;" } % THE FOLLOWING IS THE COMMAND TO MOVE THE FRET DIAGRAM \once \override TextScript #'extra-offset = #'(10 . 0) b4.~^\markup { \fret-diagram #"6-x;5-2;4-4;3-2;2-2;1-4;" } b4. a8\break % HERE IS THE SECOND METHOD << { a8 b4.~ b4. a8} { s4 s4 s4^\markup { \fret-diagram #"6-x;5-2;4-4;3-2;2-2;1-4;" } } >> } >> }
Caesura marks can be created by overriding the 'text
property of the BreathingSign
object. A curved caesura
mark is also available.
\relative c'' { \override BreathingSign #'text = #(make-musicglyph-markup "scripts.caesura.straight") c8 e4. \breathe g8. e16 c4 \override BreathingSign #'text = #(make-musicglyph-markup "scripts.caesura.curved") g8 e'4. \breathe g8. e16 c4 }
Setting the transparent
property will cause an object to be
printed in "invisible ink": the object is not printed, but all its
other behavior is retained. The object still takes up space, it takes
part in collisions, and slurs, ties and beams can be attached to it.
This snippet demonstrates how to connect different voices using ties. Normally, ties only connect two notes in the same voice. By introducing a tie in a different voice, and blanking the first up-stem in that voice, the tie appears to cross voices. To prevent the blanked stem's flag from interfering with tie positioning, the stem is extended.
\relative c'' { \time 2/4 << { \once \override Stem #'transparent = ##t \once \override Stem #'length = #8 b8 ~ b\noBeam \once \override Stem #'transparent = ##t \once \override Stem #'length = #8 g8 ~ g\noBeam } \\ { b8 g g e } >> }
Beam positions may be controlled manually, by overriding the
positions
setting of the Beam
grob.
\relative c' { \time 2/4 % from upper staffline (position 4) to center (position 0) \override Beam #'positions = #'(2 . 0) c8 c % from center to one above center (position 2) \override Beam #'positions = #'(0 . 1) c8 c }
The mensurstriche-layout where the bar lines do not show on the staves
but between staves can be achieved with a StaffGroup
instead of
a ChoirStaff
. The bar line on staves is blanked out by setting
the transparent
property.
global = { \override Staff.BarLine #'transparent = ##t s1 s % the final bar line is not interrupted \revert Staff.BarLine #'transparent \bar "|." } \new StaffGroup \relative c'' { << \new Staff { << \global { c1 c } >> } \new Staff { << \global { c c } >> } >> }
The property systemStartDelimiterHierarchy
can be used to make
more complex nested staff groups. The command \set
StaffGroup.systemStartDelimiterHierarchy
takes an alphabetical list of
the number of staves produced. Before each staff a system start
delimiter can be given. It has to be enclosed in brackets and takes as
much staves as the brackets enclose. Elements in the list can be
omitted, but the first bracket takes always the complete number of
staves. The possibilities are SystemStartBar
,
SystemStartBracket
, SystemStartBrace
, and
SystemStartSquare
.
\new StaffGroup \relative c'' << \set StaffGroup.systemStartDelimiterHierarchy = #'(SystemStartSquare (SystemStartBrace (SystemStartBracket a (SystemStartSquare b) ) c ) d) \new Staff { c1 } \new Staff { c1 } \new Staff { c1 } \new Staff { c1 } \new Staff { c1 } >>
Unlike ordinary rests, there is no predefined command to change the vertical position on the staff of a multi-measure rest symbol of either form by attaching it to a note. However, in polyphonic music multi-measure rests in odd-numbered and even-numbered voices are vertically separated. The positioning of multi-measure rests can be controlled as follows:
\relative c'' { % Multi-measure rests by default are set under the second line R1 % They can be moved with an override \override MultiMeasureRest #'staff-position = #-2 R1 % A value of 0 is the default position; % the following trick moves the rest to the center line \override MultiMeasureRest #'staff-position = #-0.01 R1 % Multi-measure rests in odd-numbered voices are under the top line << { R1 } \\ { a1 } >> % Multi-measure rests in even-numbered voices are under the bottom line << { c1 } \\ { R1 } >> % They remain separated even in empty measures << { R1 } \\ { R1 } >> % This brings them together even though there are two voices \compressFullBarRests << \revert MultiMeasureRest #'staff-position { R1*3 } \\ \revert MultiMeasureRest #'staff-position { R1*3 } >> }
A |:
bar line can be printed at the beginning of a piece, by
overriding the relevant property:
\relative c'' { \once \override Score.BreakAlignment #'break-align-orders = #(make-vector 3 '(instrument-name left-edge ambitus span-bar breathing-sign clef key-signature time-signature staff-bar custos span-bar)) \bar "|:" c1 d1 d4 e f g }
By default, metronome and rehearsal marks are printed above the staff.
To place them below the staff simply set the direction
property
of MetronomeMark
or RehearsalMark
appropriately.
\layout { ragged-right = ##f } { % Metronome marks below the staff \override Score.MetronomeMark #'direction = #DOWN \tempo 8. = 120 c''1 % Rehearsal marks below the staff \override Score.RehearsalMark #'direction = #DOWN \mark \default c''1 }
If strict-note-spacing
is set spacing of notes is not influenced
by bars or clefs within a system. Rather, they are placed just before
the note that occurs at the same time. This may cause collisions.
\paper { ragged-right = ##t } \relative c'' << \override Score.SpacingSpanner #'strict-note-spacing = ##t \set Score.proportionalNotationDuration = #(ly:make-moment 1 16) \new Staff { c8[ c \clef alto c c \grace { d16 } c8 c] c4 c2 \grace { c16[ c16] } c2 } \new Staff { c2 \times 2/3 { c8 \clef bass cis,, c } c4 c1 } >>
The first empty staff can also be removed from the score by setting the
VerticalAxisGroup
property remove-first
. This can be done
globally inside the \layout
block, or locally inside the
specific staff that should be removed. In the latter case, you have to
specify the context (Staff
applies only to the current staff) in
front of the property.
The lower staff of the second staff group is not removed, because the setting applies only to the specific staff inside of which it is written.
\layout { \context { \RemoveEmptyStaffContext % To use the setting globally, uncomment the following line: % \override VerticalAxisGroup #'remove-first = ##t } } \new StaffGroup << \new Staff \relative c' { e4 f g a \break c1 } \new Staff { % To use the setting globally, comment this line, % uncomment the line in the \layout block above \override Staff.VerticalAxisGroup #'remove-first = ##t R1 \break R } >> \new StaffGroup << \new Staff \relative c' { e4 f g a \break c1 } \new Staff { R1 \break R } >>
Rests may be used in various styles.
\layout { indent = 0.0 \context { \Staff \remove "Time_signature_engraver" } } \relative c { \set Score.timing = ##f \override Staff.Rest #'style = #'mensural r\maxima^\markup \typewriter { mensural } r\longa r\breve r1 r2 r4 r8 r16 r32 r64 r128 r128 \bar "" \override Staff.Rest #'style = #'neomensural r\maxima^\markup \typewriter { neomensural } r\longa r\breve r1 r2 r4 r8 r16 r32 r64 r128 r128 \bar "" \override Staff.Rest #'style = #'classical r\maxima^\markup \typewriter { classical } r\longa r\breve r1 r2 r4 r8 r16 r32 r64 r128 r128 \bar "" \override Staff.Rest #'style = #'default r\maxima^\markup \typewriter { default } r\longa r\breve r1 r2 r4 r8 r16 r32 r64 r128 r128 }
In "simple" lead-sheets, sometimes no actual notes are written,
instead only "rhythmic patterns" and chords above the measures are
notated giving the structure of a song. Such a feature is for example
useful while creating/transcribing the structure of a song and also
when sharing lead sheets with guitarists or jazz musicians. The
standard support for this using \repeat percent
is unsuitable
here since the first beat has to be an ordinary note or rest. This
example shows two solutions to this problem, by redefining ordinary
rests to be printed as slashes. (If the duration of each beat is not a
quarter note, replace the r4
in the definitions with a rest of
the appropriate duration).
% Macro to print single slash rs = { \once \override Rest #'stencil = #ly:percent-repeat-item-interface::beat-slash \once \override Rest #'thickness = #'0.48 \once \override Rest #'slope = #'1.7 r4 } % Function to print a specified number of slashes comp = #(define-music-function (parser location count) ( integer?) #{ \override Rest #'stencil = #ly:percent-repeat-item-interface::beat-slash \override Rest #'thickness = #'0.48 \override Rest #'slope = #'1.7 \repeat unfold $count { r4 } \revert Rest #'stencil #} ) \score{ \relative c' { c d e f | \rs \rs \rs \rs | \comp #4 | } }
If notes from two voices with stems in the same direction are
placed at the same position, and both voices have no shift or the
same shift specified, the error message "warning: ignoring too
many clashing note columns" will appear when compiling the
LilyPond file. This message can be suppressed by setting the
'ignore-collision
property of the NoteColumn
object
to #t
.
ignore = \override NoteColumn #'ignore-collision = ##t \relative c' << \ignore { \stemDown f2 g } \\ { c2 c, } >>
The time signature can be enclosed within parentheses.
\relative c'' { \override Staff.TimeSignature #'stencil = #(lambda (grob) (bracketify-stencil (ly:time-signature::print grob) Y 0.1 0.2 0.1)) \time 2/4 a4 b8 c }
The command \clef "treble_8"
is equivalent to setting
clefGlyph
, clefPosition
(which controls the vertical
position of the clef), middleCPosition
and
clefOctavation
. A clef is printed when any of the properties
except middleCPosition
are changed.
Note that changing the glyph, the position of the clef, or the
octavation does not in itself change the position of subsequent notes
on the staff: the position of middle C must also be specified to do
this. The positional parameters are relative to the staff center line,
positive numbers displacing upwards, counting one for each line and
space. The clefOctavation
value would normally be set to 7, -7,
15 or -15, but other values are valid.
When a clef change takes place at a line break the new clef symbol is
printed at both the end of the previous line and the beginning of the
new line by default. If the warning clef at the end of the previous
line is not required it can be suppressed by setting the Staff
property explicitClefVisibility
to the value
end-of-line-invisible
. The default behavior can be recovered
with \unset Staff.explicitClefVisibility
.
The following examples show the possibilities when setting these properties manually. On the first line, the manual changes preserve the standard relative positioning of clefs and notes, whereas on the second line, they do not.
{ % The default treble clef c'1 % The standard bass clef \set Staff.clefGlyph = #"clefs.F" \set Staff.clefPosition = #2 \set Staff.middleCPosition = #6 c'1 % The baritone clef \set Staff.clefGlyph = #"clefs.C" \set Staff.clefPosition = #4 \set Staff.middleCPosition = #4 c'1 % The standard choral tenor clef \set Staff.clefGlyph = #"clefs.G" \set Staff.clefPosition = #-2 \set Staff.clefOctavation = #-7 \set Staff.middleCPosition = #1 c'1 % A non-standard clef \set Staff.clefPosition = #0 \set Staff.clefOctavation = #0 \set Staff.middleCPosition = #-4 c'1 \break % The following clef changes do not preserve % the normal relationship between notes and clefs: \set Staff.clefGlyph = #"clefs.F" \set Staff.clefPosition = #2 c'1 \set Staff.clefGlyph = #"clefs.G" c'1 \set Staff.clefGlyph = #"clefs.C" c'1 \set Staff.clefOctavation = #7 c'1 \set Staff.clefOctavation = #0 \set Staff.clefPosition = #0 c'1 % Here we go back to the normal clef: \set Staff.middleCPosition = #0 c'1 }
\tweak
command to tweak individual grobsWith the \tweak
command, every grob can be tuned directly. Here
are some examples of available tweaks.
\relative c' { \time 2/4 \set fingeringOrientations = #'(right) < \tweak #'font-size #3 c \tweak #'color #red d-\tweak #'font-size #8 -4 \tweak #'style #'cross g \tweak #'duration-log #2 a >2 }
By setting the Y-extent
property to a suitable value, all
DynamicLineSpanner
objects (hairpins and dynamic texts) can be
aligned to a common reference point, regardless of their actual extent.
This way, every element will be vertically aligned, thus producing a
more pleasing output.
The same idea is used to align the text scripts along their baseline.
music = \relative c'' { c2\p^\markup { gorgeous } c\f^\markup { fantastic } c4\p c\f\> c c\!\p } { \music \break \override DynamicLineSpanner #'staff-padding = #2.0 \override DynamicLineSpanner #'Y-extent = #'(-1.5 . 1.5) \override TextScript #'Y-extent = #'(-1.5 . 1.5) \music }
This snippet demonstrates the use of the context properties
alignBelowContext
and alignAboveContext
to control the
positioning of lyrics and ossias.
\paper { ragged-right = ##t } \relative c' << \new Staff = "1" { c4 c s2 } \new Staff = "2" { c4 c s2 } \new Staff = "3" { c4 c s2 } { \skip 2 << \lyrics { \set alignBelowContext = #"1" lyrics4 below } \new Staff \with { alignAboveContext = #"3" fontSize = #-2 \override StaffSymbol #'staff-space = #(magstep -2) \remove "Time_signature_engraver" } { \times 4/6 { \override TextScript #'padding = #3 c8^"ossia above" d e d e f } } >> } >>
This page is for LilyPond-2.11.58 (development-branch).
Report errors to http://post.gmane.org/post.php?group=gmane.comp.gnu.lilypond.bugs.
Your suggestions for the documentation are welcome.