[ << Contexts and engravers ] | [Inizio][Contenuti] | [ Paper and layout >> ] |
[ < ] | [ Su : Top ] | [ > ] |
Tweaks and overrides
[ << Tweaks and overrides ] | [Inizio][Contenuti] | [ Paper and layout >> ] |
[ < Tweaks and overrides ] | [ Su : Tweaks and overrides ] | [ > ] |
Aggiungere un segno di ottava a una sola voce
Se il rigo ha più di una voce, l’ottavazione in una voce trasporrà
la posizione delle note in tutte le voci per la durata della parentesi
dell’ottava. Se si intende applicare l’ottavazione a una sola voce,
occorre spostare l’incisore Ottava_spanner_engraver
nel
contesto Voice
.
\layout { \context { \Staff \remove Ottava_spanner_engraver } \context { \Voice \consists Ottava_spanner_engraver } } { \clef bass << { <g d'>1~ q2 <c' e'> } \\ { r2. \ottava -1 <b,,, b,,>4 ~ | q2 \ottava 0 <c e>2 } >> }
[ << Tweaks and overrides ] | [Inizio][Contenuti] | [ Paper and layout >> ] |
[ < ] | [ Su : Tweaks and overrides ] | [ > ] |
Adding links to objects
To add a link to a grob stencil you can use add-link
as defined
here. It works both with \override
and \tweak
.
Drawback: point-and-click
is disturbed for the linked grobs.
Limitation: Works for PDF only.
The linked objects are colored with a separate command. Note that the links are not displayed and are not clickable from inside the LSR.
#(define (add-link url-strg) (lambda (grob) (let* ((stil (ly:grob-property grob 'stencil))) (if (ly:stencil? stil) (let* ((x-ext (ly:stencil-extent stil X)) (y-ext (ly:stencil-extent stil Y)) (url-expr `(url-link ,url-strg ,x-ext ,y-ext)) (new-stil (ly:stencil-add (ly:make-stencil url-expr x-ext y-ext) stil))) (ly:grob-set-property! grob 'stencil new-stil)))))) %%%% test %% For easier maintenance of this snippet the URL is formatted to use the %% actually used LilyPond version. %% Of course a literal URL would work as well. #(define major.minor-version (string-join (take (string-split (lilypond-version) #\.) 2) ".")) urlI = #(format #f "http://lilypond.org/doc/v~a/Documentation/notation/writing-pitches" major.minor-version) urlII = #(format #f "http://lilypond.org/doc/v~a/Documentation/notation/rhythms" major.minor-version) urlIII = #(format #f "http://lilypond.org/doc/v~a/Documentation/notation/note-heads" major.minor-version) urlIV = #(format #f "http://lilypond.org/doc/v~a/Documentation/notation/beams" major.minor-version) urlV = #(format #f "http://lilypond.org/doc/v~a/Documentation/notation/note-head-styles" major.minor-version) urlVI = #(format #f "http://lilypond.org/doc/v~a/Documentation/notation/writing-pitches" major.minor-version) \relative c' { \key cis \minor \once \override Staff.Clef.color = #green \once \override Staff.Clef.after-line-breaking = #(add-link urlI) \once \override Staff.TimeSignature.color = #green \once \override Staff.TimeSignature.after-line-breaking = #(add-link urlII) \once \override NoteHead.color = #green \once \override NoteHead.after-line-breaking = #(add-link urlIII) cis'1 \once \override Beam.color = #green \once \override Beam.after-line-breaking = #(add-link urlIV) cis8 dis e fis gis2 <gis, \tweak Accidental.color #green \tweak Accidental.after-line-breaking #(add-link urlVI) \tweak color #green \tweak after-line-breaking #(add-link urlV) \tweak style #'harmonic bis dis fis >1 <cis, cis' e> }
[ << Tweaks and overrides ] | [Inizio][Contenuti] | [ Paper and layout >> ] |
[ < ] | [ Su : Tweaks and overrides ] | [ > ] |
Adding markups in a tablature
By default markups does not show in a tablature.
To make them appear, simply use the command
\revert TabStaff.TextScript.stencil
%% http://lsr.di.unimi.it/LSR/Item?id=919 % by P.P.Schneider on June 2014 high = { r4 r8 <g c'> q r8 r4 } low = { c4 r4 c8 r8 g,8 b, } pulse = { s8^"1" s^"&" s^"2" s^"&" s^"3" s^"&" s^"4" s^"&" } \score { \new TabStaff { \repeat unfold 2 << \high \\ \low \\ \pulse >> } \layout { \context { \TabStaff \clef moderntab \revert TextScript.stencil \override TextScript.font-series = #'bold \override TextScript.font-size = #-2 \override TextScript.color = #red } \context { \Score proportionalNotationDuration = #(ly:make-moment 1/8) } } }
[ << Tweaks and overrides ] | [Inizio][Contenuti] | [ Paper and layout >> ] |
[ < ] | [ Su : Tweaks and overrides ] | [ > ] |
Aggiungere i segni di tempo per i glissandi lunghi
I battiti saltati nei glissandi molto lunghi vengono talvolta segnalati con delle indicazioni di tempo, che consistono solitamente in dei gambi privi di teste di nota. Questi gambi possono essere usati anche per contenere segni di espressione intermedi.
Se i gambi non si allineano bene al glissando, può essere necessario riposizionarli leggermente.
glissandoSkipOn = { \override NoteColumn.glissando-skip = ##t \hide NoteHead \override NoteHead.no-ledgers = ##t } glissandoSkipOff = { \revert NoteColumn.glissando-skip \undo \hide NoteHead \revert NoteHead.no-ledgers } \relative c'' { r8 f8\glissando \glissandoSkipOn f4 g a a8\noBeam \glissandoSkipOff a8 r8 f8\glissando \glissandoSkipOn g4 a8 \glissandoSkipOff a8 | r4 f\glissando \< \glissandoSkipOn a4\f \> \glissandoSkipOff b8\! r | }
[ << Tweaks and overrides ] | [Inizio][Contenuti] | [ Paper and layout >> ] |
[ < ] | [ Su : Tweaks and overrides ] | [ > ] |
Adjusting grace note spacing
The space given to grace notes can be adjusted using the
spacing-increment
property of Score.GraceSpacing
.
graceNotes = { \grace { c4 c8 c16 c32 } c8 } \relative c'' { c8 \graceNotes \override Score.GraceSpacing.spacing-increment = #2.0 \graceNotes \revert Score.GraceSpacing.spacing-increment \graceNotes }
[ << Tweaks and overrides ] | [Inizio][Contenuti] | [ Paper and layout >> ] |
[ < ] | [ Su : Tweaks and overrides ] | [ > ] |
Adjusting lyrics vertical spacing
This snippet shows how to bring the lyrics line closer to the staff.
% Default layout: << \new Staff \new Voice = melody \relative c' { c4 d e f g4 f e d c1 } \new Lyrics \lyricsto melody { aa aa aa aa aa aa aa aa aa } \new Staff { \new Voice = melody \relative c' { c4 d e f g4 f e d c1 } } % Reducing the minimum space below the staff and above the lyrics: \new Lyrics \with { \override VerticalAxisGroup.nonstaff-relatedstaff-spacing = #'((basic-distance . 1)) } \lyricsto melody { aa aa aa aa aa aa aa aa aa } >>
[ << Tweaks and overrides ] | [Inizio][Contenuti] | [ Paper and layout >> ] |
[ < ] | [ Su : Tweaks and overrides ] | [ > ] |
Altering the length of beamed stems
Stem lengths on beamed notes can be varied by overriding the
beamed-lengths
property of the details
of the
Stem
. If a single value is used as an argument, the length
applies to all stems. When multiple arguments are used, the first
applies to eighth notes, the second to sixteenth notes and so on. The
final argument also applies to all notes shorter than the note length
of the final argument. Non-integer arguments may also be used.
\relative c'' { \override Stem.details.beamed-lengths = #'(2) a8[ a] a16[ a] a32[ a] \override Stem.details.beamed-lengths = #'(8 10 12) a8[ a] a16[ a] a32[ a] r8 \override Stem.details.beamed-lengths = #'(8) a8[ a] \override Stem.details.beamed-lengths = #'(8.5) a8[ a] \revert Stem.details.beamed-lengths a8[ a] a16[ a] a32[ a] r16 }
[ << Tweaks and overrides ] | [Inizio][Contenuti] | [ Paper and layout >> ] |
[ < ] | [ Su : Tweaks and overrides ] | [ > ] |
Numeri di battuta alternativi
Si possono impostare due metodi alternativi di numerazione della battuta, utili specialmente per le ripetizioni.
\relative c'{ \set Score.alternativeNumberingStyle = #'numbers \repeat volta 3 { c4 d e f | } \alternative { { c4 d e f | c2 d \break } { f4 g a b | f4 g a b | f2 a | \break } { c4 d e f | c2 d } } c1 \break \set Score.alternativeNumberingStyle = #'numbers-with-letters \repeat volta 3 { c,4 d e f | } \alternative { { c4 d e f | c2 d \break } { f4 g a b | f4 g a b | f2 a | \break } { c4 d e f | c2 d } } c1 }
[ << Tweaks and overrides ] | [Inizio][Contenuti] | [ Paper and layout >> ] |
[ < ] | [ Su : Tweaks and overrides ] | [ > ] |
Parentesi analitiche sopra il rigo
Delle semplici parentesi analitiche orizzontali vengono aggiunte, per impostazione predefinita, sotto il rigo. L’esempio seguente mostra un modo per posizionarle sopra il rigo.
\layout { \context { \Voice \consists "Horizontal_bracket_engraver" } } \relative c'' { \once \override HorizontalBracket.direction = #UP c2\startGroup d2\stopGroup }
[ << Tweaks and overrides ] | [Inizio][Contenuti] | [ Paper and layout >> ] |
[ < ] | [ Su : Tweaks and overrides ] | [ > ] |
Parentesi analitiche con etichette
Si può aggiungere del testo alle parentesi analitiche tramite la proprietà
text
del grob HorizontalBracketText
. L’aggiunta di vari frammenti
di testo alle parentesi che iniziano nello stesso momento musicale richiede
l’uso del comando \tweak
.
Dopo un’interruzione di linea il testo viene messo tra parentesi.
\paper { tagline = ##f } \layout { \context { \Voice \consists "Horizontal_bracket_engraver" \override HorizontalBracket.direction = #UP } } { \once\override HorizontalBracketText.text = "a" c''\startGroup d''\stopGroup \once\override HorizontalBracketText.text = "a'" e''\startGroup d''\stopGroup | c''-\tweak HorizontalBracketText.text \markup \bold \huge "b" \startGroup -\tweak HorizontalBracketText.text "a" \startGroup d''\stopGroup e''-\tweak HorizontalBracketText.text "a'" \startGroup d''\stopGroup\stopGroup | c''-\tweak HorizontalBracketText.text foo \startGroup d'' e'' f'' | \break g'' a'' b'' c'''\stopGroup }
[ << Tweaks and overrides ] | [Inizio][Contenuti] | [ Paper and layout >> ] |
[ < ] | [ Su : Tweaks and overrides ] | [ > ] |
Asymmetric slurs
Slurs can be made asymmetric to match an asymmetric pattern of notes better.
slurNotes = { d,8( a' d f a f' d, a) } \relative c' { \stemDown \slurUp \slurNotes \once \override Slur.eccentricity = #3.0 \slurNotes }
[ << Tweaks and overrides ] | [Inizio][Contenuti] | [ Paper and layout >> ] |
[ < ] | [ Su : Tweaks and overrides ] | [ > ] |
Caesura ("railtracks") with fermata
A caesura is sometimes denoted by a double “railtracks” breath mark with a fermata sign positioned above. This snippet shows an optically pleasing combination of railtracks and fermata.
\relative c'' { c2. % construct the symbol \override BreathingSign.text = \markup { \override #'(direction . 1) \override #'(baseline-skip . 1.8) \dir-column { \translate #'(0.155 . 0) \center-align \musicglyph "scripts.caesura.curved" \center-align \musicglyph "scripts.ufermata" } } \breathe c4 % set the breathe mark back to normal \revert BreathingSign.text c2. \breathe c4 \bar "|." }
[ << Tweaks and overrides ] | [Inizio][Contenuti] | [ Paper and layout >> ] |
[ < ] | [ Su : Tweaks and overrides ] | [ > ] |
Changing a single note’s size in a chord
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
note head).
\relative c' { <\tweak font-size #+2 c e g c \tweak font-size #-2 e>1 ^\markup { A tiny e }_\markup { A big c } }
[ << Tweaks and overrides ] | [Inizio][Contenuti] | [ Paper and layout >> ] |
[ < ] | [ Su : Tweaks and overrides ] | [ > ] |
Changing beam thickness and spacing
To make beams thicker or thinner alter the Beam.beam-thickness
property. To adjust the spacing between beams alter the
Beam.length-fraction
property.
\relative f' { \time 1/8 \override Beam.beam-thickness = #0.4 \override Beam.length-fraction = #0.8 c32 c c c \revert Beam.beam-thickness % 0.48 is default thickness \revert Beam.length-fraction % 1.0 is default spacing c32 c c c \override Beam.beam-thickness = #0.6 \override Beam.length-fraction = #1.3 c32 c c c }
[ << Tweaks and overrides ] | [Inizio][Contenuti] | [ Paper and layout >> ] |
[ < ] | [ Su : Tweaks and overrides ] | [ > ] |
Modificare la forma delle pause multiple
Se la pausa multipla dura dieci misure o un numero inferiore a dieci, nel rigo
apparirà una serie di pause di longa e di breve (chiamate in tedesco “Kirchenpausen”
- pause ecclesiastiche); altrimenti apparirà una semplice linea. Il numero
predefinito di dieci può essere cambiato sovrascrivendo la proprietà
expand-limit
..
\relative c'' { \compressMMRests { R1*2 | R1*5 | R1*9 \override MultiMeasureRest.expand-limit = #3 R1*2 | R1*5 | R1*9 } }
[ << Tweaks and overrides ] | [Inizio][Contenuti] | [ Paper and layout >> ] |
[ < ] | [ Su : Tweaks and overrides ] | [ > ] |
Changing properties for individual grobs
The \applyOutput
command allows the tuning of any layout
object, in any context. It requires a Scheme function with three
arguments.
#(define (mc-squared grob grob-origin context) (let ((sp (ly:grob-property grob 'staff-position))) (ly:grob-set-property! grob 'stencil (grob-interpret-markup grob #{ \markup \lower #0.5 #(case sp ((-5) "m") ((-3) "c ") ((-2) #{ \markup \teeny \bold 2 #}) (else "bla")) #})))) \relative c' { <d f g b>2 \applyOutput Voice.NoteHead #mc-squared <d f g b>2 }
[ << Tweaks and overrides ] | [Inizio][Contenuti] | [ Paper and layout >> ] |
[ < ] | [ Su : Tweaks and overrides ] | [ > ] |
Nascondere la linea di estensione per le dinamiche testuali
Il testo usato per i crescendo e i decrescendo può essere cambiato
modificando le proprietà di contesto crescendoText
e
decrescendoText
.
Lo stile della linea dell’estensore può essere cambiato modificando la
proprietà 'style
di DynamicTextSpanner
. Il valore predefinito
è 'dashed-line
; gli altri valori possibili sono 'line
,
'dotted-line
e 'none
.
\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 }
[ << Tweaks and overrides ] | [Inizio][Contenuti] | [ Paper and layout >> ] |
[ < ] | [ Su : Tweaks and overrides ] | [ > ] |
Changing the default text font family
The default font families for text can be overridden with
make-pango-font-tree
.
%{ You may have to install additional fonts. Red Hat Fedora dejavu-fonts-all Debian GNU/Linux, Ubuntu fonts-dejavu-core fonts-dejavu-extra %} \paper { % change for other default global staff size. myStaffSize = #20 %{ run lilypond -dshow-available-fonts to show all fonts available in the process log. %} #(define fonts (make-pango-font-tree "DejaVu Serif" "DejaVu Sans" "DejaVu Sans Mono" (/ myStaffSize 20))) } { g'''4^\markup { DejaVu Serif: \bold bold \italic italic \italic \bold { bold italic } } g4_\markup { \override #'(font-family . sans) { DejaVu Sans: \bold bold \italic italic \italic \bold { bold italic } } } g''2^\markup { \override #'(font-family . typewriter) { DejaVu Sans Mono: \bold bold \italic italic \italic \bold { bold italic } } } }
[ << Tweaks and overrides ] | [Inizio][Contenuti] | [ Paper and layout >> ] |
[ < ] | [ Su : Tweaks and overrides ] | [ > ] |
Changing the staff size
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 } >>
[ << Tweaks and overrides ] | [Inizio][Contenuti] | [ Paper and layout >> ] |
[ < ] | [ Su : Tweaks and overrides ] | [ > ] |
Modificare il tempo senza mostrare l’indicazione metronomica
Per cambiare il tempo del file MIDI senza che appaia l’indicazione metronomica, basta renderla invisibile.
\score { \new Staff \relative c' { \tempo 4 = 160 c4 e g b c4 b d c \set Score.tempoHideNote = ##t \tempo 4 = 96 d,4 fis a cis d4 cis e d } \layout { } \midi { } }
[ << Tweaks and overrides ] | [Inizio][Contenuti] | [ Paper and layout >> ] |
[ < ] | [ Su : Tweaks and overrides ] | [ > ] |
Changing the text for sustain markings
Staff.pedalSustainStrings
can be used to set the text used for
pedal down and up. Note that the only valid strings are those found in
the list of pedal glyphs - the values used this snippet constitute an
exhaustive list.
sustainNotes = { c4\sustainOn d e\sustainOff\sustainOn f\sustainOff } \relative c' { \sustainNotes \set Staff.pedalSustainStrings = #'("P" "P-" "-") \sustainNotes \set Staff.pedalSustainStrings = #'("d" "de" "e") \sustainNotes \set Staff.pedalSustainStrings = #'("M" "M-" "-") \sustainNotes \set Staff.pedalSustainStrings = #'("Ped" "*Ped" "*") \sustainNotes }
[ << Tweaks and overrides ] | [Inizio][Contenuti] | [ Paper and layout >> ] |
[ < ] | [ Su : Tweaks and overrides ] | [ > ] |
Controlling spanner visibility after a line break
The visibility of spanners which end on the first note following a line
break is controlled by the after-line-breaking
callback
ly:spanner::kill-zero-spanned-time
.
For objects such as glissandos and hairpins, the default behaviour is to hide the spanner after a break; disabling the callback will allow the left-broken span to be shown.
Conversely, spanners which are usually visible, such as text spans, can be hidden by enabling the callback.
\paper { ragged-right = ##t } \relative c'' { \override Hairpin.to-barline = ##f \override Glissando.breakable = ##t % show hairpin \override Hairpin.after-line-breaking = ##t % hide text span \override TextSpanner.after-line-breaking = #ly:spanner::kill-zero-spanned-time e2\<\startTextSpan % show glissando \override Glissando.after-line-breaking = ##t f2\glissando \break f,1\!\stopTextSpan }
[ << Tweaks and overrides ] | [Inizio][Contenuti] | [ Paper and layout >> ] |
[ < ] | [ Su : Tweaks and overrides ] | [ > ] |
Controllo dell’ordine verticale degli script
L’ordine verticale degli script è determinato dalla proprietà
'script-priority
. Più il numero è piccolo, più sarà posto
vicino alla nota. In questo esempio, il simbolo di diesis (oggetto
TextScript
) ha prima la priorità più bassa, dunque è posto più
in basso nel primo esempio. Nel secondo, il trillo (oggetto Script
) ha
la priorità più bassa, quindi si trova all’interno. Quando due oggetti hanno
la stessa priorità, l’ordine in cui sono inseriti determina quale viene
prima.
\relative c''' { \once \override TextScript.script-priority = #-100 a2^\prall^\markup { \sharp } \once \override Script.script-priority = #-100 a2^\prall^\markup { \sharp } }
[ << Tweaks and overrides ] | [Inizio][Contenuti] | [ Paper and layout >> ] |
[ < ] | [ Su : Tweaks and overrides ] | [ > ] |
Controllare la visibilità della parentesi del gruppo irregolare
Il comportamento predefinito relativo alla visibilità della parentesi quadra del gruppo irregolare è di mostrare una parentesi a meno che non ci sia una travatura della stessa lunghezza del gruppo.
Per controllare la visibilità di tale parentesi, si imposta la proprietà
'bracket-visibility
su #t
(mostra sempre la parentesi),
#'if-no-beam
(mostra la parentesi solo se non c’è una travatura,
che è il comportamento predefinito) o #f
(non mostrare mai la parentesi).
L’ultima opzione equivale a omettere l’oggetto @code{TupletBracket}
dall’output.
music = \relative c'' { \tuplet 3/2 { c16[ d e } f8] \tuplet 3/2 { c8 d e } \tuplet 3/2 { c4 d e } } \new Voice { \relative c' { \override Score.TextMark.non-musical = ##f \textMark "default" \music \override TupletBracket.bracket-visibility = #'if-no-beam \textMark \markup \typewriter "'if-no-beam" \music \override TupletBracket.bracket-visibility = ##t \textMark \markup \typewriter "#t" \music \override TupletBracket.bracket-visibility = ##f \textMark \markup \typewriter "#f" \music \omit TupletBracket \textMark \markup \typewriter "omit" \music } }
[ << Tweaks and overrides ] | [Inizio][Contenuti] | [ Paper and layout >> ] |
[ < ] | [ Su : Tweaks and overrides ] | [ > ] |
Creare un gruppetto ritardato
Creare un gruppetto ritardato, dove la nota più bassa del gruppetto usa
l’alterazione, richiede vari \override. La proprietà
outside-staff-priority
deve essere impostata su #f
, perché
altrimenti questa avrebbe la precedenza sulla proprietà avoid-slur
.
Cambiando la frazione 2/3
si aggiusta la posizione orizzontale.
\relative c'' { \after 2*2/3 \turn c2( d4) r | \after 4 \turn c4.( d8) \after 4 { \once \set suggestAccidentals = ##t \once \override AccidentalSuggestion.outside-staff-priority = ##f \once \override AccidentalSuggestion.avoid-slur = #'inside \once \override AccidentalSuggestion.font-size = -3 \once \override AccidentalSuggestion.script-priority = -1 \once \hideNotes cis8\turn \noBeam } d4.( e8) }
[ << Tweaks and overrides ] | [Inizio][Contenuti] | [ Paper and layout >> ] |
[ < ] | [ Su : Tweaks and overrides ] | [ > ] |
Creating custom key signatures
LilyPond supports custom key signatures. In this example, print for D minor with an extended range of printed flats.
\new Staff \with { \override StaffSymbol.line-count = #8 \override KeySignature.flat-positions = #'((-7 . 6)) \override KeyCancellation.flat-positions = #'((-7 . 6)) % presumably sharps are also printed in both octaves \override KeySignature.sharp-positions = #'((-6 . 7)) \override KeyCancellation.sharp-positions = #'((-6 . 7)) \override Clef.stencil = # (lambda (grob)(grob-interpret-markup grob #{ \markup\combine \musicglyph "clefs.C" \translate #'(-3 . -2) \musicglyph "clefs.F" #})) clefPosition = #3 middleCPosition = #3 middleCClefPosition = #3 } { \key d\minor f bes, f bes, }
[ << Tweaks and overrides ] | [Inizio][Contenuti] | [ Paper and layout >> ] |
[ < ] | [ Su : Tweaks and overrides ] | [ > ] |
Creating double-digit fingerings
Creating fingerings larger than 5 is possible.
\relative c' { c1-10 c1-50 c1-36 c1-29 }
[ << Tweaks and overrides ] | [Inizio][Contenuti] | [ Paper and layout >> ] |
[ < ] | [ Su : Tweaks and overrides ] | [ > ] |
Creating text spanners
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.
\paper { ragged-right = ##f } \relative c'' { \override TextSpanner.bound-details.left.text = #"bla" \override TextSpanner.bound-details.right.text = #"blu" a4 \startTextSpan b4 c a4 \stopTextSpan \override TextSpanner.style = #'line \once \override TextSpanner.bound-details.left.stencil-align-dir-y = #CENTER a4 \startTextSpan b4 c a4 \stopTextSpan \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) } \once \override TextSpanner.bound-details.right.padding = #-2 a4 \startTextSpan b4 c a4 \stopTextSpan \set Staff.middleCPosition = #-13 \override TextSpanner.dash-period = #10 \override TextSpanner.dash-fraction = #0.5 \override TextSpanner.thickness = #10 a4 \startTextSpan b4 c a4 \stopTextSpan }
[ << Tweaks and overrides ] | [Inizio][Contenuti] | [ Paper and layout >> ] |
[ < ] | [ Su : Tweaks and overrides ] | [ > ] |
Cross-staff chords - beaming problems workaround
Sometimes it is better to use stems from the upper staff for creating
cross-staff chords, because no problems with automatic beam collision
avoidance then arise. If the stems from the lower staff were used in
the following example, it would be necessary to change the automatic
beam collision avoidance settings so that it doesn’t detect collisions
between staves using
\override Staff.Beam.collision-voice-only = ##t
\new PianoStaff << \new Staff = up \relative c' { << { r4 \override Stem.cross-staff = ##t \override Stem.length = #19 % this is in half-spaces, % so it makes stems 9.5 staffspaces long \override Stem.Y-offset = #-6 % stems are normally lengthened % upwards, so here we must lower the stem by the amount % equal to the lengthening - in this case (19 - 7) / 2 % (7 is default stem length) e e e } { s4 \change Staff = "bottom" \override NoteColumn.ignore-collision = ##t c, c c } >> } \new Staff = bottom \relative c' { \clef bass \voiceOne g8 a g a g a g a } >>
[ << Tweaks and overrides ] | [Inizio][Contenuti] | [ Paper and layout >> ] |
[ < ] | [ Su : Tweaks and overrides ] | [ > ] |
Cross staff stems
This snippet shows the use of the Span_stem_engraver
and
\crossStaff
to connect stems across staves automatically.
The stem length need not be specified, as the variable distance between noteheads and staves is calculated automatically.
\layout { \context { \PianoStaff \consists "Span_stem_engraver" } } { \new PianoStaff << \new Staff { <b d'>4 r d'16\> e'8. g8 r\! e'8 f' g'4 e'2 } \new Staff { \clef bass \voiceOne \autoBeamOff \crossStaff { <e g>4 e, g16 a8. c8} d \autoBeamOn g8 f g4 c2 } >> }
[ << Tweaks and overrides ] | [Inizio][Contenuti] | [ Paper and layout >> ] |
[ < ] | [ Su : Tweaks and overrides ] | [ > ] |
Custodes
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 }
[ << Tweaks and overrides ] | [Inizio][Contenuti] | [ Paper and layout >> ] |
[ < ] | [ Su : Tweaks and overrides ] | [ > ] |
Personalizzare la tastiera del diagramma dei tasti
Le proprietà del diagramma dei tasti possono essere impostate tramite
'fret-diagram-details
. Per i diagrammi dell’oggetto FretBoard,
gli override vengono applicati all’oggetto FretBoards.FretBoard
.
Come Voice
, FretBoards
è un contesto di basso livello,
dunque può essere omesso negli override delle proprietà.
\include "predefined-guitar-fretboards.ly" \storePredefinedDiagram #default-fret-table \chordmode { c' } #guitar-tuning #"x;1-1-(;3-2;3-3;3-4;1-1-);" % shorthand oo = #(define-music-function (grob-path value) (list? scheme?) #{ \once \override $grob-path = #value #}) << \new ChordNames { \chordmode { c1 | c | c | d } } \new FretBoards { % Set global properties of fret diagram \override FretBoards.FretBoard.size = #'1.2 \override FretBoard.fret-diagram-details.finger-code = #'in-dot \override FretBoard.fret-diagram-details.dot-color = #'white \chordmode { c \oo FretBoard.size #'1.0 \oo FretBoard.fret-diagram-details.barre-type #'straight \oo FretBoard.fret-diagram-details.dot-color #'black \oo FretBoard.fret-diagram-details.finger-code #'below-string c' \oo FretBoard.fret-diagram-details.barre-type #'none \oo FretBoard.fret-diagram-details.number-type #'arabic \oo FretBoard.fret-diagram-details.orientation #'landscape \oo FretBoard.fret-diagram-details.mute-string #"M" \oo FretBoard.fret-diagram-details.label-dir #LEFT \oo FretBoard.fret-diagram-details.dot-color #'black c' \oo FretBoard.fret-diagram-details.finger-code #'below-string \oo FretBoard.fret-diagram-details.dot-radius #0.35 \oo FretBoard.fret-diagram-details.dot-position #0.5 \oo FretBoard.fret-diagram-details.fret-count #3 d } } \new Voice { c'1 | c' | c' | d' } >>
[ << Tweaks and overrides ] | [Inizio][Contenuti] | [ Paper and layout >> ] |
[ < ] | [ Su : Tweaks and overrides ] | [ > ] |
Personalizzare il diagramma dei tasti di tipo markup
Le proprietà del diagramma dei tasti si possono impostare tramite
'fret-diagram-details
. Per diagrammi di tipo markup, gli
override possono essere applicati all’oggetto Voice.TextScript
o
direttamente al markup.
<< \chords { c1 | c | c | d } \new Voice = "mel" { \textLengthOn % Set global properties of fret diagram \override TextScript.size = #'1.2 \override TextScript.fret-diagram-details.finger-code = #'in-dot \override 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;" } } } >>
[ << Tweaks and overrides ] | [Inizio][Contenuti] | [ Paper and layout >> ] |
[ < ] | [ Su : Tweaks and overrides ] | [ > ] |
Mostrare la parentesi anche se c’è un solo rigo nel sistema
Se c’è un solo rigo in uno dei tipi di rigo ChoirStaff
o
StaffGroup
, la parentesi e la stanghetta iniziale non
appaiono. Si può modificare questo comportamento predefinito
sovrascrivendo collapse-height
e impostando un valore
inferiore al numero di linee del rigo.
Nei contesti PianoStaff
e GrandStaff
, dove i sistemi
iniziano con una parentesi graffa invece di una parentesi quadra,
occorre impostare un’altra proprietà, come si vede nel secondo
sistema dell’esempio.
\score { \new StaffGroup << % Must be lower than the actual number of staff lines \override StaffGroup.SystemStartBracket.collapse-height = #4 \override Score.SystemStartBar.collapse-height = #4 \new Staff { c'1 } >> } \score { \new PianoStaff << \override PianoStaff.SystemStartBrace.collapse-height = #4 \override Score.SystemStartBar.collapse-height = #4 \new Staff { c'1 } >> }
[ << Tweaks and overrides ] | [Inizio][Contenuti] | [ Paper and layout >> ] |
[ < ] | [ Su : Tweaks and overrides ] | [ > ] |
Displaying grob ancestry
When working with grob callbacks, it can be helpful to understand a grob’s ancestry. Most grobs have parents which influence the positioning of the grob. X- and Y-parents influence the horizontal and vertical positions for the grob, respectively. Additionally, each parent may have parents of its own.
Unfortunately, there are several aspects of a grob’s ancestry that can lead to confusion:
- The types of parents a grob has may depend on context.
- For some grobs, the X- and Y-parents are the same.
- A particular ancestor may be related to a grob in multiple ways.
- The concept of generations is misleading.
For example, the System
grob can be both parent (on the Y-side)
and grandparent (twice on the X-side) to a VerticalAlignment
grob.
This macro prints (to the console) a textual representation of a grob’s ancestry.
When called this way:
{ \once \override NoteHead.before-line-breaking = #display-ancestry c }
The following output is generated:
NoteHead X,Y: NoteColumn X: PaperColumn X,Y: System Y: VerticalAxisGroup X: NonMusicalPaperColumn X,Y: System Y: VerticalAlignment X: NonMusicalPaperColumn X,Y: System Y: System
%% http://lsr.di.unimi.it/LSR/Item?id=622 %% see also http://www.lilypond.org/doc/v2.18/Documentation/snippets/tweaks-and-overrides#tweaks-and-overrides-displaying-grob-ancestry %% Remark: %% grob::name is in the source since 2.19.x could be deleted during next LSR-upgrade #(define (grob::name grob) (assq-ref (ly:grob-property grob 'meta) 'name)) #(define (get-ancestry grob) (if (not (null? (ly:grob-parent grob X))) (list (grob::name grob) (get-ancestry (ly:grob-parent grob X)) (get-ancestry (ly:grob-parent grob Y))) (grob::name grob))) #(define (format-ancestry lst padding) (string-append (symbol->string (car lst)) "\n" (let ((X-ancestry (if (list? (cadr lst)) (format-ancestry (cadr lst) (+ padding 3)) (symbol->string (cadr lst)))) (Y-ancestry (if (list? (caddr lst)) (format-ancestry (caddr lst) (+ padding 3)) (symbol->string (caddr lst))))) (if (equal? X-ancestry Y-ancestry) (string-append (format #f "~&") (make-string padding #\space) "X,Y: " (if (list? (cadr lst)) (format-ancestry (cadr lst) (+ padding 5)) (symbol->string (cadr lst)))) (string-append (format #f "~&") (make-string padding #\space) "X: " X-ancestry "\n" (make-string padding #\space) "Y: " Y-ancestry (format #f "~&")))) (format #f "~&"))) #(define (display-ancestry grob) (format (current-error-port) "~3&~a~2%~a~&" (make-string 36 #\-) (if (ly:grob? grob) (format-ancestry (get-ancestry grob) 0) (format #f "~a is not a grob" grob)))) \relative c' { \once \override NoteHead.before-line-breaking = #display-ancestry f4 \once \override Accidental.before-line-breaking = #display-ancestry \once \override Arpeggio.before-line-breaking = #display-ancestry <f as c>4\arpeggio }
[ << Tweaks and overrides ] | [Inizio][Contenuti] | [ Paper and layout >> ] |
[ < ] | [ Su : Tweaks and overrides ] | [ > ] |
Dotted harmonics
Artificial harmonics using \harmonic
do not show dots. To
override this behavior, set the context property harmonicDots
.
\relative c''' { \time 3/4 \key f \major \set harmonicDots = ##t <bes f'\harmonic>2. ~ <bes f'\harmonic>4. <a e'\harmonic>8( <gis dis'\harmonic> <g d'\harmonic>) <fis cis'\harmonic>2. <bes f'\harmonic>2. }
[ << Tweaks and overrides ] | [Inizio][Contenuti] | [ Paper and layout >> ] |
[ < ] | [ Su : Tweaks and overrides ] | [ > ] |
Drawing boxes around grobs
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 \revert Flag.stencil c4. c4 \mark \default c1 }
[ << Tweaks and overrides ] | [Inizio][Contenuti] | [ Paper and layout >> ] |
[ < ] | [ Su : Tweaks and overrides ] | [ > ] |
Drawing circles around various objects
The \circle
markup command draws circles around various
objects, for example fingering indications. For other objects,
specific tweaks may be required: this example demonstrates two
strategies for rehearsal marks and measure numbers.
\relative c' { c1 \set Score.rehearsalMarkFormatter = #(lambda (mark context) (make-circle-markup (format-mark-numbers mark context))) \mark \default c2 d^\markup { \override #'(thickness . 3) { \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) }
[ << Tweaks and overrides ] | [Inizio][Contenuti] | [ Paper and layout >> ] |
[ < ] | [ Su : Tweaks and overrides ] | [ > ] |
Estensore testuale della dinamica personalizzato
Funzioni postfix per estensori testuali personalizzati del crescendo. Gli
estensori devono iniziare sulla prima nota della misura; e bisogna usare
-\mycresc
, altrimenti l’inizio dell’estensore viene assegnato alla
nota successiva.
% Two functions for (de)crescendo spanners where you can explicitly % give the spanner text. mycresc = #(define-music-function (mymarkup) (markup?) (make-music 'CrescendoEvent 'span-direction START 'span-type 'text 'span-text mymarkup)) mydecresc = #(define-music-function (mymarkup) (markup?) (make-music 'DecrescendoEvent 'span-direction START 'span-type 'text 'span-text mymarkup)) \relative c' { c4-\mycresc "custom cresc" c4 c4 c4 | c4 c4 c4 c4 | c4-\mydecresc "custom decresc" c4 c4 c4 | c4 c4\! c4 c4 }
[ << Tweaks and overrides ] | [Inizio][Contenuti] | [ Paper and layout >> ] |
[ < ] | [ Su : Tweaks and overrides ] | [ > ] |
Estensore testuale della dinamica personalizzato
Si possono definire estensori testuali personalizzati che fanno uso delle
forcine e dei crescendo testuali. \<
e \>
generano le
forcine, \cresc
etc. generano gli estensori testuali.
% Some sample text dynamic spanners, to be used as postfix operators crpoco = #(make-music 'CrescendoEvent 'span-direction START 'span-type 'text 'span-text "cresc. poco a poco") \relative c' { c4\cresc d4 e4 f4 | g4 a4\! b4\crpoco c4 | c4 d4 e4 f4 | g4 a4\! b4\< c4 | g4\dim a4 b4\decresc c4\! }
[ << Tweaks and overrides ] | [Inizio][Contenuti] | [ Paper and layout >> ] |
[ < ] | [ Su : Tweaks and overrides ] | [ > ] |
Extending a TrillSpanner
For TrillSpanner
, the minimum-length
property becomes
effective only if the set-spacing-rods
procedure is called
explicitly.
To do this, the springs-and-rods
property should be set to
ly:spanner::set-spacing-rods
.
\relative c' { \key c\minor \time 2/4 c16( as') c,-. des-. \once\override TrillSpanner.minimum-length = #15 \once\override TrillSpanner.springs-and-rods = #ly:spanner::set-spacing-rods \afterGrace es4 \startTrillSpan { d16[( \stopTrillSpan es)] } c( c' g es c g' es d \hideNotes c8) }
[ << Tweaks and overrides ] | [Inizio][Contenuti] | [ Paper and layout >> ] |
[ < ] | [ Su : Tweaks and overrides ] | [ > ] |
Estendere i glissandi sulle volte delle ripetizioni
Un glissando che si estende in vari blocchi \alternative
può
essere simulato aggiungendo all’inizio di ogni blocco \alternative
una nota di abbellimento nascosta da cui inizia un glissando. La nota di
abbellimento deve avere la stessa altezza della nota da cui parte il
glissando iniziale. In questo frammento si usa una funzione musicale
che prende come argomento l’altezza della nota di abbellimento.
Attenzione: nella musica polifonica la nota di abbellimento deve avere una nota di abbellimento corrispondente in tutte le altre voci.
repeatGliss = #(define-music-function (grace) (ly:pitch?) #{ % the next two lines ensure the glissando is long enough % to be visible \once \override Glissando.springs-and-rods = #ly:spanner::set-spacing-rods \once \override Glissando.minimum-length = #3.5 \once \hideNotes \grace $grace \glissando #}) \score { \relative c'' { \repeat volta 3 { c4 d e f\glissando } \alternative { { g2 d } { \repeatGliss f g2 e } { \repeatGliss f e2 d } } } } music = \relative c' { \voiceOne \repeat volta 2 { g a b c\glissando } \alternative { { d1 } { \repeatGliss c \once \omit StringNumber e1\2 } } } \score { \new StaffGroup << \new Staff << \new Voice { \clef "G_8" \music } >> \new TabStaff << \new TabVoice { \clef "moderntab" \music } >> >> }
[ << Tweaks and overrides ] | [Inizio][Contenuti] | [ Paper and layout >> ] |
[ < ] | [ Su : Tweaks and overrides ] | [ > ] |
Fine-tuning pedal brackets
The appearance of pedal brackets may be altered in different ways.
\paper { ragged-right = ##f } \relative c'' { c2\sostenutoOn c c2\sostenutoOff c \once \override Staff.PianoPedalBracket.shorten-pair = #'(-7 . -2) c2\sostenutoOn c c2\sostenutoOff c \once \override Staff.PianoPedalBracket.edge-height = #'(0 . 3) c2\sostenutoOn c c2\sostenutoOff c }
[ << Tweaks and overrides ] | [Inizio][Contenuti] | [ Paper and layout >> ] |
[ < ] | [ Su : Tweaks and overrides ] | [ > ] |
Flat Ties
The function takes the default Tie.stencil
as an argument,
calculating the result relying on the extents of this default.
Further tweaking is possible by overriding
Tie.details.height-limit
or with \shape
. It’s also
possible to change the custom-definition on the fly.
%% http://lsr.di.unimi.it/LSR/Item?id=1031 #(define ((flared-tie coords) grob) (define (pair-to-list pair) (list (car pair) (cdr pair))) (define (normalize-coords goods x y dir) (map (lambda (coord) ;(coord-scale coord (cons x (* y dir))) (cons (* x (car coord)) (* y dir (cdr coord)))) goods)) (define (my-c-p-s points thick) (make-connected-path-stencil points thick 1.0 1.0 #f #f)) ;; outer let to trigger suicide (let ((sten (ly:tie::print grob))) (if (grob::is-live? grob) (let* ((layout (ly:grob-layout grob)) (line-thickness (ly:output-def-lookup layout 'line-thickness)) (thickness (ly:grob-property grob 'thickness 0.1)) (used-thick (* line-thickness thickness)) (dir (ly:grob-property grob 'direction)) (xex (ly:stencil-extent sten X)) (yex (ly:stencil-extent sten Y)) (lenx (interval-length xex)) (leny (interval-length yex)) (xtrans (car xex)) (ytrans (if (> dir 0)(car yex) (cdr yex))) (uplist (map pair-to-list (normalize-coords coords lenx (* leny 2) dir)))) (ly:stencil-translate (my-c-p-s uplist used-thick) (cons xtrans ytrans))) '()))) #(define flare-tie (flared-tie '((0 . 0)(0.1 . 0.2) (0.9 . 0.2) (1.0 . 0.0)))) \layout { \context { \Voice \override Tie.stencil = #flare-tie } } \paper { ragged-right = ##f } \relative c' { a4~a \override Tie.height-limit = 4 a'4~a a'4~a <a,, c e a c e a c e>~ q \break a'4~a \once \override Tie.details.height-limit = 14 a4~a \break a4~a \once \override Tie.details.height-limit = 0.5 a4~a \break a4~a \shape #'((0 . 0) (0 . 0.4) (0 . 0.4) (0 . 0)) Tie a4~a \break a4~a \once \override Tie.stencil = #(flared-tie '((0 . 0)(0.1 . 0.4) (0.9 . 0.4) (1.0 . 0.0))) a4~a a4~a \once \override Tie.stencil = #(flared-tie '((0 . 0)(0.06 . 0.1) (0.94 . 0.1) (1.0 . 0.0))) a4~a }
[ << Tweaks and overrides ] | [Inizio][Contenuti] | [ Paper and layout >> ] |
[ < ] | [ Su : Tweaks and overrides ] | [ > ] |
Force a cancellation natural before accidentals
The following example shows how to force a natural sign before an accidental.
\relative c' { \key es \major bes c des \tweak Accidental.restore-first ##t eis }
[ << Tweaks and overrides ] | [Inizio][Contenuti] | [ Paper and layout >> ] |
[ < ] | [ Su : Tweaks and overrides ] | [ > ] |
Forzare lo spostamento orizzonatale delle note
Quando il motore tipografico non riesce a risolvere una situazione, si può usare la sintassi che sovrascrive le decisioni tipografiche. L’unità di misura usata è lo spazio del rigo.
\relative c' << { <d g>2 <d g> } \\ { <b f'>2 \once \override NoteColumn.force-hshift = #1.7 <b f'>2 } >>
[ << Tweaks and overrides ] | [Inizio][Contenuti] | [ Paper and layout >> ] |
[ < ] | [ Su : Tweaks and overrides ] | [ > ] |
Fret diagrams explained and developed
This snippet shows many possibilities for obtaining and tweaking fret diagrams.
<< \chords { a2 a \repeat unfold 3 { c c c d d } } \new Voice = "mel" { \textLengthOn % Set global properties of fret diagram \override TextScript.size = #1.2 \override TextScript.fret-diagram-details.finger-code = #'below-string \override TextScript.fret-diagram-details.dot-color = #'black %% A chord for ukulele 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 ukulele, 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;" } } %% These chords will be in normal orientation %% 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 %% Double barre used to test barre function % 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") (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 4 2 5) (barre 5 1 3)) } } } %% C major for guitar, with capo on third fret % verbose style c'2^\markup { % 110% of default size \override #'(size . 1.1) { \override #'(fret-diagram-details . ( (number-type . roman-upper) (dot-label-font-mag . 0.9) (finger-code . none) (fret-label-vertical-offset . 0.5) (xo-font-magnification . 0.4) (xo-padding . 0.3))) { \fret-diagram-verbose #'((mute 6) (capo 3) (open 5) (place-fret 4 5 1) (place-fret 3 5 2) (place-fret 2 5 3) (open 1)) } } } %% simple D chord d'2^\markup { \override #'(fret-diagram-details . ( (finger-code . below-string) (dot-radius . 0.35) (string-thickness-factor . 0.3) (dot-position . 0.5) (fret-count . 3))) { \fret-diagram-terse "x;x;o;2-1;3-2;2-3;" } } %% simple D chord, large top fret thickness d'2^\markup { \override #'(fret-diagram-details . ( (finger-code . below-string) (dot-radius . 0.35) (dot-position . 0.5) (top-fret-thickness . 7) (fret-count . 3))) { \fret-diagram-terse "x;x;o;2-1;3-2;2-3;" } } % These chords will be in landscape orientation \override TextScript.fret-diagram-details.orientation = #'landscape %% 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 %% Double barre used to test barre function % 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") (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 4 2 5) (barre 5 1 3)) } } } %% C major for guitar, with capo on third fret % verbose style c'2^\markup { % 110% of default size \override #'(size . 1.1) { \override #'(fret-diagram-details . ( (number-type . roman-upper) (dot-label-font-mag . 0.9) (finger-code . none) (fret-label-vertical-offset . 0.5) (xo-font-magnification . 0.4) (xo-padding . 0.3))) { \fret-diagram-verbose #'((mute 6) (capo 3) (open 5) (place-fret 4 5 1) (place-fret 3 5 2) (place-fret 2 5 3) (open 1)) } } } %% simple D chord d'2^\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;" } } %% simple D chord, large top fret thickness d'2^\markup { \override #'(fret-diagram-details . ( (finger-code . below-string) (dot-radius . 0.35) (dot-position . 0.5) (top-fret-thickness . 7) (fret-count . 3))) { \fret-diagram-terse "x;x;o;2-1;3-2;2-3;" } } % These chords will be in opposing-landscape orientation \override TextScript.fret-diagram-details.orientation = #'opposing-landscape %% 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 %% Double barre used to test barre function % 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") (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 4 2 5) (barre 5 1 3)) } } } %% C major for guitar, with capo on third fret % verbose style c'2^\markup { % 110% of default size \override #'(size . 1.1) { \override #'(fret-diagram-details . ( (number-type . roman-upper) (dot-label-font-mag . 0.9) (finger-code . none) (fret-label-vertical-offset . 0.5) (xo-font-magnification . 0.4) (xo-padding . 0.3))) { \fret-diagram-verbose #'((mute 6) (capo 3) (open 5) (place-fret 4 5 1) (place-fret 3 5 2) (place-fret 2 5 3) (open 1)) } } } %% simple D chord d'2^\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;" } } %% simple D chord, large top fret thickness d'2^\markup { \override #'(fret-diagram-details . ( (finger-code . below-string) (dot-radius . 0.35) (dot-position . 0.5) (top-fret-thickness . 7) (fret-count . 3))) { \fret-diagram-terse "x;x;o;2-1;3-2;2-3;" } } } >>
[ << Tweaks and overrides ] | [Inizio][Contenuti] | [ Paper and layout >> ] |
[ < ] | [ Su : Tweaks and overrides ] | [ > ] |
Generating custom flags
The stencil
property of the Flag
grob can be set to a
custom scheme function to generate the glyph for the flag.
#(define-public (weight-flag grob) (let* ((stem-grob (ly:grob-parent grob X)) (log (- (ly:grob-property stem-grob 'duration-log) 2)) (is-up? (eqv? (ly:grob-property stem-grob 'direction) UP)) (yext (if is-up? (cons (* log -0.8) 0) (cons 0 (* log 0.8)))) (flag-stencil (make-filled-box-stencil '(-0.4 . 0.4) yext)) (stroke-style (ly:grob-property grob 'stroke-style)) (stroke-stencil (if (equal? stroke-style "grace") (make-line-stencil 0.2 -0.9 -0.4 0.9 -0.4) empty-stencil))) (ly:stencil-add flag-stencil stroke-stencil))) % Create a flag stencil by looking up the glyph from the font #(define (inverted-flag grob) (let* ((stem-grob (ly:grob-parent grob X)) (dir (if (eqv? (ly:grob-property stem-grob 'direction) UP) "d" "u")) (flag (retrieve-glyph-flag "" dir "" grob)) (line-thickness (ly:staff-symbol-line-thickness grob)) (stem-thickness (ly:grob-property stem-grob 'thickness)) (stem-width (* line-thickness stem-thickness)) (stroke-style (ly:grob-property grob 'stroke-style)) (stencil (if (null? stroke-style) flag (add-stroke-glyph flag stem-grob dir stroke-style ""))) (rotated-flag (ly:stencil-rotate-absolute stencil 180 0 0))) (ly:stencil-translate rotated-flag (cons (- (/ stem-width 2)) 0)))) snippetexamplenotes = { \autoBeamOff c'8 d'16 c'32 d'64 \acciaccatura {c'8} d'64 } { \time 1/4 \textMark "Normal flags" \snippetexamplenotes \textMark "Custom flag: inverted" \override Flag.stencil = #inverted-flag \snippetexamplenotes \textMark "Custom flag: weight" \override Flag.stencil = #weight-flag \snippetexamplenotes \textMark "Revert to normal" \revert Flag.stencil \snippetexamplenotes }
[ << Tweaks and overrides ] | [Inizio][Contenuti] | [ Paper and layout >> ] |
[ < ] | [ Su : Tweaks and overrides ] | [ > ] |
Glissandi can skip grobs
NoteColumn
grobs can be skipped over by glissandi.
\relative c' { a2 \glissando \once \override NoteColumn.glissando-skip = ##t f''4 d, }
[ << Tweaks and overrides ] | [Inizio][Contenuti] | [ Paper and layout >> ] |
[ < ] | [ Su : Tweaks and overrides ] | [ > ] |
Hairpins with different line styles
Hairpins can take any style from line-interface
- dashed-line,
dotted-line, line, trill or zigzag.
\relative c' { c2\< c\! \override Hairpin.style = #'dashed-line c2\< c\! \override Hairpin.style = #'dotted-line c2\< c\! \override Hairpin.style = #'line c2\< c\! \override Hairpin.style = #'trill c2\< c\! \override Hairpin.style = #'zigzag c2\< c\! \revert Hairpin.style c2\< c\! }
[ << Tweaks and overrides ] | [Inizio][Contenuti] | [ Paper and layout >> ] |
[ < ] | [ Su : Tweaks and overrides ] | [ > ] |
Horizontally aligning custom dynamics (e.g. "sempre pp", "piu f", "subito p")
Some dynamic expressions involve additional text, like “sempre pp”. Since dynamics are usually centered under 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: For LilyPond, “sempre” has no extent now. This means it might put other stuff there, causing collisions (which are not detected by LilyPond’s collision detection algorithm!). There also seems to be some spacing, so it is not exactly the same alignment as without the additional text. - Add an explicit shift 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 setDynamicText.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.
\paper { ragged-right = ##f indent = 2.5\cm } % 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 & 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 at 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 '(-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"))) \new StaffGroup << \new Staff = "s" \with { instrumentName = \markup \column { Normal } } << \relative c'' { \key es \major c4\pp c\p c c | c\ff c c\pp c } >> \new Staff = "sMarkup" \with { instrumentName = \markup \column { Normal markup } } << \relative c'' { \key es \major c4-\semppMarkup c\p c c | c\ff c c-\semppMarkup c } >> \new Staff = "sK" \with { instrumentName = \markup \column { Explicit shifting } } << \relative c'' { \key es \major \once \override DynamicText.X-offset = #-9.2 c4\semppK c\p c c c4\ff c \once \override DynamicText.X-offset = #-9.2 c4\semppK c } >> \new Staff = "sT" \with { instrumentName = \markup \column { Right padding } } << \relative c'' { \key es \major c4\semppT c\p c c | c\ff c c\semppT c } >> \new Staff = "sM" \with { instrumentName = \markup \column { Set dimension "to zero" } } << \relative c'' { \key es \major c4\semppM c\p c c | c\ff c c\semppM c } >> \new Staff = "sG" \with { instrumentName = \markup \column { Shift inside dynamics} } << \relative c'' { \key es \major c4\semppG c\p c c | c\ff c c\semppG c } >> \new Staff = "sMII" \with { instrumentName = \markup \column { Alignment inside dynamics } } << \relative c'' { \key es \major % Setting to ##f (false) gives the same result \override DynamicText.X-offset = #0 c4\semppMII c\p c c | c\ff c c\semppMII c } >> >> \layout { \override Staff.InstrumentName.self-alignment-X = #LEFT }
[ << Tweaks and overrides ] | [Inizio][Contenuti] | [ Paper and layout >> ] |
[ < ] | [ Su : Tweaks and overrides ] | [ > ] |
How to change fret diagram position
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 { << \new ChordNames \harmonies \new 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;" } } >> } >> }
[ << Tweaks and overrides ] | [Inizio][Contenuti] | [ Paper and layout >> ] |
[ < ] | [ Su : Tweaks and overrides ] | [ > ] |
Inserire una cesura
I segni di cesura possono essere creati sovrascrivendo la proprietà 'text
dell’oggetto BreathingSign
. È disponibile anche un segno di cesura
curvo.
\relative c'' { \override BreathingSign.text = \markup { \musicglyph "scripts.caesura.straight" } c8 e4. \breathe g8. e16 c4 \override BreathingSign.text = \markup { \musicglyph "scripts.caesura.curved" } g8 e'4. \breathe g8. e16 c4 }
[ << Tweaks and overrides ] | [Inizio][Contenuti] | [ Paper and layout >> ] |
[ < ] | [ Su : Tweaks and overrides ] | [ > ] |
Keep change clefs full sized
When a clef is changed, the clef sign displayed is smaller than the
initial clef. This can be overridden with full-size-change
.
\relative c' { \clef "treble" c1 \clef "bass" c1 \clef "treble" c1 \override Staff.Clef.full-size-change = ##t \clef "bass" c1 \clef "treble" c1 \revert Staff.Clef.full-size-change \clef "bass" c1 \clef "treble" c1 }
[ << Tweaks and overrides ] | [Inizio][Contenuti] | [ Paper and layout >> ] |
[ < ] | [ Su : Tweaks and overrides ] | [ > ] |
Line arrows
Arrows can be applied to text-spanners and line-spanners (such as the Glissando).
\relative c'' { \override TextSpanner.bound-padding = #1.0 \override TextSpanner.style = #'line \override TextSpanner.bound-details.right.arrow = ##t \override TextSpanner.bound-details.left.text = #"fof" \override TextSpanner.bound-details.right.text = #"gag" \override TextSpanner.bound-details.right.padding = #0.6 \override TextSpanner.bound-details.right.stencil-align-dir-y = #CENTER \override TextSpanner.bound-details.left.stencil-align-dir-y = #CENTER \override Glissando.bound-details.right.arrow = ##t \override Glissando.arrow-length = #0.5 \override Glissando.arrow-width = #0.25 a8\startTextSpan gis a4 b\glissando b, g'4 c\stopTextSpan c2 }
[ << Tweaks and overrides ] | [Inizio][Contenuti] | [ Paper and layout >> ] |
[ < ] | [ Su : Tweaks and overrides ] | [ > ] |
Making an object invisible with the ’transparent property
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.
\relative { \time 2/4 << { \once \hide Stem \once \override Stem.length = #8 b'8 ~ 8\noBeam \once \hide Stem \once \override Stem.length = #8 g8 ~ 8\noBeam } \\ { b8 g g e } >> }
[ << Tweaks and overrides ] | [Inizio][Contenuti] | [ Paper and layout >> ] |
[ < ] | [ Su : Tweaks and overrides ] | [ > ] |
Lasciare che i glissandi vadano a capo
Per permettere a un glissando di andare a capo se capita su un’interruzione di
riga, si impostano le proprietà breakable
e after-line-breaking
su #t
:
glissandoSkipOn = { \override NoteColumn.glissando-skip = ##t \hide NoteHead \override NoteHead.no-ledgers = ##t } \relative c'' { \override Glissando.breakable = ##t \override Glissando.after-line-breaking = ##t f1\glissando | \break a4 r2. | f1\glissando \once \glissandoSkipOn \break a2 a4 r4 | }
[ << Tweaks and overrides ] | [Inizio][Contenuti] | [ Paper and layout >> ] |
[ < ] | [ Su : Tweaks and overrides ] | [ > ] |
Manually controlling beam positions
Beam positions may be controlled manually, by overriding the
positions
setting of the Beam
grob.
\relative c' { \time 2/4 % from upper staff-line (position 2) to center (position 0) \override Beam.positions = #'(2 . 0) c8 c % from center to one above center (position 1) \override Beam.positions = #'(0 . 1) c8 c }
[ << Tweaks and overrides ] | [Inizio][Contenuti] | [ Paper and layout >> ] |
[ < ] | [ Su : Tweaks and overrides ] | [ > ] |
Measure-centered bar numbers
For film scores, a common convention is to center bar
numbers within their measure. This is achieved through setting
the centerBarNumbers
context property to true. When this
is used, the type of the bar number grobs is CenteredBarNumber
rather than BarNumber
.
This example demonstrates a number of settings: the centered bar numbers are boxed and placed below the staves.
\layout { \context { \Score centerBarNumbers = ##t barNumberVisibility = #all-bar-numbers-visible \override CenteredBarNumber.stencil = #(make-stencil-boxer 0.1 0.25 ly:text-interface::print) \override CenteredBarNumberLineSpanner.direction = #DOWN } } \new StaffGroup << \new Staff \relative c' { d4-. f8( e d4) bes'-> | d,-. f8( e d4) cis'-> | g-. f8( d e4) g-> | a,1-> | } \new Staff \relative c { \clef bass d4 f8 e d2~ | 4 f8 e d2~ | 4 4 2 | a1 | } >>
[ << Tweaks and overrides ] | [Inizio][Contenuti] | [ Paper and layout >> ] |
[ < ] | [ Su : Tweaks and overrides ] | [ > ] |
Formattazione mensurale (stanghette tra i righi)
La formattazione mensurale, in cui le stanghette non appaiono sui righi ma
nello spazio tra i righi, si può ottenere usando StaffGroup
al posto
di ChoirStaff
. La stanghetta sui righi viene nascosta con
\hide
.
\layout { \context { \Staff measureBarType = "-span|" } } music = \fixed c'' { c1 d2 \section e2 f1 \fine } \new StaffGroup << \new Staff \music \new Staff \music >>
[ << Tweaks and overrides ] | [Inizio][Contenuti] | [ Paper and layout >> ] |
[ < ] | [ Su : Tweaks and overrides ] | [ > ] |
Modificare l’inclinazione dell’estensore dell’ottava
È possibile cambiare l’inclinazione dell’estensore dell’ottava.
\relative c'' { \override Staff.OttavaBracket.stencil = #ly:line-spanner::print \override Staff.OttavaBracket.bound-details = #`((left . ((Y . 0) (attach-dir . ,LEFT) (padding . 0) (stencil-align-dir-y . ,CENTER))) (right . ((Y . 5.0) ; Change the number here (padding . 0) (attach-dir . ,RIGHT) (text . ,(make-draw-dashed-line-markup (cons 0 -1.2)))))) \override Staff.OttavaBracket.left-bound-info = #ly:horizontal-line-spanner::calc-left-bound-info-and-text \override Staff.OttavaBracket.right-bound-info = #ly:horizontal-line-spanner::calc-right-bound-info \ottava #1 c1 c'''1 }
[ << Tweaks and overrides ] | [Inizio][Contenuti] | [ Paper and layout >> ] |
[ < ] | [ Su : Tweaks and overrides ] | [ > ] |
Spostare le note puntate in polifonia
Quando una nota puntata della voce più alta viene spostata per evitare una
collisione con una nota di un’altra voce, il comportamento predefinito è
spostare la nota più alta a destra. Tale comportamento può essere
modificato tramite la proprietà prefer-dotted-right
di
NoteCollision
.
\new Staff \relative c' << { f2. f4 \override Staff.NoteCollision.prefer-dotted-right = ##f f2. f4 \override Staff.NoteCollision.prefer-dotted-right = ##t f2. f4 } \\ { e4 e e e e e e e e e e e } >>
[ << Tweaks and overrides ] | [Inizio][Contenuti] | [ Paper and layout >> ] |
[ < ] | [ Su : Tweaks and overrides ] | [ > ] |
Moving slur positions vertically
The vertical position of a slur can be adjusted using the
positions
property of Slur
. The property has 2
parameters, the first referring to the left end of the slur and the
second to the right. The values of the parameters are not used by
LilyPond to make an exact movement of the slur - instead it selects
what placement of the slur looks best, taking into account the
parameter values. Positive values move the slur up, and are
appropriate for notes with stems down. Negative values move downward
slurs further down.
\relative c' { \stemDown e4( a) \override Slur.positions = #'(1 . 1) e4( a) \override Slur.positions = #'(2 . 2) e4( a) \override Slur.positions = #'(3 . 3) e4( a) \override Slur.positions = #'(4 . 4) e4( a) \override Slur.positions = #'(5 . 5) e4( a) \override Slur.positions = #'(0 . 5) e4( a) \override Slur.positions = #'(5 . 0) e4( a) \stemUp \override Slur.positions = #'(-5 . -5) e4( a) \stemDown \revert Slur.positions e4( a) }
[ << Tweaks and overrides ] | [Inizio][Contenuti] | [ Paper and layout >> ] |
[ < ] | [ Su : Tweaks and overrides ] | [ > ] |
Annidare i righi
Si può usare la proprietà systemStartDelimiterHierarchy
per creare
gruppi di righi annidati più complessi. Il comando \set
StaffGroup.systemStartDelimiterHierarchy
prende come argomento una lista
alfabetica dell’insieme di righi prodotti. Prima di ogni rigo si può
assegnare un delimitatore di inizio del sistema. Deve essere racchiuso
tra parentesi e collega tutti i righi compresi tra le parentesi. Gli
elementi nella lista possono essere omessi, ma la prima parentesi quadra
collega sempre tutti i righi. Le possibilità sono SystemStartBar
,
SystemStartBracket
, SystemStartBrace
e
SystemStartSquare
.
\new StaffGroup \relative c'' << \override StaffGroup.SystemStartSquare.collapse-height = #4 \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 } >>
[ << Tweaks and overrides ] | [Inizio][Contenuti] | [ Paper and layout >> ] |
[ < ] | [ Su : Tweaks and overrides ] | [ > ] |
Overriding articulations by type
Sometimes you may want to affect a single articulation-type. Although
it is always possible to use \tweak
, it might become tedious to
do so for every single sign of a whole score. The following shows how
to tweak articulations with a list of custom settings. One use-case
might be to create a style sheet.
With 2.16.2 and above it is possible to put the proposed function,
\customScripts
, into a \layout
-block.
% Code by David Nalesnik and Thomas Morley #(define (custom-script-tweaks ls) (lambda (grob) (let* ((type (ly:event-property (ly:grob-property grob 'cause) 'articulation-type)) (tweaks (assoc-ref ls type))) (if tweaks (for-each (lambda (x) (ly:grob-set-property! grob (car x) (cdr x))) tweaks))))) customScripts = #(define-music-function (settings) (list?) #{ \override Script.before-line-breaking = #(custom-script-tweaks settings) #}) revertCustomScripts = \revert Script.before-line-breaking %%%%%%%%%%%%% % Example: %%%%%%%%%%%%% % Predefine a list of desired tweaks. #(define my-settings-1 '( (staccato . ((color . (1 0 0)) (padding . 0.5))) (accent . ((font-size . 0) (color . (1 0 0)))) (tenuto . ((rotation . (45 0 0)) (padding . 2) (font-size . 10))) (staccatissimo . ((padding . 1) (color . (1 0 0)))) (segno . ((font-size . 0) (color . (1 0 0)))) )) #(define my-settings-2 '( (staccato . ((color . (0 1 0)))) (accent . ((font-size . 4) (color . (0 1 0)) (padding . 1.5))) (tenuto . ((font-size . 10))) (staccatissimo . ((padding . 2) (color . (0 1 0)))) (coda . ((color . (0 1 0)) (padding . 1))) )) one = \relative c'' { f1-- \customScripts #my-settings-1 f-. f-! f-> f-- f-!\segno \revertCustomScripts f-> f-. } two = \relative c' { f1-- \customScripts #my-settings-2 f-. f-! f-> f---> f-! f-> f-.\coda } \new Staff << \new Voice { \voiceOne \one } \new Voice { \voiceTwo \two } >>
[ << Tweaks and overrides ] | [Inizio][Contenuti] | [ Paper and layout >> ] |
[ < ] | [ Su : Tweaks and overrides ] | [ > ] |
Overriding articulations of distinct type
Sometimes you may want to affect a single articulation type. Although
it is always possible to use \tweak
, it might become tedious to
do so for every single sign of a whole score. The following shows how
to tweak articulations with a list of custom settings. One use case
might be to create a style sheet.
With 2.16.2 it is possible to put the proposed function,
\customScripts
, into a \layout
block.
% Code by David Nalesnik and Thomas Morley #(define (custom-script-tweaks ls) (lambda (grob) (let* ((type (ly:prob-property (ly:grob-property grob 'cause) 'articulation-type)) (tweaks (assoc-ref ls type))) (if tweaks (for-each (lambda (x) (ly:grob-set-property! grob (car x) (cdr x))) tweaks))))) customScripts = #(define-music-function (settings)(list?) #{ \override Script.before-line-breaking = #(custom-script-tweaks settings) #}) revertCustomScripts = { \revert Script.before-line-breaking } %%%%%%%%%%%%% % Example: %%%%%%%%%%%%% % Predefine a list of desired tweaks. #(define my-settings-1 '( ("staccato" . ((color . (1 0 0))(padding . 0.5))) ("accent" . ((font-size . 0)(color . (1 0 0)))) ("tenuto" . ((rotation . (45 0 0)) (padding . 2)(font-size . 10))) ("staccatissimo" . ((padding . 1) (color . (1 0 0)))) ("segno" . ((font-size . 0)(color . (1 0 0)))) )) #(define my-settings-2 '( ("staccato" . ((color . (0 1 0)))) ("accent" . ((font-size . 4)(color . (0 1 0))(padding . 1.5))) ("tenuto" . ((font-size . 10))) ("staccatissimo" . ((padding . 2) (color . (0 1 0)))) ("coda" . ((color . (0 1 0)) (padding . 1))) )) one = \relative c'' { f1-- \customScripts #my-settings-1 f-. f-! f-> f-- f-!\segno \revertCustomScripts f-> f-. } two = \relative c' { f1-- \customScripts #my-settings-2 f-. f-! f-> f---> f-! f-> f-.\coda } \new Staff << \new Voice { \voiceOne \one } \new Voice { \voiceTwo \two } >>
[ << Tweaks and overrides ] | [Inizio][Contenuti] | [ Paper and layout >> ] |
[ < ] | [ Su : Tweaks and overrides ] | [ > ] |
Visibilità del conto della ripetizione con segno percentuale
I contatori della ripetizione con segno percentuale possono essere mostrati a
intervalli regolari impostando la proprietà di contesto repeatCountVisibility
.
\relative c'' { \set countPercentRepeats = ##t \set repeatCountVisibility = #(every-nth-repeat-count-visible 5) \repeat percent 10 { c1 } \break \set repeatCountVisibility = #(every-nth-repeat-count-visible 2) \repeat percent 6 { c1 d1 } }
[ << Tweaks and overrides ] | [Inizio][Contenuti] | [ Paper and layout >> ] |
[ < ] | [ Su : Tweaks and overrides ] | [ > ] |
Positioning arpeggios
If you need to extend or shorten an arpeggio, you can modify the upper and lower start positions independently.
\relative c' { <c e g b>1\arpeggio \once \override Arpeggio.positions = #'(-5 . 0) <c e g b>1\arpeggio \once \override Arpeggio.positions = #'(0 . 5) <c e g b>1\arpeggio \once \override Arpeggio.positions = #'(-5 . 5) <c e g b>1\arpeggio }
[ << Tweaks and overrides ] | [Inizio][Contenuti] | [ Paper and layout >> ] |
[ < ] | [ Su : Tweaks and overrides ] | [ > ] |
Posizionamento delle pause multiple
Diversamente dalle pause normali, non esiste un comando predefinito per cambiare la posizione sul rigo di un simbolo di pausa multipla di qualsiasi tipo connettendolo a una nota. Tuttavia, nella musica polifonica le pause multiple nelle voci dispari e pari sono separate verticalmente. Il posizionamento delle pause multiple si controlla nel modo seguente:
\relative c'' { % Multi-measure rests by default are set under the fourth line R1 % They can be moved using an override \override MultiMeasureRest.staff-position = #-2 R1 \override MultiMeasureRest.staff-position = #0 R1 \override MultiMeasureRest.staff-position = #2 R1 \override MultiMeasureRest.staff-position = #3 R1 \override MultiMeasureRest.staff-position = #6 R1 \revert MultiMeasureRest.staff-position \break % In two Voices, odd-numbered voices are under the top line << { R1 } \\ { a1 } >> % Even-numbered voices are under the bottom line << { a1 } \\ { R1 } >> % Multi-measure rests in both voices remain separate << { R1 } \\ { R1 } >> % Separating multi-measure rests in more than two voices % requires an override << { R1 } \\ { R1 } \\ \once \override MultiMeasureRest.staff-position = #0 { R1 } >> % Using compressed bars in multiple voices requires another override % in all voices to avoid multiple instances being printed \compressMMRests << \revert MultiMeasureRest.direction { R1*3 } \\ \revert MultiMeasureRest.direction { R1*3 } >> }
[ << Tweaks and overrides ] | [Inizio][Contenuti] | [ Paper and layout >> ] |
[ < ] | [ Su : Tweaks and overrides ] | [ > ] |
Posizionare il testo a margine dentro le legature di portamento
I testi a margine devono avere la proprietà outside-staff-priority
impostata su false per poter apparire dentro le legature di portamento.
\relative c'' { \override TextScript.avoid-slur = #'inside \override TextScript.outside-staff-priority = ##f c2(^\markup { \halign #-10 \natural } d4.) c8 }
[ << Tweaks and overrides ] | [Inizio][Contenuti] | [ Paper and layout >> ] |
[ < ] | [ Su : Tweaks and overrides ] | [ > ] |
Numeri di battuta racchiusi in rettangoli o cerchi
I numeri di battuta possono apparire anche all’interno di rettangoli o cerchi.
\relative c' { % Prevent bar numbers at the end of a line and permit them elsewhere \override Score.BarNumber.break-visibility = #end-of-line-invisible \set Score.barNumberVisibility = #(every-nth-bar-number-visible 4) % Increase the size of the bar number by 2 \override Score.BarNumber.font-size = #2 % Draw a box round the following bar number(s) \override Score.BarNumber.stencil = #(make-stencil-boxer 0.1 0.25 ly:text-interface::print) \repeat unfold 5 { c1 } % Draw a circle round the following bar number(s) \override Score.BarNumber.stencil = #(make-stencil-circler 0.1 0.25 ly:text-interface::print) \repeat unfold 4 { c1 } \bar "|." }
[ << Tweaks and overrides ] | [Inizio][Contenuti] | [ Paper and layout >> ] |
[ < ] | [ Su : Tweaks and overrides ] | [ > ] |
Posizionare il metronomo e i numeri di chiamata sotto il rigo
Di norma, il metronomo e i numeri di chiamata vengono posizionati sopra il
rigo. Per metterli sotto il rigo basta impostare correttamente la proprietà
direction
di MetronomeMark
o RehearsalMark
.
\layout { indent = 0 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 }
[ << Tweaks and overrides ] | [Inizio][Contenuti] | [ Paper and layout >> ] |
[ < ] | [ Su : Tweaks and overrides ] | [ > ] |
Printing note names with and without an octave marker
The NoteNames
context can be used to print the text value of
notes. The printOctaveNames
property turns on or off the
representation of the octave of the note.
scale = \relative c' { a4 b c d e4 f g a } \new Staff { << \scale \context NoteNames { \set printOctaveNames = ##f \scale } >> R1 << \scale \context NoteNames { \set printOctaveNames = ##t \scale } >> }
[ << Tweaks and overrides ] | [Inizio][Contenuti] | [ Paper and layout >> ] |
[ < ] | [ Su : Tweaks and overrides ] | [ > ] |
Printing tuplet brackets on the note head side
Whichever option you choose for controlling the tuplet bracket
visibility, it will show or hide the tuplet bracket irrespectively
of tuplet bracket placement (stem side or note head side).
However, when placing the tuplet bracket on the note head side some
authors recommend always printing the tuplet bracket. The option
visible-over-note-heads
can be used to achieve this.
music = \relative c'' { \tupletNeutral \tuplet 3/2 { c16[ d e } f8] \tupletUp \tuplet 3/2 { c8 d e } } \new Voice { \relative c' { \time 2/4 \override TupletBracket.visible-over-note-heads = ##t \override Score.TextMark.non-musical = ##f { \textMark \markup "default" \music } \override TupletBracket.bracket-visibility = #'if-no-beam { \textMark \markup \typewriter "'if-no-beam" \music } } }
[ << Tweaks and overrides ] | [Inizio][Contenuti] | [ Paper and layout >> ] |
[ < ] | [ Su : Tweaks and overrides ] | [ > ] |
Proportional strict notespacing
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.
\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 \tuplet 3/2 { c8 \clef bass cis,, c } c4 c1 } >>
[ << Tweaks and overrides ] | [Inizio][Contenuti] | [ Paper and layout >> ] |
[ < ] | [ Su : Tweaks and overrides ] | [ > ] |
Removing brace on first line of piano score
This snippet removes the first brace from a PianoStaff
or a
GrandStaff
.
It may be useful when cutting and pasting the engraved image into existing music.
It uses \alterBroken
.
someMusic = { \once \override Staff.Clef.stencil = ##f \once \override Staff.TimeSignature.stencil = ##f \repeat unfold 3 c1 \break \repeat unfold 5 c1 \break \repeat unfold 5 c1 } \score { \new PianoStaff << \new Staff = "right" \relative c'' \someMusic \new Staff = "left" \relative c' { \clef F \someMusic } >> \layout { indent=75 \context { \PianoStaff \alterBroken transparent #'(#t) SystemStartBrace } } }
[ << Tweaks and overrides ] | [Inizio][Contenuti] | [ Paper and layout >> ] |
[ < ] | [ Su : Tweaks and overrides ] | [ > ] |
Removing connecting bar lines on StaffGroup, PianoStaff, or GrandStaff
By default, bar lines in StaffGroup, PianoStaff, or GrandStaff groups are connected between the staves, i.e. a SpanBar is printed. This behaviour can be overridden on a staff-by-staff basis.
\relative c' { \new StaffGroup << \new Staff { e1 | e \once \override Staff.BarLine.allow-span-bar = ##f e1 | e | e } \new Staff { c1 | c | c \once \override Staff.BarLine.allow-span-bar = ##f c1 | c } \new Staff { a1 | a | a | a | a } >> }
[ << Tweaks and overrides ] | [Inizio][Contenuti] | [ Paper and layout >> ] |
[ < ] | [ Su : Tweaks and overrides ] | [ > ] |
Eliminare la prima linea vuota
Il primo rigo vuoto si può togliere dalla partitura impostando la proprietà
remove-first
di VerticalAxisGroup
. Questa impostazione
agisce a livello globale se posta nel blocco \layout
, a livello
locale se posta nel rigo specifico che deve essere tolto. Nel secondo
caso, si deve specificare il contesto (Staff
si applica solo al
rigo corrente) prima della proprietà.
Il rigo inferiore del secondo gruppo di righi non viene rimosso, perché l’impostazione ha effetto solo sul rigo in cui si trova.
\layout { \context { \Staff \RemoveEmptyStaves % 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 } >>
[ << Tweaks and overrides ] | [Inizio][Contenuti] | [ Paper and layout >> ] |
[ < ] | [ Su : Tweaks and overrides ] | [ > ] |
Stili di pausa
Esistono vari stili di pausa.
\new Staff \relative c { \omit Score.TimeSignature \cadenzaOn \override Staff.Rest.style = #'mensural r\maxima^\markup \typewriter { mensural } r\longa r\breve r1 r2 r4 r8 r16 s32 s64 s128 s128 \bar "" \break \override Staff.Rest.style = #'neomensural r\maxima^\markup \typewriter { neomensural } r\longa r\breve r1 r2 r4 r8 r16 s32 s64 s128 s128 \bar "" \break \override Staff.Rest.style = #'classical r\maxima^\markup \typewriter { classical } r\longa r\breve r1 r2 r4 r8 r16 r32 r64 r128 s128 \bar "" \break \override Staff.Rest.style = #'z r\maxima^\markup \typewriter { z-style } r\longa r\breve r1 r2 r4 r8 r16 r32 r64 r128 s128 \bar "" \break \override Staff.Rest.style = #'default r\maxima^\markup \typewriter { default } r\longa r\breve r1 r2 r4 r8 r16 r32 r64 r128 s128 }
[ << Tweaks and overrides ] | [Inizio][Contenuti] | [ Paper and layout >> ] |
[ < ] | [ Su : Tweaks and overrides ] | [ > ] |
Rhythmic slashes
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-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 (count) (integer?) #{ \override Rest.stencil = #ly:percent-repeat-interface::beat-slash \override Rest.thickness = #0.48 \override Rest.slope = #1.7 \repeat unfold $count { r4 } \revert Rest.stencil #} ) \score { \relative c' { c4 d e f | \rs \rs \rs \rs | \comp #4 | } }
[ << Tweaks and overrides ] | [Inizio][Contenuti] | [ Paper and layout >> ] |
[ < ] | [ Su : Tweaks and overrides ] | [ > ] |
Separating key cancellations from key signature changes
By default, the accidentals used for key cancellations are placed
adjacent to those for key signature changes. This behavior can be
changed by overriding the 'break-align-orders
property of the
BreakAlignment
grob.
The value of 'break-align-orders
is a vector of length 3, with
quoted lists of breakable items as elements. This example only
modifies the second list, moving key-cancellation
before
staff-bar
; by modifying the second list, break alignment
behavior only changes in the middle of a system, not at the beginning
or the end.
\new Staff { \override Score.BreakAlignment.break-align-orders = ##((left-edge ambitus breathing-sign clef staff-bar key-cancellation key-signature time-signature custos) (left-edge ambitus breathing-sign clef key-cancellation staff-bar key-signature time-signature custos) (left-edge ambitus breathing-sign clef key-cancellation key-signature staff-bar time-signature custos)) \key des \major c'1 \bar "||" \key bes \major c'1 }
[ << Tweaks and overrides ] | [Inizio][Contenuti] | [ Paper and layout >> ] |
[ < ] | [ Su : Tweaks and overrides ] | [ > ] |
Impostare il comportamento delle forcelle sulle stanghette
Se la nota che termina una forcella si trova sul primo battito di una
battuta, la forcella si ferma prima della stanghetta che precede la
nota. Si può controllare questo comportamento modificando la
proprietà 'to-barline
.
\relative c'' { e4\< e2. e1\! \override Hairpin.to-barline = ##f e4\< e2. e1\! }
[ << Tweaks and overrides ] | [Inizio][Contenuti] | [ Paper and layout >> ] |
[ < ] | [ Su : Tweaks and overrides ] | [ > ] |
Setting system separators
System separators can be inserted between systems. Any markup can be
used, but \slashSeparator
has been provided as a sensible
default.
\paper { system-separator-markup = \slashSeparator line-width = 120 } notes = \relative c' { c1 | c \break c1 | c \break c1 | c } \book { \score { \new GrandStaff << \new Staff \notes \new Staff \notes >> } }
[ << Tweaks and overrides ] | [Inizio][Contenuti] | [ Paper and layout >> ] |
[ < ] | [ Su : Tweaks and overrides ] | [ > ] |
Showing the same articulation above and below a note or chord
By default, LilyPond does not allow the same articulation (e.g., an
accent, a fermata, a flageolet, etc.) to be displayed above and below a
note. For example, c4_\fermata^\fermata
only shows a fermata
below. The fermata above gets simply ignored.
However, one can stick scripts (just like fingerings) inside a chord,
which means it is possible to have as many articulations as desired.
This approach has the advantage that it ignores the stem and positions
the articulation relative to the note head. This can be seen in the
case of the flageolets in the snippet. To mimic the behaviour of
scripts outside a chord, 'add-stem-support
would be required.
The solution is thus to write the note as a chord and add the
articulations inside of <...>
, using the direction modifiers
^
and _
as appropriate.
\relative c' { <>^"Wrong" c2_\fermata^\fermata % The second fermata is ignored! <e d'>2^\flageolet_\flageolet \stopStaff s1 \startStaff <>^"Works if written inside a chord" <e_\flageolet d'^\flageolet>2 <e_\flageolet d'^\flageolet>2 <e_\flageolet^\flageolet>2 <e_\fermata^\fermata>2 }
[ << Tweaks and overrides ] | [Inizio][Contenuti] | [ Paper and layout >> ] |
[ < ] | [ Su : Tweaks and overrides ] | [ > ] |
String number extender lines
Make an extender line for string number indications, showing that a series of notes is supposed to be played all on the same string.
stringNumberSpanner = #(define-music-function (StringNumber) (string?) #{ \override TextSpanner.style = #'solid \override TextSpanner.font-size = #-5 \override TextSpanner.bound-details.left.stencil-align-dir-y = #CENTER \override TextSpanner.bound-details.left.text = \markup { \circle \number $StringNumber } #}) \relative c { \clef "treble_8" \stringNumberSpanner "5" \textSpannerDown a8\startTextSpan b c d e f\stopTextSpan \stringNumberSpanner "4" g\startTextSpan a bes4 a g2\stopTextSpan }
[ << Tweaks and overrides ] | [Inizio][Contenuti] | [ Paper and layout >> ] |
[ < ] | [ Su : Tweaks and overrides ] | [ > ] |
Suppressing warnings for clashing note columns
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
. Please note that
this does not just suppress warnings but stops LilyPond trying to
resolve collisions at all and so may have unintended results unless
used with care.
ignore = \override NoteColumn.ignore-collision = ##t \relative c' { \new Staff << \new Voice { \ignore \stemDown f2 g } \new Voice { c2 \stemDown c, } >> }
[ << Tweaks and overrides ] | [Inizio][Contenuti] | [ Paper and layout >> ] |
[ < ] | [ Su : Tweaks and overrides ] | [ > ] |
Time signature in parentheses
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 }
[ << Tweaks and overrides ] | [Inizio][Contenuti] | [ Paper and layout >> ] |
[ < ] | [ Su : Tweaks and overrides ] | [ > ] |
Time signature in parentheses - method 3
Another way to put the time signature in parenthesis
\relative c'' { \override Staff.TimeSignature.stencil = #(lambda (grob) (parenthesize-stencil (ly:time-signature::print grob) 0.1 0.4 0.4 0.1 )) \time 2/4 a4 b8 c }
[ << Tweaks and overrides ] | [Inizio][Contenuti] | [ Paper and layout >> ] |
[ < ] | [ Su : Tweaks and overrides ] | [ > ] |
Indicazione di tempo che mostra solo il numeratore (invece della frazione)
Talvolta un’indicazione di tempo non deve mostrare la frazione intera (ad esempio
7/4), ma solo il numeratore (numero 7 in questo caso). Si può ottenere
facilmente con \override Staff.TimeSignature.style = #'single-digit
,
che cambia lo stile in modo permanente. Con \revert
Staff.TimeSignature.style
, questa impostazione può essere annullata. Per
applicare lo stile a cifra singola (single-digit
) a una sola indicazione
di tempo, si usa il comando \override
preceduto da \once
.
\relative c'' { \time 3/4 c4 c c % Change the style permanently \override Staff.TimeSignature.style = #'single-digit \time 2/4 c4 c \time 3/4 c4 c c % Revert to default style: \revert Staff.TimeSignature.style \time 2/4 c4 c % single-digit style only for the next time signature \once \override Staff.TimeSignature.style = #'single-digit \time 5/4 c4 c c c c \time 2/4 c4 c }
[ << Tweaks and overrides ] | [Inizio][Contenuti] | [ Paper and layout >> ] |
[ < ] | [ Su : Tweaks and overrides ] | [ > ] |
Tuplet bracket and change staff
This snippet shows how to set a tuplet starting in a lower staff and finishing in the upper one.
aigues = \relative c' { \time 6/8 s4. \stemDown c16[ bes' e] \stemUp g c e \stemDown g8 } basses = \relative c { \time 3/4 \clef F \tweak positions #'(4.5 . 9.5) \tweak edge-height #'(1 . -1) \tuplet 7/6 { c16[ bes' e] \change Staff = md \stemUp g[ c e g] } s4.s8 } \new PianoStaff \with { \omit TimeSignature } << \new Staff = md \aigues \new Staff = mg \basses >>
[ << Tweaks and overrides ] | [Inizio][Contenuti] | [ Paper and layout >> ] |
[ < ] | [ Su : Tweaks and overrides ] | [ > ] |
Modifiche manuali della proprietà della chiave
Cambiando il glifo della chiave, la sua posizione o l’ottavazione non
cambia la posizione delle note successive nel rigo. Per far sì che
le armature di chiave si trovino sulle linee del rigo corrette, bisogna
specificare anche middleCPosition
, con valori positivi o negativi
che spostano il Do centrale
rispettivamente su o giù in senso
relativo alla linea centrale del rigo.
Per esempio, \clef "treble_8"
equivale a impostare
clefGlyph
, clefPosition
(che regola la posizione
verticale della chiave), middleCPosition
e
clefTransposition
. Viene stampata una chiave quando cambia una
di queste proprietà, eccetto middleCPosition
.
Gli esempi seguenti mostrano le possibilità date dall’impostazione manuale di tali proprietà. Sulla prima linea le modifiche manuali preservano il posizionamento relativo standard di chiavi e note, mentre sulla seconda linea non lo fanno.
{ % The default treble clef \key f \major c'1 % The standard bass clef \set Staff.clefGlyph = #"clefs.F" \set Staff.clefPosition = #2 \set Staff.middleCPosition = #6 \set Staff.middleCClefPosition = #6 \key g \major c'1 % The baritone clef \set Staff.clefGlyph = #"clefs.C" \set Staff.clefPosition = #4 \set Staff.middleCPosition = #4 \set Staff.middleCClefPosition = #4 \key f \major c'1 % The standard choral tenor clef \set Staff.clefGlyph = #"clefs.G" \set Staff.clefPosition = #-2 \set Staff.clefTransposition = #-7 \set Staff.middleCPosition = #1 \set Staff.middleCClefPosition = #1 \key f \major c'1 % A non-standard clef \set Staff.clefPosition = #0 \set Staff.clefTransposition = #0 \set Staff.middleCPosition = #-4 \set Staff.middleCClefPosition = #-4 \key g \major c'1 \break % The following clef changes do not preserve % the normal relationship between notes, key signatures % 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.clefTransposition = #7 c'1 \set Staff.clefTransposition = #0 \set Staff.clefPosition = #0 c'1 % Return to the normal clef: \set Staff.middleCPosition = #0 c'1 }
[ << Tweaks and overrides ] | [Inizio][Contenuti] | [ Paper and layout >> ] |
[ < ] | [ Su : Tweaks and overrides ] | [ > ] |
Modificare l’aspetto degli abbellimenti di un intero brano
L’aspetto di tutte le espressioni contenute nei blocchi \grace
di un
brano può essere modificato con le funzioni add-grace-property
e
remove-grace-property
. L’esempio seguente toglie la definizione
della direzione di Stem
nell’abbellimento, in modo che gli abbellimenti
non siano sempre rivolti in su, e barra le teste di nota.
\relative c'' { \new Staff { $(remove-grace-property 'Voice 'Stem 'direction) $(add-grace-property 'Voice 'NoteHead 'style 'cross) \new Voice { \acciaccatura { f16 } g4 \grace { d16 e } f4 \appoggiatura { f,32 g a } e2 } } }
[ << Tweaks and overrides ] | [Inizio][Contenuti] | [ Paper and layout >> ] |
[ < ] | [ Su : Tweaks and overrides ] | [ > ] |
Using alternative flag styles
Alternative styles of flag on eighth and shorter notes can be displayed
by overriding the stencil
property of Flag
. Valid values
are modern-straight-flag
, old-straight-flag
and
flat-flag
.
testnotes = { \autoBeamOff c8 d16 c32 d64 \acciaccatura { c8 } d64 r4 } \score { \relative c' { \time 2/4 \testnotes \override Flag.stencil = #modern-straight-flag \testnotes \override Flag.stencil = #old-straight-flag \testnotes \override Flag.stencil = #flat-flag \testnotes \revert Flag.stencil \testnotes } \layout { indent = 0 \context { \Score \override NonMusicalPaperColumn.line-break-permission = ##f } } }
[ << Tweaks and overrides ] | [Inizio][Contenuti] | [ Paper and layout >> ] |
[ < ] | [ Su : Tweaks and overrides ] | [ > ] |
Using ly:grob-object to access grobs with \tweak
Some grobs can be accessed “laterally” from within another grob’s callback. These are usually listed as “layout objects” in the “Internal properties” section of a grob-interface. The function ly:grob-object is used to access these grobs.
Demonstrated below are some ways of accessing grobs from within a
NoteHead callback, but the technique is not limited to NoteHeads.
However, the NoteHead callback is particularly important, since it is
the implicit callback used by the \tweak
command.
The example function defined below ("display-grobs") is probably not that useful, but it demonstrates that the grobs are indeed being accessed.
Example console output:
#Grob Accidental () #Grob Stem
#(define (notehead-get-accidental notehead) ;; notehead is grob (ly:grob-object notehead 'accidental-grob)) #(define (notehead-get-arpeggio notehead) ;; notehead is grob (let ((notecolumn (notehead-get-notecolumn notehead))) (ly:grob-object notecolumn 'arpeggio))) #(define (notehead-get-notecolumn notehead) ;; notehead is grob (ly:grob-parent notehead X)) #(define (notehead-get-stem notehead) ;; notehead is grob (let ((notecolumn (notehead-get-notecolumn notehead))) (ly:grob-object notecolumn 'stem))) #(define (display-grobs notehead) ;; notehead is grob (let ((accidental (notehead-get-accidental notehead)) (arpeggio (notehead-get-arpeggio notehead)) (stem (notehead-get-stem notehead))) (format (current-error-port) "~2&~a\n" (make-string 20 #\-)) (for-each (lambda (x) (format (current-error-port) "~a\n" x)) (list accidental arpeggio stem)))) \relative c' { %% display grobs for each note head: %\override NoteHead.before-line-breaking = #display-grobs <c %% or just for one: \tweak before-line-breaking #display-grobs es g>1\arpeggio }
[ << Tweaks and overrides ] | [Inizio][Contenuti] | [ Paper and layout >> ] |
[ < ] | [ Su : Tweaks and overrides ] | [ > ] |
Using PostScript to generate special note head shapes
When a note head with a special shape cannot easily be generated with graphic markup, PostScript code can be used to generate the shape. This example shows how a parallelogram-shaped note head is generated.
parallelogram = #(ly:make-stencil (list 'embedded-ps "gsave currentpoint translate newpath 0 0.25 moveto 1.3125 0.75 lineto 1.3125 -0.25 lineto 0 -0.75 lineto closepath fill grestore" ) (cons 0 1.3125) (cons -.75 .75)) myNoteHeads = \override NoteHead.stencil = \parallelogram normalNoteHeads = \revert NoteHead.stencil \relative c'' { \myNoteHeads g4 d' \normalNoteHeads <f, \tweak stencil \parallelogram b e>4 d }
[ << Tweaks and overrides ] | [Inizio][Contenuti] | [ Paper and layout >> ] |
[ < ] | [ Su : Tweaks and overrides ] | [ > ] |
Using the \tweak command to tweak individual grobs
With 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 }
[ << Tweaks and overrides ] | [Inizio][Contenuti] | [ Paper and layout >> ] |
[ < ] | [ Su : Tweaks and overrides ] | [ > ] |
Dinamiche e segni testuali allineati verticalmente
Tutti gli oggetti DynamicLineSpanner
(forcelle e testi di dinamica)
sono posti a una distanza minima dal rigo determinata da 'staff-padding
.
Se si imposta 'staff-padding
su un valore abbastanza grande,
le dinamiche saranno allineate.
music = \relative c' { a'2\p b\f e4\p f\f\> g, b\p c2^\markup { \huge gorgeous } c^\markup { \huge fantastic } } { \music \break \override DynamicLineSpanner.staff-padding = #3 \textLengthOn \override TextScript.staff-padding = #1 \music }
[ << Tweaks and overrides ] | [Inizio][Contenuti] | [ Paper and layout >> ] |
[ < ] | [ Su : Tweaks and overrides ] | [ > ] |
Allineare verticalmente gli ossia e il testo vocale
Questo frammento mostra come usare le proprietà di contesto
alignBelowContext
e alignAboveContext
per
controllare il posizionamento del testo vocale e degli ossia.
\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" } { \tuplet 6/4 { \override TextScript.padding = #3 c8[^"ossia above" d e d e f] } } >> } >>
[ << Tweaks and overrides ] | [Inizio][Contenuti] | [ Paper and layout >> ] |
[ < ] | [ Su : Tweaks and overrides ] | [ Paper and layout > ] |
Vertically centering paired figured bass extenders
Where figured bass extender lines are being used by setting
useBassFigureExtenders
to true, pairs of congruent figured bass
extender lines are vertically centered if
figuredBassCenterContinuations
is set to true.
<< \relative c' { c8 c b b a a c16 c b b c8 c b b a a c16 c b b c8 c b b a a c c b b } \figures { \set useBassFigureExtenders = ##t <6+ 4 3>4 <6 4 3>8 r <6+ 4 3>4 <6 4 3>8 <4 3+>16 r \set figuredBassCenterContinuations = ##t <6+ 4 3>4 <6 4 3>8 r <6+ 4 3>4 <6 4 3>8 <4 3+>16 r \set figuredBassCenterContinuations = ##f <6+ 4 3>4 <6 4 3>8 r <6+ 4 3>4 <6 4 3>8 <4 3+>8 } >>
[ << Tweaks and overrides ] | [Inizio][Contenuti] | [ Paper and layout >> ] |
[ < ] | [ Su : Tweaks and overrides ] | [ Paper and layout > ] |