[Top][Contents] |
LilyPond — Snippets
This document shows a selected set of LilyPond snippets from the LilyPond Snippet Repository (LSR). It is in the public domain. We would like to address many thanks to Sebastiano Vigna for maintaining LSR web site and database, and the University of Milano for hosting LSR. Please note that this document is not an exact subset of LSR: some
snippets come from the Documentation/snippets/new/ LilyPond sources
directory, and snippets from LSR are converted through Snippets are grouped by tags; tags listed in the table of contents match a section of LilyPond notation manual. Snippets may have several tags, and not all LSR tags may appear in this document. In the HTML version of this document, you can click on the file name or figure for each example to see the corresponding input file. |
Musical notation | ||
---|---|---|
Pitches | ||
Rhythms | ||
Expressive marks | ||
Repeats | ||
Simultaneous notes | ||
Staff notation | ||
Editorial annotations | ||
Text | ||
Specialist notation | ||
Vocal music | ||
Chords | ||
Keyboards | ||
Percussion | ||
Fretted strings | ||
Unfretted strings | ||
Winds | ||
Ancient notation | ||
World music | ||
Other collections | ||
Contexts and engravers | ||
Tweaks and overrides | ||
Paper and layout | ||
Titles | ||
Spacing | ||
MIDI | ||
Templates |
For more information about how this manual fits with the other documentation, or to read this manual in other formats, see Manuals. If you are missing any manuals, the complete documentation can be found at https://lilypond.org/. |
[ << Top ] | [Top][Contents] | [ Rhythms >> ] |
[ < Top ] | [ Up : Top ] | [ Adding ambitus per voice > ] |
Pitches
[ << Pitches ] | [Top][Contents] | [ Rhythms >> ] |
[ < Pitches ] | [ Up : Pitches ] | [ Adding an ottava marking to a single voice > ] |
Adding ambitus per voice
Ambitus can be added per voice. In this case, the ambitus must be moved manually to prevent collisions.
\new Staff << \new Voice \with { \consists "Ambitus_engraver" } \relative c'' { \override Ambitus.X-offset = 2.0 \voiceOne c4 a d e f1 } \new Voice \with { \consists "Ambitus_engraver" } \relative c' { \voiceTwo es4 f g as b1 } >>
[ << Pitches ] | [Top][Contents] | [ Rhythms >> ] |
[ < Adding ambitus per voice ] | [ Up : Pitches ] | [ Aiken head thin variant noteheads > ] |
Adding an ottava marking to a single voice
If you have more than one voice on the staff, setting octavation in one
voice transposes the position of notes in all voices for the duration
of the ottava bracket. If the octavation is only intended to apply to
one voice, the Ottava_spanner_engraver
should be moved to
Voice
context.
\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 } >> }
[ << Pitches ] | [Top][Contents] | [ Rhythms >> ] |
[ < Adding an ottava marking to a single voice ] | [ Up : Pitches ] | [ Altering the length of beamed stems > ] |
Aiken head thin variant noteheads
Aiken head white notes get harder to read at smaller staff sizes, especially with ledger lines. Losing interior white space makes them appear as quarter notes.
\score { { \aikenHeads c''2 a' c' a % Switch to thin-variant noteheads \set shapeNoteStyles = ##(doThin reThin miThin faThin sol laThin tiThin) c'' a' c' a } }
[ << Pitches ] | [Top][Contents] | [ Rhythms >> ] |
[ < Aiken head thin variant noteheads ] | [ Up : Pitches ] | [ Ambitus > ] |
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 }
[ << Pitches ] | [Top][Contents] | [ Rhythms >> ] |
[ < Altering the length of beamed stems ] | [ Up : Pitches ] | [ Ambitus after key signature > ] |
Ambitus
Ambitus indicate pitch ranges for voices.
Accidentals only show up if they are not part of the key
signature. AmbitusNoteHead
grobs also have ledger lines.
\layout { \context { \Voice \consists "Ambitus_engraver" } } << \new Staff { \relative c' { \time 2/4 c4 f' } } \new Staff { \relative c' { \time 2/4 \key d \major cis4 as' } } >>
[ << Pitches ] | [Top][Contents] | [ Rhythms >> ] |
[ < Ambitus ] | [ Up : Pitches ] | [ Ambitus with multiple voices > ] |
Ambitus after key signature
By default, ambitus are positioned at the left of the clef. The
\ambitusAfter
function allows for changing this
placement. Syntax is \ambitusAfter grob-interface
(see
Graphical
Object Interfaces for a list of possible values for
grob-interface
.)
A common use case is printing the ambitus between key signature and time signature.
\new Staff \with { \consists Ambitus_engraver } \relative { \ambitusAfter key-signature \key d \major es'8 g bes cis d2 }
[ << Pitches ] | [Top][Contents] | [ Rhythms >> ] |
[ < Ambitus after key signature ] | [ Up : Pitches ] | [ Applying note head styles depending on the step of the scale > ] |
Ambitus with multiple voices
Adding the Ambitus_engraver
to the Staff
context creates
a single ambitus per staff, even in the case of staves with multiple
voices.
\new Staff \with { \consists "Ambitus_engraver" } << \new Voice \relative c'' { \voiceOne c4 a d e f1 } \new Voice \relative c' { \voiceTwo es4 f g as b1 } >>
[ << Pitches ] | [Top][Contents] | [ Rhythms >> ] |
[ < Ambitus with multiple voices ] | [ Up : Pitches ] | [ Automatically changing the stem direction of the middle note based on the melody > ] |
Applying note head styles depending on the step of the scale
The shapeNoteStyles
property can be used to define various note
head styles for each step of the scale (as set by the key signature or
the tonic
property).
This property requires a set of symbols, which can be purely arbitrary
(geometrical expressions such as triangle
, cross
, and
xcircle
are allowed) or based on old American engraving
tradition (some latin note names are also allowed).
That said, to imitate old American song books, there are several
predefined note head styles available through shortcut commands such as
\aikenHeads
or \sacredHarpHeads
.
This example shows different ways to obtain shape note heads, and demonstrates the ability to transpose a melody without losing the correspondence between harmonic functions and note head styles.
fragment = { \key c \major c2 d e2 f g2 a b2 c } \new Staff { \transpose c d \relative c' { \set shapeNoteStyles = ##(do re mi fa #f la ti) \fragment } \break \relative c' { \set shapeNoteStyles = ##(cross triangle fa #f mensural xcircle diamond) \fragment } }
[ << Pitches ] | [Top][Contents] | [ Rhythms >> ] |
[ < Applying note head styles depending on the step of the scale ] | [ Up : Pitches ] | [ Changing ottava text > ] |
Automatically changing the stem direction of the middle note based on the melody
LilyPond can alter the stem direction of the middle note on a staff so
that it follows the melody, by adding the Melody_engraver
to the
Voice
context.
The context property suspendMelodyDecisions
may be used to turn
off this behavior locally.
\relative c'' { \time 3/4 a8 b g f b g | \set suspendMelodyDecisions = ##t a b g f b g | \unset suspendMelodyDecisions c b d c b c | } \layout { \context { \Voice \consists "Melody_engraver" \autoBeamOff } }
[ << Pitches ] | [Top][Contents] | [ Rhythms >> ] |
[ < Automatically changing the stem direction of the middle note based on the melody ] | [ Up : Pitches ] | [ Changing the ambitus gap > ] |
Changing ottava text
Internally, \ottava
sets the properties ottavation
(for
example, to 8va
or 8vb
) and middleCPosition
. To
override the text of the bracket, set ottavation
after invoking
\ottava
.
Short text is especially useful when a brief ottava is used.
{ c'2 \ottava 1 \set Staff.ottavation = "8" c''2 \ottava 0 c'1 \ottava 1 \set Staff.ottavation = "Text" c''1 }
[ << Pitches ] | [Top][Contents] | [ Rhythms >> ] |
[ < Changing ottava text ] | [ Up : Pitches ] | [ Changing the interval of lines on the stave > ] |
Changing the ambitus gap
It is possible to change the default gap between the ambitus noteheads and the line joining them.
\layout { \context { \Voice \consists "Ambitus_engraver" } } \new Staff { \time 2/4 % Default setting c'4 g'' } \new Staff { \time 2/4 \override AmbitusLine.gap = 0 c'4 g'' } \new Staff { \time 2/4 \override AmbitusLine.gap = 1 c'4 g'' } \new Staff { \time 2/4 \override AmbitusLine.gap = 1.5 c'4 g'' } \paper { tagline = ##f }
[ << Pitches ] | [Top][Contents] | [ Rhythms >> ] |
[ < Changing the ambitus gap ] | [ Up : Pitches ] | [ Clefs can be transposed by arbitrary amounts > ] |
Changing the interval of lines on the stave
staffLineLayoutFunction
is used to change the position of notes.
This snippet shows setting its value to ly:pitch-semitones
in
order to produce a chromatic scale with the distance between each space
and line of the stave equal to one semitone.
scale = \relative c' { a4 ais b c cis4 d dis e f4 fis g gis a1 } \new Staff \with { \remove "Accidental_engraver" staffLineLayoutFunction = #ly:pitch-semitones } { << \scale \context NoteNames { \set printOctaveNames = ##f \scale } >> }
[ << Pitches ] | [Top][Contents] | [ Rhythms >> ] |
[ < Changing the interval of lines on the stave ] | [ Up : Pitches ] | [ Coloring notes depending on their pitch > ] |
Clefs can be transposed by arbitrary amounts
Clefs can be transposed by arbitrary amounts, not just by octaves.
\relative c' { \clef treble c4 c c c \clef "treble_8" c4 c c c \clef "treble_5" c4 c c c \clef "treble^3" c4 c c c }
[ << Pitches ] | [Top][Contents] | [ Rhythms >> ] |
[ < Clefs can be transposed by arbitrary amounts ] | [ Up : Pitches ] | [ Creating a sequence of notes on various pitches > ] |
Coloring notes depending on their pitch
It is possible to color note heads depending on their pitch and/or their names: the function used in this example even makes it possible to distinguish enharmonics.
%Association list of pitches to colors. #(define color-mapping (list (cons (ly:make-pitch 0 0 NATURAL) (x11-color 'red)) (cons (ly:make-pitch 0 0 SHARP) (x11-color 'green)) (cons (ly:make-pitch 0 1 FLAT) (x11-color 'green)) (cons (ly:make-pitch 0 2 NATURAL) (x11-color 'red)) (cons (ly:make-pitch 0 2 SHARP) (x11-color 'green)) (cons (ly:make-pitch 0 3 FLAT) (x11-color 'red)) (cons (ly:make-pitch 0 3 NATURAL) (x11-color 'green)) (cons (ly:make-pitch 0 4 SHARP) (x11-color 'red)) (cons (ly:make-pitch 0 5 NATURAL) (x11-color 'green)) (cons (ly:make-pitch 0 5 FLAT) (x11-color 'red)) (cons (ly:make-pitch 0 6 SHARP) (x11-color 'red)) (cons (ly:make-pitch 0 1 NATURAL) (x11-color 'blue)) (cons (ly:make-pitch 0 3 SHARP) (x11-color 'blue)) (cons (ly:make-pitch 0 4 FLAT) (x11-color 'blue)) (cons (ly:make-pitch 0 5 SHARP) (x11-color 'blue)) (cons (ly:make-pitch 0 6 FLAT) (x11-color 'blue)))) %Compare pitch and alteration (not octave). #(define (pitch-equals? p1 p2) (and (= (ly:pitch-alteration p1) (ly:pitch-alteration p2)) (= (ly:pitch-notename p1) (ly:pitch-notename p2)))) #(define (pitch-to-color pitch) (let ((color (assoc pitch color-mapping pitch-equals?))) (if color (cdr color)))) #(define (color-notehead grob) (pitch-to-color (ly:event-property (event-cause grob) 'pitch))) \score { \new Staff \relative c' { \override NoteHead.color = #color-notehead c8 b d dis ees f g aes } }
[ << Pitches ] | [Top][Contents] | [ Rhythms >> ] |
[ < Coloring notes depending on their pitch ] | [ Up : Pitches ] | [ Creating custom key signatures > ] |
Creating a sequence of notes on various pitches
In music that contains many occurrences of the same sequence of notes at different pitches, the following music function may prove useful. It takes a note, of which only the pitch is used.
This example creates the rhythm used throughout Mars, from Gustav Holst’s The Planets.
rhythm = #(define-music-function (p) (ly:pitch?) "Make the rhythm in Mars (the Planets) at the given pitch" #{ \tuplet 3/2 { $p 8 8 8 } 4 4 8 8 4 #}) \new Staff { \time 5/4 \rhythm c' \rhythm c'' \rhythm g }
[ << Pitches ] | [Top][Contents] | [ Rhythms >> ] |
[ < Creating a sequence of notes on various pitches ] | [ Up : Pitches ] | [ Direction of merged ’fa’ shape note heads > ] |
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, }
[ << Pitches ] | [Top][Contents] | [ Rhythms >> ] |
[ < Creating custom key signatures ] | [ Up : Pitches ] | [ Force a cancellation natural before accidentals > ] |
Direction of merged ’fa’ shape note heads
Using property NoteCollision.fa-merge-direction
, the direction
of “fa” shape note heads (“fa”, “faThin”, etc.) can be controlled
independently of the stem direction if two voices with the same pitch
and different stem directions are merged. If this property is not set,
the “down” glyph variant is used.
{ \clef bass << { \aikenHeads f2 \override Staff.NoteCollision.fa-merge-direction = #UP f2 } \\ { \aikenHeads f2 f2 } >> }
[ << Pitches ] | [Top][Contents] | [ Rhythms >> ] |
[ < Direction of merged ’fa’ shape note heads ] | [ Up : Pitches ] | [ Forcing a clef symbol to be displayed > ] |
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 }
[ << Pitches ] | [Top][Contents] | [ Rhythms >> ] |
[ < Force a cancellation natural before accidentals ] | [ Up : Pitches ] | [ Generating random notes > ] |
Forcing a clef symbol to be displayed
When a clef sign has already been displayed and it has not been changed
to a different clef, then repeating the \clef
command will be
ignored by LilyPond, since it is not a change of clef. It is possible
to force the clef to be redisplayed using the command
\set Staff.forceClef = ##t
.
\relative c' { \clef treble c1 \clef treble c1 \set Staff.forceClef = ##t c1 \clef treble c1 }
[ << Pitches ] | [Top][Contents] | [ Rhythms >> ] |
[ < Forcing a clef symbol to be displayed ] | [ Up : Pitches ] | [ Hiding accidentals on tied notes at the start of a new system > ] |
Generating random notes
This Scheme-based snippet generates random notes. Use as
\randomNotes
n
from
to
dur
to generate n random notes between pitches from and to, with duration dur.
randomNotes = #(define-music-function (n from to dur) (integer? ly:pitch? ly:pitch? ly:duration?) (let ((from-step (ly:pitch-steps from)) (to-step (ly:pitch-steps to))) (make-sequential-music (map (lambda (_) (let* ((step (+ from-step (random (- to-step from-step)))) (pitch (ly:make-pitch 0 step 0))) #{ $pitch $dur #})) (iota n))))) \randomNotes 24 c' g'' 8
[ << Pitches ] | [Top][Contents] | [ Rhythms >> ] |
[ < Generating random notes ] | [ Up : Pitches ] | [ Keep change clefs full sized > ] |
Hiding accidentals on tied notes at the start of a new system
This shows how to hide accidentals on tied notes at the start of a new system.
\relative c'' { \override Accidental.hide-tied-accidental-after-break = ##t cis1~ cis~ \break cis } \paper { tagline = ##f }
[ << Pitches ] | [Top][Contents] | [ Rhythms >> ] |
[ < Hiding accidentals on tied notes at the start of a new system ] | [ Up : Pitches ] | [ Makam example > ] |
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 }
[ << Pitches ] | [Top][Contents] | [ Rhythms >> ] |
[ < Keep change clefs full sized ] | [ Up : Pitches ] | [ Modifying the Ottava spanner slope > ] |
Makam example
Makam is a type of melody from Turkey using 1/9th-tone microtonal alterations.
Consult the initialization file ‘ly/makam.ly’ for details of pitch names and alterations.
% Initialize makam settings \include "makam.ly" \relative c' { \set Staff.keyAlterations = #`((6 . ,(- KOMA)) (3 . ,BAKIYE)) c4 cc db fk gbm4 gfc gfb efk fk4 db cc c }
[ << Pitches ] | [Top][Contents] | [ Rhythms >> ] |
[ < Makam example ] | [ Up : Pitches ] | [ Non-traditional key signatures > ] |
Modifying the Ottava spanner slope
It is possible to change the slope of the Ottava spanner.
\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 }
[ << Pitches ] | [Top][Contents] | [ Rhythms >> ] |
[ < Modifying the Ottava spanner slope ] | [ Up : Pitches ] | [ Numbers as easy note heads > ] |
Non-traditional key signatures
The commonly used \key
command sets the keyAlterations
property, in the Staff
context.
To create non-standard key signatures, set this property directly. The format of this command is a list:
\set Staff.keyAlterations = #`(((octave . step) . alter) ((octave . step) . alter) ...)
where, for each element in the list, octave
specifies the octave
(0 being the octave from middle C to the B above), step
specifies the note within the octave (0 means C and 6 means B), and
alter
is ,SHARP ,FLAT ,DOUBLE-SHARP
etc.
Alternatively, using the more concise format for each item in the list
(step . alter)
specifies the same alteration holds in all
octaves.
For microtonal scales where a “sharp” is not 100 cents, alter
refers to the alteration as a proportion of a 200-cent whole tone.
\include "arabic.ly" \relative do' { \set Staff.keyAlterations = #`((0 . ,SEMI-FLAT) (1 . ,SEMI-FLAT) (2 . ,FLAT) (5 . ,FLAT) (6 . ,SEMI-FLAT)) %\set Staff.extraNatural = ##f re reb \dwn reb resd dod dob dosd \dwn dob | dobsb dodsd do do | }
[ << Pitches ] | [Top][Contents] | [ Rhythms >> ] |
[ < Non-traditional key signatures ] | [ Up : Pitches ] | [ Orchestra, choir and piano template > ] |
Numbers as easy note heads
Easy notation note heads use the note-names
property of the
NoteHead
object to determine what appears inside the note
head. By overriding this property, it is possible to print numbers
representing the scale-degree.
A simple engraver can be created to do this for every note head object it sees.
#(define Ez_numbers_engraver (make-engraver (acknowledgers ((note-head-interface engraver grob source-engraver) (let* ((context (ly:translator-context engraver)) (tonic-pitch (ly:context-property context 'tonic)) (tonic-name (ly:pitch-notename tonic-pitch)) (grob-pitch (ly:event-property (event-cause grob) 'pitch)) (grob-name (ly:pitch-notename grob-pitch)) (delta (modulo (- grob-name tonic-name) 7)) (note-names (make-vector 7 (number->string (1+ delta))))) (ly:grob-set-property! grob 'note-names note-names)))))) #(set-global-staff-size 26) \paper { tagline = ##f } \layout { ragged-right = ##t \context { \Voice \consists \Ez_numbers_engraver } } \relative c' { \easyHeadsOn c4 d e f g4 a b c \break \key a \major a,4 b cis d e4 fis gis a \break \key d \dorian d,4 e f g a4 b c d }
[ << Pitches ] | [Top][Contents] | [ Rhythms >> ] |
[ < Numbers as easy note heads ] | [ Up : Pitches ] | [ Preventing extra naturals from being automatically added > ] |
Orchestra, choir and piano template
This template demonstrates the use of nested StaffGroup
and
GrandStaff
contexts to sub-group instruments of the same type
together, and a way to use \transpose
so that variables hold
music for transposing instruments at concert pitch.
#(set-global-staff-size 17) \paper { indent = 3.0\cm % add space for instrumentName short-indent = 1.5\cm % add less space for shortInstrumentName } \header { tagline = ##f } fluteMusic = \relative c' { \key g \major g'1 b } % Pitches as written on a manuscript for Clarinet in A % are transposed to concert pitch. clarinetMusic = \transpose c' a \relative c'' { \key bes \major bes1 d } trumpetMusic = \relative c { \key g \major g''1 b } % Key signature is often omitted for horns hornMusic = \transpose c' f \relative c { d'1 fis } percussionMusic = \relative c { \key g \major g1 b } sopranoMusic = \relative c'' { \key g \major g'1 b } sopranoLyrics = \lyricmode { Lyr -- ics } altoIMusic = \relative c' { \key g \major g'1 b } altoIIMusic = \relative c' { \key g \major g'1 b } altoILyrics = \sopranoLyrics altoIILyrics = \lyricmode { Ah -- ah } tenorMusic = \relative c' { \clef "treble_8" \key g \major g1 b } tenorLyrics = \sopranoLyrics pianoRHMusic = \relative c { \key g \major g''1 b } pianoLHMusic = \relative c { \clef bass \key g \major g1 b } violinIMusic = \relative c' { \key g \major g'1 b } violinIIMusic = \relative c' { \key g \major g'1 b } violaMusic = \relative c { \clef alto \key g \major g'1 b } celloMusic = \relative c { \clef bass \key g \major g1 b } bassMusic = \relative c { \clef "bass_8" \key g \major g,1 b } \score { << \new StaffGroup = "StaffGroup_woodwinds" << \new Staff = "Staff_flute" \with { instrumentName = "Flute" } \fluteMusic \new Staff = "Staff_clarinet" \with { instrumentName = \markup { \concat { "Clarinet in B" \flat } } } % Declare that written Middle C in the music % to follow sounds a concert B flat, for % output using sounded pitches such as MIDI. %\transposition bes % Print music for a B-flat clarinet \transpose bes c' \clarinetMusic >> \new StaffGroup = "StaffGroup_brass" << \new Staff = "Staff_hornI" \with { instrumentName = "Horn in F" } % \transposition f \transpose f c' \hornMusic \new Staff = "Staff_trumpet" \with { instrumentName = "Trumpet in C" } \trumpetMusic >> \new RhythmicStaff = "RhythmicStaff_percussion" \with { instrumentName = "Percussion" } << \percussionMusic >> \new PianoStaff \with { instrumentName = "Piano" } << \new Staff { \pianoRHMusic } \new Staff { \pianoLHMusic } >> \new ChoirStaff = "ChoirStaff_choir" << \new Staff = "Staff_soprano" \with { instrumentName = "Soprano" } \new Voice = "soprano" \sopranoMusic \new Lyrics \lyricsto "soprano" { \sopranoLyrics } \new GrandStaff = "GrandStaff_altos" \with { \accepts Lyrics } << \new Staff = "Staff_altoI" \with { instrumentName = "Alto I" } \new Voice = "altoI" \altoIMusic \new Lyrics \lyricsto "altoI" { \altoILyrics } \new Staff = "Staff_altoII" \with { instrumentName = "Alto II" } \new Voice = "altoII" \altoIIMusic \new Lyrics \lyricsto "altoII" { \altoIILyrics } >> \new Staff = "Staff_tenor" \with { instrumentName = "Tenor" } \new Voice = "tenor" \tenorMusic \new Lyrics \lyricsto "tenor" { \tenorLyrics } >> \new StaffGroup = "StaffGroup_strings" << \new GrandStaff = "GrandStaff_violins" << \new Staff = "Staff_violinI" \with { instrumentName = "Violin I" } \violinIMusic \new Staff = "Staff_violinII" \with { instrumentName = "Violin II" } \violinIIMusic >> \new Staff = "Staff_viola" \with { instrumentName = "Viola" } \violaMusic \new Staff = "Staff_cello" \with { instrumentName = "Cello" } \celloMusic \new Staff = "Staff_bass" \with { instrumentName = "Double Bass" } \bassMusic >> >> \layout { } }
[ << Pitches ] | [Top][Contents] | [ Rhythms >> ] |
[ < Orchestra, choir and piano template ] | [ Up : Pitches ] | [ Preventing natural signs from being printed when the key signature changes > ] |
Preventing extra naturals from being automatically added
In accordance with traditional typesetting rules, a natural sign is
printed before a sharp or flat if a previous double sharp or flat on
the same note is canceled. To change this behavior to contemporary
practice, set the extraNatural
property to f
in the
Staff
context.
\relative c'' { aeses4 aes ais a \set Staff.extraNatural = ##f aeses4 aes ais a }
[ << Pitches ] | [Top][Contents] | [ Rhythms >> ] |
[ < Preventing extra naturals from being automatically added ] | [ Up : Pitches ] | [ Quoting another voice with transposition > ] |
Preventing natural signs from being printed when the key signature changes
When the key signature changes, natural signs are automatically printed
to cancel any accidentals from previous key signatures. This may be
prevented by setting to f
the printKeyCancellation
property in the Staff
context.
\relative c' { \key d \major a4 b cis d \key g \minor a4 bes c d \set Staff.printKeyCancellation = ##f \key d \major a4 b cis d \key g \minor a4 bes c d }
Quoting another voice with transposition
Quotations take into account the transposition of both source and
target. In this example, all instruments play sounding middle C; the
target is an instrument in F. The target part may be transposed using
\transpose
. In this case, all the pitches (including the
quoted ones) are transposed.
\addQuote clarinet { \transposition bes \repeat unfold 8 { d'16 d' d'8 } } \addQuote sax { \transposition es' \repeat unfold 16 { a8 } } quoteTest = { % french horn \transposition f g'4 << \quoteDuring "clarinet" { \skip 4 } s4^"clar." >> << \quoteDuring "sax" { \skip 4 } s4^"sax." >> g'4 } { \new Staff \with { instrumentName = \markup { \column { Horn "in F" } } } \quoteTest \transpose c' d' << \quoteTest s4_"up a tone" >> }
[ << Pitches ] | [Top][Contents] | [ Rhythms >> ] |
[ < Quoting another voice with transposition ] | [ Up : Pitches ] | [ Transposing pitches with minimum accidentals ("Smart" transpose) > ] |
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. Each list describes
the default order of prefatory matter at the end, in the middle, and at
the beginning of a line, respectively. We are only interested in
changing the behaviour in the middle of a line.
If you look up the definition of break-align-orders
in
LilyPond’s Internal Reference (see the
BreakAlignment
grob), you get the following order in the second element:
... staff-bar key-cancellation key-signature ...
We want to change that, moving key-cancellation
before
staff-bar
. To make this happen we use the
grob-transformer
function, which gives us access to the original
vector as the second argument of the lambda function, here called
orig (we don’t need the first argument,
grob). We return a new vector, with unchanged first and
last elements. For the middle element, we first remove
key-cancellation
from the list, then adding it again before
staff-bar
.
#(define (insert-before where what lst) (cond ((null? lst) ; If the list is empty, (list what)) ; return a single-element list. ((eq? where (car lst)) ; If we find symbol `where`, (cons what lst)) ; insert `what` before curr. position. (else ; Otherwise keep building the list by (cons (car lst) ; adding the current element and ; recursing with the next element. (insert-before where what (cdr lst)))))) cancellationFirst = \override Score.BreakAlignment.break-align-orders = #(grob-transformer 'break-align-orders (lambda (grob orig) (let* ((middle (vector-ref orig 1)) (middle (delq 'key-cancellation middle)) (middle (insert-before 'staff-bar 'key-cancellation middle))) (vector ;; end of line (vector-ref orig 0) ;; middle of line middle ;; beginning of line (vector-ref orig 2))))) music = { \key es \major d'1 \bar "||" \key a \major d'1 } { <>^\markup "default" \music } { <>^\markup "cancellation first" \cancellationFirst \music } \paper { tagline = ##f }
[ << Pitches ] | [Top][Contents] | [ Rhythms >> ] |
[ < Separating key cancellations from key signature changes ] | [ Up : Pitches ] | [ Turkish Makam example > ] |
Transposing pitches with minimum accidentals ("Smart" transpose)
This example uses some Scheme code to enforce enharmonic modifications for notes in order to have the minimum number of accidentals. In this case, the following rules apply:
Double accidentals should be removed
B sharp -> C
E sharp -> F
C flat -> B
F flat -> E
In this manner, the most natural enharmonic notes are chosen.
#(define (naturalize-pitch p) (let ((o (ly:pitch-octave p)) (a (* 4 (ly:pitch-alteration p))) ;; alteration, a, in quarter tone steps, ;; for historical reasons (n (ly:pitch-notename p))) (cond ((and (> a 1) (or (eqv? n 6) (eqv? n 2))) (set! a (- a 2)) (set! n (+ n 1))) ((and (< a -1) (or (eqv? n 0) (eqv? n 3))) (set! a (+ a 2)) (set! n (- n 1)))) (cond ((> a 2) (set! a (- a 4)) (set! n (+ n 1))) ((< a -2) (set! a (+ a 4)) (set! n (- n 1)))) (if (< n 0) (begin (set! o (- o 1)) (set! n (+ n 7)))) (if (> n 6) (begin (set! o (+ o 1)) (set! n (- n 7)))) (ly:make-pitch o n (/ a 4)))) #(define (naturalize music) (let ((es (ly:music-property music 'elements)) (e (ly:music-property music 'element)) (p (ly:music-property music 'pitch))) (if (pair? es) (ly:music-set-property! music 'elements (map naturalize es))) (if (ly:music? e) (ly:music-set-property! music 'element (naturalize e))) (if (ly:pitch? p) (begin (set! p (naturalize-pitch p)) (ly:music-set-property! music 'pitch p))) music)) naturalizeMusic = #(define-music-function (m) (ly:music?) (naturalize m)) music = \relative c' { c4 d e g } \score { \new Staff { \transpose c ais { \music } \naturalizeMusic \transpose c ais { \music } \transpose c deses { \music } \naturalizeMusic \transpose c deses { \music } } \layout { } }
[ << Pitches ] | [Top][Contents] | [ Rhythms >> ] |
[ < Transposing pitches with minimum accidentals ("Smart" transpose) ] | [ Up : Pitches ] | [ Tweaking clef properties > ] |
Turkish Makam example
This template uses the start of a well-known Turkish Saz Semai that is familiar in the repertoire in order to illustrate some of the elements of Turkish music notation.
\paper { tagline = ##f } % Initialize makam settings \include "turkish-makam.ly" \header { title = "Hüseyni Saz Semaisi" composer = "Lavtacı Andon" } \relative { \set Staff.extraNatural = ##f \set Staff.autoBeaming = ##f \key a \huseyni \time 10/8 a'4 g'16 [fb] e8. [d16] d [c d e] c [d c8] bfc | a16 [bfc a8] bfc c16 [d c8] d16 [e d8] e4 fb8 | d4 a'8 a16 [g fb e] fb8 [g] a8. [b16] a16 [g] | g4 g16 [fb] fb8. [e16] e [g fb e] e4 r8 | }
[ << Pitches ] | [Top][Contents] | [ Rhythms >> ] |
[ < Turkish Makam example ] | [ Up : Pitches ] | [ Using autochange with more than one voice > ] |
Tweaking clef properties
Changing the clef glyph, its position, or the ottavation does not
change the position of subsequent notes on the staff. To get key
signatures on their correct staff lines, middleCClefPosition
must also be specified, with positive or negative values moving
middle C up or down respectively, relative to the staff’s
center line.
For example, \clef "treble_8"
is equivalent to setting the
clefGlyph
, clefPosition
(the vertical position of the
clef itself on the staff), middleCPosition
, and
clefTransposition
. Note that when any of these properties
(except middleCPosition
) are changed a new clef symbol is
printed.
The following examples show the possibilities when setting these properties manually. On the first line, the manual changes preserve the standard relative positioning of clefs and notes, whereas on the second line, they do not.
{ % The default treble clef \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 } \paper { tagline = ##f }
[ << Pitches ] | [Top][Contents] | [ Rhythms >> ] |
[ < Tweaking clef properties ] | [ Up : Pitches ] | [ Rhythms > ] |
Using autochange with more than one voice
Using autochange
with more than one voice.
\score { \new PianoStaff << \new Staff = "up" { << \set Timing.beamExceptions = #'() \set Timing.beatStructure = #'(4) \new Voice { \voiceOne \autoChange \relative c' { g8 a b c d e f g g,8 a b c d e f g } } \new Voice { \voiceTwo \autoChange \relative c' { g8 a b c d e f g g,,8 a b c d e f g } } >> } \new Staff = "down" { \clef bass } >> }
[ << Pitches ] | [Top][Contents] | [ Expressive marks >> ] |
[ < Using autochange with more than one voice ] | [ Up : Top ] | [ Adding beams, slurs, ties etc. when using tuplet and non-tuplet rhythms > ] |
Rhythms
[ << Rhythms ] | [Top][Contents] | [ Expressive marks >> ] |
[ < Rhythms ] | [ Up : Rhythms ] | [ Adding drum parts > ] |
Adding beams, slurs, ties etc. when using tuplet and non-tuplet rhythms
LilyPond syntax can involve many unusual placements for parentheses, brackets etc., which might sometimes have to be interleaved.
For example, when entering a manual beam, the left square bracket has to be placed after the starting note and its duration, not before. Similarly, the right square bracket should directly follow the note which is to be at the end of the requested beaming, even if this note happens to be inside a tuplet section.
This snippet demonstrates how to combine manual beaming, manual slurs, ties and phrasing slurs with tuplet sections (enclosed within curly braces).
{ r16[ g16 \tuplet 3/2 { r16 e'8] } g16( a \tuplet 3/2 { b d e') } g8[( a \tuplet 3/2 { b d') e'] ~ } \time 2/4 \tuplet 5/4 { e'32\( a b d' e' } a'4.\) }
[ << Rhythms ] | [Top][Contents] | [ Expressive marks >> ] |
[ < Adding beams, slurs, ties etc. when using tuplet and non-tuplet rhythms ] | [ Up : Rhythms ] | [ Adjusting grace note spacing > ] |
Adding drum parts
Using the powerful pre-configured tools such as the \drummode
function and the DrumStaff
context, inputting drum parts is
quite easy: drums are placed at their own staff positions (with a
special clef symbol) and have note heads according to the drum.
Attaching an extra symbol to the drum or restricting the number of
lines is possible.
drh = \drummode { cymc4.^"crash" hhc16^"h.h." hh hhc8 hho hhc8 hh16 hh hhc4 r4 r2 } drl = \drummode { bd4 sn8 bd bd4 << bd ss >> bd8 tommh tommh bd toml toml bd tomfh16 tomfh } timb = \drummode { timh4 ssh timl8 ssh r timh r4 ssh8 timl r4 cb8 cb } \score { << \new DrumStaff \with { instrumentName = "timbales" drumStyleTable = #timbales-style \override StaffSymbol.line-count = #2 \override BarLine.bar-extent = #'(-1 . 1) } << \timb >> \new DrumStaff \with { instrumentName = "drums" } << \new DrumVoice { \stemUp \drh } \new DrumVoice { \stemDown \drl } >> >> \layout { } \midi { \tempo 4 = 120 } }
[ << Rhythms ] | [Top][Contents] | [ Expressive marks >> ] |
[ < Adding drum parts ] | [ Up : Rhythms ] | [ Aligning bar numbers > ] |
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 }
[ << Rhythms ] | [Top][Contents] | [ Expressive marks >> ] |
[ < Adjusting grace note spacing ] | [ Up : Rhythms ] | [ Alternative breve notes > ] |
Aligning bar numbers
Bar numbers by default are right-aligned to their parent object. This is usually the left edge of a line or, if numbers are printed within a line, the left hand side of a bar line. The numbers may also be positioned directly over the bar line or left-aligned to the bar line.
\relative c' { \set Score.currentBarNumber = 111 \override Score.BarNumber.break-visibility = #all-visible % Increase the size of the bar number by 2 \override Score.BarNumber.font-size = 2 % Print a bar number every second measure \set Score.barNumberVisibility = #(every-nth-bar-number-visible 2) c1 | c1 % Center-align bar numbers \override Score.BarNumber.self-alignment-X = #CENTER c1 | c1 % Left-align bar numbers \override Score.BarNumber.self-alignment-X = #LEFT c1 | c1 }
[ << Rhythms ] | [Top][Contents] | [ Expressive marks >> ] |
[ < Aligning bar numbers ] | [ Up : Rhythms ] | [ Appoggiatura or grace note before a bar line > ] |
Alternative breve notes
Breve notes are also available with two vertical lines on each side of the notehead instead of one line and in baroque style.
\relative c'' { \time 4/2 c\breve | \override Staff.NoteHead.style = #'altdefault b\breve \override Staff.NoteHead.style = #'baroque b\breve \revert Staff.NoteHead.style a\breve }
[ << Rhythms ] | [Top][Contents] | [ Expressive marks >> ] |
[ < Alternative breve notes ] | [ Up : Rhythms ] | [ Automatic beam subdivisions > ] |
Appoggiatura or grace note before a bar line
By default, appoggiaturas and grace notes that occur on the first beat of a measure are printed after the bar line. They can however be printed before, simply by adding an invisible BarLine and then the visible one, as demonstrated here.
{ R1 %% default \appoggiatura d''8 c''4 r2. %% cheated \appoggiatura { \bar "" d''8 \bar "|" } c''4 r2. }
[ << Rhythms ] | [Top][Contents] | [ Expressive marks >> ] |
[ < Appoggiatura or grace note before a bar line ] | [ Up : Rhythms ] | [ Automatically change durations > ] |
Automatic beam subdivisions
Beams can be subdivided automatically. By setting the property
subdivideBeams
, beams are subdivided whenever possible. The
intervals and depth of subdivision can be limited with properties
minimumBeamSubdivisionInterval
and
maximumBeamSubdivisionInterval
respectively.
\new Staff { \relative c'' { << { \voiceOne \set subdivideBeams = ##t b32[ a g f c' b a g b32^"subdivide beams" a g f c' b a g] } \new Voice { \voiceTwo b32_"default"[ a g f c' b a g b32 a g f c' b a g] } >> \oneVoice \once \set minimumBeamSubdivisionInterval = \musicLength 8 b32^"minimumBeamSubdivisionInterval 1 8"[ a g f c' b a g] \once \set maximumBeamSubdivisionInterval = \musicLength 16 b32^"maximumBeamSubdivisionInterval 1 16"[ a g f c' b a g] } }
[ << Rhythms ] | [Top][Contents] | [ Expressive marks >> ] |
[ < Automatic beam subdivisions ] | [ Up : Rhythms ] | [ Beam endings in Score context > ] |
Automatically change durations
shiftDurations
can be used to change the note lengths of a piece
of music.
It takes two arguments – the scaling factor as a power of two, and the number of dots to be added as a positive integer.
\paper { indent = 0 tagline = ##f } music = \relative c'' { a1 b2 c4 d8 r } { \time 4/2 \music \time 4/4 \shiftDurations 1 0 \music \time 2/4 \shiftDurations 2 0 \music \time 4/1 \shiftDurations -1 0 \music \time 8/1 \shiftDurations -2 0 \music \time 6/2 \shiftDurations 0 1 \music \time 7/2 \shiftDurations 0 2 \music }
[ << Rhythms ] | [Top][Contents] | [ Expressive marks >> ] |
[ < Automatically change durations ] | [ Up : Rhythms ] | [ Beams across line breaks > ] |
Beam endings in Score context
Beam-ending rules specified in the Score
context apply to all
staves, but can be modified at both Staff
and Voice
levels:
\relative c'' { \time 5/4 % Set default beaming for all staves \set Score.baseMoment = \musicLength 8 \set Score.beatStructure = 3,4,3 << \new Staff { c8 c c c c c c c c c } \new Staff { % Modify beaming for just this staff \set Staff.beatStructure = 6,4 c8 c c c c c c c c c } \new Staff { % Inherit beaming from Score context << { \voiceOne c8 c c c c c c c c c } % Modify beaming for this voice only \new Voice { \voiceTwo \set Voice.beatStructure = 6,4 a8 a a a a a a a a a } >> } >> }
[ << Rhythms ] | [Top][Contents] | [ Expressive marks >> ] |
[ < Beam endings in Score context ] | [ Up : Rhythms ] | [ Changing beam knee gap > ] |
Beams across line breaks
Line breaks are normally forbidden when beams cross bar lines; this
behavior can be changed using enabling Beam.breakable
.
\relative c'' { \override Beam.breakable = ##t c8 c[ c] c[ c] c[ c] c[ \break c8] c[ c] c[ c] c[ c] c } \paper { tagline = ##f }
[ << Rhythms ] | [Top][Contents] | [ Expressive marks >> ] |
[ < Beams across line breaks ] | [ Up : Rhythms ] | [ Changing form of multi-measure rests > ] |
Changing beam knee gap
Kneed beams are inserted automatically when a large gap is detected
between the note heads. This behavior can be tuned through the
auto-knee-gap
property. A kneed beam is drawn if the gap is
larger than the value of auto-knee-gap
plus the width of the
beam object (which depends on the duration of the notes and the slope
of the beam). By default auto-knee-gap
is set to 5.5 staff
spaces.
{ f8 f''8 f8 f''8 \override Beam.auto-knee-gap = 6 f8 f''8 f8 f''8 }
[ << Rhythms ] | [Top][Contents] | [ Expressive marks >> ] |
[ < Changing beam knee gap ] | [ Up : Rhythms ] | [ Changing the number of augmentation dots per note > ] |
Changing form of multi-measure rests
If there are ten or fewer measures of rests, a series of longa and
breve rests (called in German “Kirchenpausen” - church rests) is
printed within the staff; otherwise a simple line is shown. This
default number of ten may be changed by overriding the
expand-limit
property.
\relative c'' { \compressMMRests { R1*2 | R1*5 | R1*9 \override MultiMeasureRest.expand-limit = 3 R1*2 | R1*5 | R1*9 } }
[ << Rhythms ] | [Top][Contents] | [ Expressive marks >> ] |
[ < Changing form of multi-measure rests ] | [ Up : Rhythms ] | [ Changing the tempo without a metronome mark > ] |
Changing the number of augmentation dots per note
The number of augmentation dots on a single note can be changed independently of the dots placed after the note.
\relative c' { c4.. a16 r2 | \override Dots.dot-count = 4 c4.. a16 r2 | \override Dots.dot-count = 0 c4.. a16 r2 | \revert Dots.dot-count c4.. a16 r2 | }
[ << Rhythms ] | [Top][Contents] | [ Expressive marks >> ] |
[ < Changing the number of augmentation dots per note ] | [ Up : Rhythms ] | [ Changing the tuplet number > ] |
Changing the tempo without a metronome mark
To change the tempo in MIDI output without printing anything, make the metronome mark invisible.
\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 { } }
[ << Rhythms ] | [Top][Contents] | [ Expressive marks >> ] |
[ < Changing the tempo without a metronome mark ] | [ Up : Rhythms ] | [ Changing time signatures inside a polymetric section using \scaleDurations > ] |
Changing the tuplet number
By default, only the numerator of the tuplet number is printed over the
tuplet bracket, i.e., the numerator of the argument to the
\tuplet
command.
Alternatively, num:den of the tuplet number may be printed, or the tuplet number may be suppressed altogether.
\relative c'' { \tuplet 3/2 { c8 c c } \tuplet 3/2 { c8 c c } \override TupletNumber.text = #tuplet-number::calc-fraction-text \tuplet 3/2 { c8 c c } \omit TupletNumber \tuplet 3/2 { c8 c c } }
[ << Rhythms ] | [Top][Contents] | [ Expressive marks >> ] |
[ < Changing the tuplet number ] | [ Up : Rhythms ] | [ Chant or psalms notation > ] |
Changing time signatures inside a polymetric section using \scaleDurations
The measureLength
property, together with
measurePosition
, determines when a bar line is needed. However,
when using \scaleDurations
, the scaling of durations makes it
difficult to change time signatures. In this case,
measureLength
should be set manually, using the
ly:make-moment
callback. The second argument must be the same
as the second argument of \scaleDurations
.
\layout { \context { \Score \remove "Timing_translator" } \context { \Staff \consists "Timing_translator" } } << \new Staff { \scaleDurations 8/5 { \time 6/8 \set Timing.measureLength = \musicLength 1*6/5 b8 b b b b b \time 2/4 \set Timing.measureLength = \musicLength 1*4/5 b4 b } } \new Staff { \clef bass \time 2/4 c2 d e f } >>
[ << Rhythms ] | [Top][Contents] | [ Expressive marks >> ] |
[ < Changing time signatures inside a polymetric section using \scaleDurations ] | [ Up : Rhythms ] | [ Compound time signatures > ] |
Chant or psalms notation
This form of notation is used for Psalm chant, where verses aren’t always the same length.
stemOff = \hide Staff.Stem stemOn = \undo \stemOff \score { \new Staff \with { \remove "Time_signature_engraver" } { \key g \minor \cadenzaOn \stemOff a'\breve bes'4 g'4 \stemOn a'2 \section \stemOff a'\breve g'4 a'4 \stemOn f'2 \section \stemOff a'\breve^\markup { \italic flexe } \stemOn g'2 \fine } }
[ << Rhythms ] | [Top][Contents] | [ Expressive marks >> ] |
[ < Chant or psalms notation ] | [ Up : Rhythms ] | [ Conducting signs, measure grouping signs > ] |
Compound time signatures
Odd 20th century time signatures (such as “5/8”) can often be played as compound time signatures (e.g. “3/8 + 2/8”), which combine two or more inequal metrics.
LilyPond can make such music quite easy to read and play, by explicitly printing the compound time signatures and adapting the automatic beaming behavior.
\relative c' { \compoundMeter #'((2 8) (3 8)) c8 d e fis gis c8 fis, gis e d c8 d e4 gis8 }
[ << Rhythms ] | [Top][Contents] | [ Expressive marks >> ] |
[ < Compound time signatures ] | [ Up : Rhythms ] | [ Consistently left-aligned bar numbers > ] |
Conducting signs, measure grouping signs
Beat grouping within a measure is controlled by the
beatStructure
context property. Values of beatStructure
are established for many time signatures in file
scm/time-signature-settings.scm
. Values of beatStructure
can be changed or set with \set
. Alternatively, \time
can be used to both set the time signature and establish the beat
structure. For this, you specify the internal grouping of beats in a
measure as a list of numbers (in Scheme syntax) before the time
signature.
\time
applies to the Timing
context, so it will not
reset values of beatStructure
or baseMoment
that are set
in other lower-level contexts, such as Voice
.
If the Measure_grouping_engraver
is included in one of the
display contexts, measure grouping signs will be created. Such signs
ease reading rhythmically complex modern music. In the example, the 9/8
measure is grouped in two different patterns using the two different
methods, while the 5/8 measure is grouped according to the default
setting in scm/time-signature-settings.scm
:
\score { \new Voice \relative c'' { \time 9/8 g8 g d d g g a( bes g) | \set Timing.beatStructure = 2,2,2,3 g8 g d d g g a( bes g) | \time 4,5 9/8 g8 g d d g g a( bes g) | \time 5/8 a4. g4 | } \layout { \context { \Staff \consists "Measure_grouping_engraver" } } }
[ << Rhythms ] | [Top][Contents] | [ Expressive marks >> ] |
[ < Conducting signs, measure grouping signs ] | [ Up : Rhythms ] | [ Controlling tuplet bracket visibility > ] |
Consistently left-aligned bar numbers
When left-aligning bar numbers, overlapping problems may occur with staff brackets.
The snippet solves this by keeping the first bar number right-aligned that follows a line break.
consistentlyLeftAlignedBarNumbers = { \override Score.BarNumber.break-visibility = #end-of-line-invisible \override Score.BarNumber.self-alignment-X = #(lambda (grob) (let ((break-dir (ly:item-break-dir grob))) (if (= break-dir RIGHT) RIGHT LEFT))) } \new ChoirStaff << \new Staff { \relative c' { \set Score.barNumberVisibility = #(every-nth-bar-number-visible 3) \bar "" \consistentlyLeftAlignedBarNumbers \set Score.currentBarNumber = #112 \repeat unfold 8 { R1 } \break \repeat unfold 9 { R1 } \break \repeat unfold 7 { R1 } } } \new Staff { \relative c' { \repeat unfold 24 { R1 } } } >> \layout { indent = #0 ragged-right = ##t ragged-last = ##t } \paper { tagline = ##f }
[ << Rhythms ] | [Top][Contents] | [ Expressive marks >> ] |
[ < Consistently left-aligned bar numbers ] | [ Up : Rhythms ] | [ Cow and ride bell example > ] |
Controlling tuplet bracket visibility
The default behavior of tuplet-bracket visibility is to print a bracket unless there is a beam of the same length as the tuplet.
To control the visibility of tuplet brackets, set the property
bracket-visibility
to either #t
(always print a bracket),
if-no-beam
(only print a bracket if there is no beam) or
#f
(never print a bracket). The latter is in fact equivalent to
omitting the TupletBracket
object altogether from the printed
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 } } \paper { tagline = ##f }
[ << Rhythms ] | [Top][Contents] | [ Expressive marks >> ] |
[ < Controlling tuplet bracket visibility ] | [ Up : Rhythms ] | [ Creating metronome marks in markup mode > ] |
Cow and ride bell example
Two different bells, entered with ’cb’ (cowbell) and ’rb’ (ridebell).
\paper { tagline = ##f } #(define mydrums '((ridebell default #f 3) (cowbell default #f -2))) \new DrumStaff \with { instrumentName = #"Different Bells" } \drummode { \set DrumStaff.drumStyleTable = #(alist->hash-table mydrums) \set DrumStaff.clefPosition = 0.5 \override DrumStaff.StaffSymbol.line-positions = #'(-2 3) \override Staff.BarLine.bar-extent = #'(-1.0 . 1.5) \time 2/4 rb8 8 cb8 16 rb16-> ~ | 16 8 16 cb8 8 | }
[ << Rhythms ] | [Top][Contents] | [ Expressive marks >> ] |
[ < Cow and ride bell example ] | [ Up : Rhythms ] | [ Engraving ties manually > ] |
Creating metronome marks in markup mode
New metronome marks can be created in markup mode, but they will not change the tempo in MIDI output.
\relative c' { \tempo \markup { \concat { ( \smaller \general-align #Y #DOWN \note { 16. } #UP " = " \smaller \general-align #Y #DOWN \note { 8 } #UP ) } } c1 c4 c' c,2 }
[ << Rhythms ] | [Top][Contents] | [ Expressive marks >> ] |
[ < Creating metronome marks in markup mode ] | [ Up : Rhythms ] | [ Engraving tremolos with floating beams > ] |
Engraving ties manually
A single tie may be engraved manually by changing the
staff-position
property (an offset) of the Tie
grob; if
there are multiple ties at the same musical moment, they can be
adjusted manually by changing the tie-configuration
property (a
list of offset/direction pairs) of the TieColumn
object.
The offset indicates the distance from the center of the staff in half staff spaces, the direction can be either 1 (up) or -1 (down).
Note that LilyPond makes a distinction between exact and inexact values
for the offset. If using an exact value (i.e., either an integer or a
fraction like (/ 4 5)
), the value serves as a rough vertical
position that gets further tuned by LilyPond to make the tie avoid
staff lines. If using an inexact value like a floating point number,
it is taken as the precise vertical position without further
adjustments.
\relative c' { <>^"default" g'1 ^~ g <>^"0" \once \override Tie.staff-position = 0 g1 ^~ g <>^"0.0" \once \override Tie.staff-position = 0.0 g1 ^~ g <>^"reset" \revert Tie.staff-position g1 ^~ g } \relative c' { \override TextScript.outside-staff-priority = ##f \override TextScript.padding = 0 <>^"default" <c e g>1~ <c e g> <>^"0, -2, -4" \override TieColumn.tie-configuration = #'((0 . 1) (-2 . 1) (-4 . 1)) <c e g>1~ <c e g> <>^"0.0, -2.0, -4.0" \override TieColumn.tie-configuration = #'((0.0 . 1) (-2.0 . 1) (-4.0 . 1)) <c e g>1~ <c e g> <>^"reset" \override TieColumn.tie-configuration = ##f <c e g>1~ <c e g> } \paper { tagline = ##f }
[ << Rhythms ] | [Top][Contents] | [ Expressive marks >> ] |
[ < Engraving ties manually ] | [ Up : Rhythms ] | [ Entering several tuplets using only one \tuplet command > ] |
Engraving tremolos with floating beams
If a tremolo’s total duration is less than a quarter-note, or exactly a
half-note, or between a half-note and a whole-note, it is normally
typeset with all beams touching the stems. Certain engraving styles
typeset some of these beams as centered floating beams that do not
touch the stems. The number of floating beams in this type of tremolo
is controlled with the 'gap-count
property of the Beam
object, and the size of the gaps between beams and stems is set with
the 'gap
property.
\relative c'' { \repeat tremolo 8 { a32 f } \override Beam.gap-count = #1 \repeat tremolo 8 { a32 f } \override Beam.gap-count = #2 \repeat tremolo 8 { a32 f } \override Beam.gap-count = #3 \repeat tremolo 8 { a32 f } \override Beam.gap-count = #3 \override Beam.gap = #1.33 \repeat tremolo 8 { a32 f } \override Beam.gap = #1 \repeat tremolo 8 { a32 f } \override Beam.gap = #0.67 \repeat tremolo 8 { a32 f } \override Beam.gap = #0.33 \repeat tremolo 8 { a32 f } }
[ << Rhythms ] | [Top][Contents] | [ Expressive marks >> ] |
[ < Engraving tremolos with floating beams ] | [ Up : Rhythms ] | [ Flat flags and beam nibs > ] |
Entering several tuplets using only one \tuplet command
The property tupletSpannerDuration
sets how long each of the
tuplets contained within the brackets after \tuplet
should
last. Many consecutive tuplets can then be placed within a single
\tuplet
expression, thus saving typing.
There are several ways to set tupletSpannerDuration
. The
command \tupletSpan
sets it to a given duration, and clears it
when instead of a duration \default
is specified. Another way
is to use an optional argument with \tuplet
.
\relative c' { \time 2/4 \tupletSpan 4 \tuplet 3/2 { c8^"\\tupletSpan 4" c c c c c } \tupletSpan \default \tuplet 3/2 { c8^"\\tupletSpan \\default" c c c c c } \tuplet 3/2 4 { c8^"\\tuplet 3/2 4 {...}" c c c c c } }
[ << Rhythms ] | [Top][Contents] | [ Expressive marks >> ] |
[ < Entering several tuplets using only one \tuplet command ] | [ Up : Rhythms ] | [ Forcing rehearsal marks to start from a given letter or number > ] |
Flat flags and beam nibs
Flat flags on lone notes and beam nibs at the ends of beamed figures
are both possible with a combination of stemLeftBeamCount
,
stemRightBeamCount
, and paired []
beam indicators.
For right-pointing flat flags on lone notes, use paired []
beam
indicators and set stemLeftBeamCount
to zero (see
Example 1).
For left-pointing flat flags, set stemRightBeamCount
instead
(Example 2).
For right-pointing nibs at the end of a run of beamed notes, set
stemRightBeamCount
to a positive value. And for left-pointing
nibs at the start of a run of beamed notes, set
stemLeftBeamCount
instead (Example 3).
Sometimes it may make sense for a lone note surrounded by rests to
carry both a left- and right-pointing flat flag. Do this with paired
[]
beam indicators alone (Example 4).
(Note that \set stemLeftBeamCount
is always equivalent to
\once \set
. In other words, the beam count settings are not
“sticky”, so the pair of flat flags attached to the lone
c'16[]
in the last example have nothing to do with the
\set
two notes prior.)
\score { << % Example 1 \new RhythmicStaff { \set stemLeftBeamCount = 0 c16[] r8. } % Example 2 \new RhythmicStaff { r8. \set stemRightBeamCount = 0 16[] } % Example 3 \new RhythmicStaff { 16 16 \set stemRightBeamCount = 2 16 r r \set stemLeftBeamCount = 2 16 16 16 } % Example 4 \new RhythmicStaff { 16 16 \set stemRightBeamCount = 2 16 r16 16[] r16 \set stemLeftBeamCount = 2 16 16 } >> }
[ << Rhythms ] | [Top][Contents] | [ Expressive marks >> ] |
[ < Flat flags and beam nibs ] | [ Up : Rhythms ] | [ Generating custom flags > ] |
Forcing rehearsal marks to start from a given letter or number
This snippet demonstrates how to obtain automatic ordered rehearsal marks, but from the letter or number desired.
\relative c'' { c1 \mark \default c1 \mark \default c1 \mark \default c1 \mark #14 c1 \mark \default c1 \mark \default c1 \mark \default c1 }
[ << Rhythms ] | [Top][Contents] | [ Expressive marks >> ] |
[ < Forcing rehearsal marks to start from a given letter or number ] | [ Up : Rhythms ] | [ Guitar strum rhythms > ] |
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 }
[ << Rhythms ] | [Top][Contents] | [ Expressive marks >> ] |
[ < Generating custom flags ] | [ Up : Rhythms ] | [ Heavily customized polymetric time signatures > ] |
Guitar strum rhythms
For guitar music, it is possible to show strum rhythms, along with melody notes, chord names and fret diagrams.
\include "predefined-guitar-fretboards.ly" << \new ChordNames { \chordmode { c1 | f | g | c } } \new FretBoards { \chordmode { c1 | f | g | c } } \new Voice \with { \consists "Pitch_squash_engraver" } { \relative c'' { \improvisationOn c4 c8 c c4 c8 c f4 f8 f f4 f8 f g4 g8 g g4 g8 g c4 c8 c c4 c8 c } } \new Voice = "melody" { \relative c'' { c2 e4 e4 f2. r4 g2. a4 e4 c2. } } \new Lyrics { \lyricsto "melody" { This is my song. I like to sing. } } >>
[ << Rhythms ] | [Top][Contents] | [ Expressive marks >> ] |
[ < Guitar strum rhythms ] | [ Up : Rhythms ] | [ High and Low woodblock example > ] |
Heavily customized polymetric time signatures
Though the polymetric time signature shown was not the most essential item here, it has been included to show the beat of this piece (which is the template of a real Balkan song!).
melody = \relative c'' { \key g \major \compoundMeter #'((3 8) (2 8) (2 8) (3 8) (2 8) (2 8) (2 8) (2 8) (3 8) (2 8) (2 8)) c8 c c d4 c8 c b c b a4 g fis8 e d c b' c d e4-^ fis8 g \break c,4. d4 c4 d4. c4 d c2 d4. e4-^ d4 c4. d4 c4 d4. c4 d c2 d4. e4-^ d4 \break c4. d4 c4 d4. c4 d c2 d4. e4-^ d4 c4. d4 c4 d4. c4 d c2 d4. e4-^ d4 \break } drum = \new DrumStaff \drummode { \repeat volta 2 { bd4.^\markup { Drums } sn4 bd \bar ";" sn4. bd4 sn \bar ";" bd sn bd4. sn4 bd } } \new Staff \with { instrumentName = \markup { \concat { "B" \flat " Sop." } } } { \melody \drum } \paper { tagline = ##f }
[ << Rhythms ] | [Top][Contents] | [ Expressive marks >> ] |
[ < Heavily customized polymetric time signatures ] | [ Up : Rhythms ] | [ Making an object invisible with the ’transparent property > ] |
High and Low woodblock example
Two Woodblocks, entered with ’wbh’ (high woodblock) and ’wbl’ (low woodblock). The length of the barline has been altered with an \override command otherwise it would be too short. The positions of the two stafflines also have to be explicitly defined.
\paper { tagline = ##f } % These lines define the position of the woodblocks in the stave; % if you like, you can change it or you can use special note heads % for the woodblocks. #(define mydrums '((hiwoodblock default #f 3) (lowoodblock default #f -2))) woodstaff = { % This defines a staff with only two lines. % It also defines the positions of the two lines. \override Staff.StaffSymbol.line-positions = #'(-2 3) % This is necessary; if not entered, % the barline would be too short! \override Staff.BarLine.bar-extent = #'(-1.0 . 1.5) % small correction for the clef: \set DrumStaff.clefPosition = 0.5 } \new DrumStaff { % with this you load your new drum style table \set DrumStaff.drumStyleTable = #(alist->hash-table mydrums) \woodstaff \drummode { \time 2/4 wbl8 16 16 8-> 8 | wbl8 16 16-> ~ 16 16 r8 | } }
[ << Rhythms ] | [Top][Contents] | [ Expressive marks >> ] |
[ < High and Low woodblock example ] | [ Up : Rhythms ] | [ Making slurs with complex dash structure > ] |
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 } >> }
[ << Rhythms ] | [Top][Contents] | [ Expressive marks >> ] |
[ < Making an object invisible with the ’transparent property ] | [ Up : Rhythms ] | [ Manually controlling beam positions > ] |
Making slurs with complex dash structure
Slurs can be made with complex dash patterns by defining the
dash-definition
property. dash-definition
is a list of
dash-elements
. A dash-element
is a list of parameters
defining the dash behavior for a segment of the slur.
The slur is defined in terms of the bezier parameter t which ranges
from 0 at the left end of the slur to 1 at the right end of the slur.
dash-element
is a list
(start-t stop-t dash-fraction dash-period)
. The region of the
slur from start-t
to stop-t
will have a fraction
dash-fraction
of each dash-period
black. dash-period
is defined in terms of staff
spaces. dash-fraction
is set to 1 for a solid slur.
\relative c' { \once \override Slur.dash-definition = #'((0 0.3 0.1 0.75) (0.3 0.6 1 1) (0.65 1.0 0.4 0.75)) c4( d e f) \once \override Slur.dash-definition = #'((0 0.25 1 1) (0.3 0.7 0.4 0.75) (0.75 1.0 1 1)) c4( d e f) }
[ << Rhythms ] | [Top][Contents] | [ Expressive marks >> ] |
[ < Making slurs with complex dash structure ] | [ Up : Rhythms ] | [ Merging multi-measure rests in a polyphonic part > ] |
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 }
[ << Rhythms ] | [Top][Contents] | [ Expressive marks >> ] |
[ < Manually controlling beam positions ] | [ Up : Rhythms ] | [ Modifying tuplet bracket length > ] |
Merging multi-measure rests in a polyphonic part
When using multi-measure rests in a polyphonic staff, the rests will be placed differently depending on the voice they belong to. However they can be printed on the same staff line, using the following setting.
normalPos = \revert MultiMeasureRest.direction { << { c''1 R1 c''1 \normalPos R1 } \\ { c'1 R1 c'1 \normalPos R1 } >> }
[ << Rhythms ] | [Top][Contents] | [ Expressive marks >> ] |
[ < Merging multi-measure rests in a polyphonic part ] | [ Up : Rhythms ] | [ Moving dotted notes in polyphony > ] |
Modifying tuplet bracket length
Tuplet brackets can be made to run to prefatory matter or the next note. Default tuplet brackets end at the right edge of the final note of the tuplet; full-length tuplet brackets extend farther to the right, either to cover all the non-rhythmic notation up to the following note, or to cover only the whitespace before the next item of notation, be that a clef, time signature, key signature, or another note. The example shows how to switch tuplets to full length mode and how to modify what material they cover.
\new RhythmicStaff { % Set tuplets to be extendable... \set tupletFullLength = ##t % ...to cover all items up to the next note \set tupletFullLengthNote = ##t \time 2/4 \tuplet 3/2 { c4 4 4 } % ...or to cover just whitespace \set tupletFullLengthNote = ##f \time 4/4 \tuplet 5/4 { 4 1 } \time 3/4 2. }
[ << Rhythms ] | [Top][Contents] | [ Expressive marks >> ] |
[ < Modifying tuplet bracket length ] | [ Up : Rhythms ] | [ Multi-measure rest length control > ] |
Moving dotted notes in polyphony
When a dotted note in the upper voice is moved to avoid a collision
with a note in another voice, the default is to move the upper note to
the right. This behaviour can be over-ridden by using the
prefer-dotted-right
property of 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 } >>
[ << Rhythms ] | [Top][Contents] | [ Expressive marks >> ] |
[ < Moving dotted notes in polyphony ] | [ Up : Rhythms ] | [ Multi-measure rest markup > ] |
Multi-measure rest length control
Multi-measure rests have length according to their total duration which
is under the control of MultiMeasureRest.space-increment
. Note
that the default value is 2.0
.
\relative c' { \compressEmptyMeasures R1*2 R1*4 R1*64 R1*16 \override Staff.MultiMeasureRest.space-increment = 2.5 R1*2 R1*4 R1*64 R1*16 } \paper { tagline = ##f }
[ << Rhythms ] | [Top][Contents] | [ Expressive marks >> ] |
[ < Multi-measure rest length control ] | [ Up : Rhythms ] | [ Non-default tuplet numbers > ] |
Multi-measure rest markup
Markups attached to a multi-measure rest will be centered above or below it. Long markups attached to multi-measure rests do not cause the measure to expand. To expand a multi-measure rest to fit the markup, use an empty chord with an attached markup before the multi-measure rest. Text attached to a spacer rest in this way is left-aligned to the position where the note would be placed in the measure, but if the measure length is determined by the length of the text, the text will appear to be centered.
\relative c' { \compressMMRests { \textLengthOn <>^\markup { [MAJOR GENERAL] } R1*19 <>_\markup { \italic { Cue: ... it is yours } } <>^\markup { A } R1*30^\markup { [MABEL] } \textLengthOff c4^\markup { CHORUS } d f c } }
[ << Rhythms ] | [Top][Contents] | [ Expressive marks >> ] |
[ < Multi-measure rest markup ] | [ Up : Rhythms ] | [ Numbering single measure rests > ] |
Non-default tuplet numbers
LilyPond also provides formatting functions to print tuplet numbers different than the actual fraction, as well as to append a note value to the tuplet number or tuplet fraction.
\relative c'' { \once \override TupletNumber.text = #(tuplet-number::non-default-tuplet-denominator-text 7) \tuplet 3/2 { c4. c4. c4. c4. } \once \override TupletNumber.text = #(tuplet-number::non-default-tuplet-fraction-text 12 7) \tuplet 3/2 { c4. c4. c4. c4. } \once \override TupletNumber.text = #(tuplet-number::append-note-wrapper (tuplet-number::non-default-tuplet-fraction-text 12 7) (ly:make-duration 3 0)) \tuplet 3/2 { c4. c4. c4. c4. } \once \override TupletNumber.text = #(tuplet-number::append-note-wrapper tuplet-number::calc-denominator-text (ly:make-duration 2 0)) \tuplet 3/2 { c8 c8 c8 c8 c8 c8 } \once \override TupletNumber.text = #(tuplet-number::append-note-wrapper tuplet-number::calc-fraction-text (ly:make-duration 2 0)) \tuplet 3/2 { c8 c8 c8 c8 c8 c8 } \once \override TupletNumber.text = #(tuplet-number::fraction-with-notes (ly:make-duration 2 1) (ly:make-duration 3 0)) \tuplet 3/2 { c4. c4. c4. c4. } \once \override TupletNumber.text = #(tuplet-number::non-default-fraction-with-notes 12 (ly:make-duration 3 0) 4 (ly:make-duration 2 0)) \tuplet 3/2 { c4. c4. c4. c4. } }
[ << Rhythms ] | [Top][Contents] | [ Expressive marks >> ] |
[ < Non-default tuplet numbers ] | [ Up : Rhythms ] | [ Partcombine and \autoBeamOff > ] |
Numbering single measure rests
Multi measure rests show their length by a number except for single
measures. This can be changed by setting restNumberThreshold
.
{ \compressEmptyMeasures R1 R1*10 R1*11 \bar "||" \set restNumberThreshold = 0 R1 R1*10 R1*11 \bar "||" \set restNumberThreshold = 10 R1 R1*10 R1*11 }
[ << Rhythms ] | [Top][Contents] | [ Expressive marks >> ] |
[ < Numbering single measure rests ] | [ Up : Rhythms ] | [ Percussion example > ] |
Partcombine and \autoBeamOff
The function of \autoBeamOff
when used with
\partCombine
can be difficult to understand. It may be
preferable to use
\set Staff.autoBeaming = ##f
instead to ensure that auto-beaming is turned off for the entire staff. Use this at a spot in your score where no beam generated by the auto-beamer is still active.
Internally, \partCombine
works with four voices – stem up
single, stem down single, combined, and solo. In order to use
\autoBeamOff
to stop all auto-beaming when used with
\partCombine
, it is necessary to use four calls to
\autoBeamOff
.
{ % \set Staff.autoBeaming = ##f % turns off all auto-beaming \partCombine { \autoBeamOff % applies to split up-stems \repeat unfold 4 a'16 % \autoBeamOff % applies to combined stems \repeat unfold 4 a'8 \repeat unfold 4 a'16 % \autoBeamOff % applies to solo \repeat unfold 4 a'16 r4 } { % \autoBeamOff % applies to split down-stems \repeat unfold 4 f'8 \repeat unfold 8 f'16 | r4 \repeat unfold 4 a'16 } }
[ << Rhythms ] | [Top][Contents] | [ Expressive marks >> ] |
[ < Partcombine and \autoBeamOff ] | [ Up : Rhythms ] | [ Permitting line breaks within beamed tuplets > ] |
Percussion example
A short example taken from Stravinsky’s L’histoire du Soldat.
#(define mydrums '((bassdrum default #f 4) (snare default #f -4) (tambourine default #f 0))) \paper { tagline = ##f } global = { \time 3/8 s4. \time 2/4 s2*2 \time 3/8 s4. \time 2/4 s2 } drumsA = { \context DrumVoice << { \global } { \drummode { \autoBeamOff \stemDown sn8 \stemUp tamb s8 | sn4 \stemDown sn4 | \stemUp tamb8 \stemDown sn8 \stemUp sn16 \stemDown sn \stemUp sn8 | \stemDown sn8 \stemUp tamb s8 | \stemUp sn4 s8 \stemUp tamb } } >> } drumsB = { \drummode { s4 bd8 s2*2 s4 bd8 s4 bd8 s8 } } \layout { indent = 40 \context { \DrumStaff drumStyleTable = #(alist->hash-table mydrums) } } \score { \new StaffGroup << \new DrumStaff \with { instrumentName = \markup \center-column { "Tambourine" "et" "caisse claire s. timbre" } } \drumsA \new DrumStaff \with { instrumentName = "Grosse Caisse" } \drumsB >> }
[ << Rhythms ] | [Top][Contents] | [ Expressive marks >> ] |
[ < Percussion example ] | [ Up : Rhythms ] | [ Positioning grace note beams at the height of normal note beams > ] |
Permitting line breaks within beamed tuplets
This artificial example shows how both manual and automatic line breaks may be permitted to within a beamed tuplet. Note that such off-beat tuplets have to be beamed manually.
\paper { tagline = ##f } \layout { \context { \Voice % Permit line breaks within tuplets \remove "Forbid_line_break_engraver" % Allow beams to be broken at line breaks \override Beam.breakable = ##t } } \relative c'' { a8 \repeat unfold 5 { \tuplet 3/2 { c[ b a] } } % Insert a manual line break within a tuplet \tuplet 3/2 { c[ b \bar "" \break a] } \repeat unfold 5 { \tuplet 3/2 { c[ b a] } } c8 }
[ << Rhythms ] | [Top][Contents] | [ Expressive marks >> ] |
[ < Permitting line breaks within beamed tuplets ] | [ Up : Rhythms ] | [ Positioning grace notes with floating space > ] |
Positioning grace note beams at the height of normal note beams
When notes are placed on ledger lines, their beams are usually centred on the stave. Grace notes beams are shorter and grace notes on ledger lines may well have beams outside the stave. You can override this beaming for grace notes.
\relative c { f8[ e] \grace { f8[ e] \override Stem.no-stem-extend = ##f f8[ e] \revert Stem.no-stem-extend } f8[ e] }
[ << Rhythms ] | [Top][Contents] | [ Expressive marks >> ] |
[ < Positioning grace note beams at the height of normal note beams ] | [ Up : Rhythms ] | [ Positioning multi-measure rests > ] |
Positioning grace notes with floating space
Setting the property 'strict-grace-spacing
makes the musical
columns for grace notes ’floating’, i.e., decoupled from the non-grace
notes: first the normal notes are spaced, then the (musical columns of
the) graces are put left of the musical columns for the main notes.
\relative c'' { << \override Score.SpacingSpanner.strict-grace-spacing = ##t \new Staff \new Voice { \afterGrace c4 { c16[ c8 c16] } c8[ \grace { b16 d } c8] c4 r } \new Staff { c16 c c c c c c c c4 r } >> }
[ << Rhythms ] | [Top][Contents] | [ Expressive marks >> ] |
[ < Positioning grace notes with floating space ] | [ Up : Rhythms ] | [ Positioning opposing fermatas on a bar line > ] |
Positioning multi-measure rests
Unlike ordinary rests, there is no predefined command to change the staff position of a multi-measure rest symbol of either form by attaching it to a note. However, in polyphonic music multi-measure rests in odd-numbered and even-numbered voices are vertically separated.
The positioning of multi-measure rests can be controlled as follows:
\relative c'' { % Multi-measure rests by default are set under the 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 } >> }
[ << Rhythms ] | [Top][Contents] | [ Expressive marks >> ] |
[ < Positioning multi-measure rests ] | [ Up : Rhythms ] | [ Preventing final mark from removing final tuplet > ] |
Positioning opposing fermatas on a bar line
This snippet demonstrates a command that prints fermatas both above and below a bar line. If there would not otherwise be a bar line, it adds a double bar line. Semantically, the command codes a longer-than-normal caesura, which might be considered misuse depending on the situation.
twoWayFermata = { \once \set Staff.caesuraType = #'((underlying-bar-line . "||")) \once \set Staff.caesuraTypeTransform = ##f \caesura ^\fermata _\fermata } music = { f'1 \twoWayFermata R1 f'2 \twoWayFermata f'2 R1 b'1 \twoWayFermata \fine } \new GrandStaff << \new Staff \music \new Staff \music >>
[ << Rhythms ] | [Top][Contents] | [ Expressive marks >> ] |
[ < Positioning opposing fermatas on a bar line ] | [ Up : Rhythms ] | [ Printing bar numbers at regular intervals > ] |
Preventing final mark from removing final tuplet
The addition of a final mark
can result in the loss of a final
tuplet marking. This can be overcome by setting
TupletBracket.full-length-to-extent
to false
.
% due to issue 2362 a long mark such as % \textEndMark "Composed Feb 2007 - Feb 2008" % cannot be used here. \paper { tagline = ##f } \new Staff { \set tupletFullLength = ##t \time 1/8 \tuplet 3/2 8 { c'16 c' c' c' c' c' c' c' c' } \tweak direction #DOWN \textEndMark "1234" } \new Staff { \set tupletFullLength = ##t \override TupletBracket.full-length-to-extent = ##f \time 1/8 \tuplet 3/2 8 { c'16 c' c' c' c' c' c' c' c' } \tweak direction #DOWN \textEndMark "1234" }
[ << Rhythms ] | [Top][Contents] | [ Expressive marks >> ] |
[ < Preventing final mark from removing final tuplet ] | [ Up : Rhythms ] | [ Printing bar numbers for broken measures > ] |
Printing bar numbers at regular intervals
By setting the barNumberVisibility
property, bar numbers can be
printed at regular intervals. Here the bar numbers are printed every
two measures except at the end of the line.
\relative c' { \override Score.BarNumber.break-visibility = #end-of-line-invisible \set Score.currentBarNumber = 11 % Print a bar number every second measure \set Score.barNumberVisibility = #(every-nth-bar-number-visible 2) c1 | c | c | c | c \break c1 | c | c | c | c } \paper { tagline = ##f }
[ << Rhythms ] | [Top][Contents] | [ Expressive marks >> ] |
[ < Printing bar numbers at regular intervals ] | [ Up : Rhythms ] | [ Printing bar numbers inside boxes or circles > ] |
Printing bar numbers for broken measures
By default a BarNumber
of a broken measure is not repeated at
the beginning of the new line. Use
first-bar-number-invisible-save-broken-bars
for
barNumberVisibility
to get a parenthesized BarNumber
there.
\layout { \context { \Score barNumberVisibility = #first-bar-number-invisible-save-broken-bars \override BarNumber.break-visibility = ##(#f #t #t) } } \relative c' { c1 | d | e | f2 \bar "" \break fis | g1 | e2 \bar "" \break <>^"reenabled default" % back to default - % \unset Score.barNumberVisibility would do so as well \set Score.barNumberVisibility = #first-bar-number-invisible-and-no-parenthesized-bar-numbers es | d1 | c } \paper { tagline = ##f }
[ << Rhythms ] | [Top][Contents] | [ Expressive marks >> ] |
[ < Printing bar numbers for broken measures ] | [ Up : Rhythms ] | [ Printing bar numbers using modulo-bar-number-visible > ] |
Printing bar numbers inside boxes or circles
Bar numbers can also be printed inside boxes or circles.
\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 "|." }
[ << Rhythms ] | [Top][Contents] | [ Expressive marks >> ] |
[ < Printing bar numbers inside boxes or circles ] | [ Up : Rhythms ] | [ Printing bar numbers with changing regular intervals > ] |
Printing bar numbers using modulo-bar-number-visible
If the remainder of the division of the current BarNumber
by the
first argument of modulo-bar-number-visible
equals its second
argument print the BarNumber
.
Useful to print the BarNumber
at certain distances, p.e.:
-
(modulo-bar-number-visible 3 2)
-> prints 2,5,8 -
(modulo-bar-number-visible 4 2)
-> prints 2,6,10 -
(modulo-bar-number-visible 3 1)
-> prints 3,5,7 -
(modulo-bar-number-visible 5 2)
-> prints 2,7,12
\layout { \context { \Score \override BarNumber.break-visibility = ##(#f #t #t) barNumberVisibility = #(modulo-bar-number-visible 3 2) } } \relative c' { c1 | d | e | f \break g1 | e | d | c } \paper { tagline = ##f }
[ << Rhythms ] | [Top][Contents] | [ Expressive marks >> ] |
[ < Printing bar numbers using modulo-bar-number-visible ] | [ Up : Rhythms ] | [ Printing metronome and rehearsal marks below the staff > ] |
Printing bar numbers with changing regular intervals
Using the set-bar-number-visibility
context function, bar number
intervals can be changed.
\relative c' { \override Score.BarNumber.break-visibility = #end-of-line-invisible \context Score \applyContext #(set-bar-number-visibility 4) \repeat unfold 10 c'1 \context Score \applyContext #(set-bar-number-visibility 2) \repeat unfold 10 c } \paper { tagline = ##f }
[ << Rhythms ] | [Top][Contents] | [ Expressive marks >> ] |
[ < Printing bar numbers with changing regular intervals ] | [ Up : Rhythms ] | [ Printing music with different time signatures > ] |
Printing metronome and rehearsal marks below the staff
By default, metronome and rehearsal marks are printed above the
staff. To place them below the staff simply set the direction
property of MetronomeMark
or RehearsalMark
appropriately.
\layout { 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 }
[ << Rhythms ] | [Top][Contents] | [ Expressive marks >> ] |
[ < Printing metronome and rehearsal marks below the staff ] | [ Up : Rhythms ] | [ Printing the bar number for the first measure > ] |
Printing music with different time signatures
In the following snippet, two parts have a completely different time signature, yet remain synchronized.
The bar lines can no longer be printed at the Score
level; to
allow independent bar lines in each part, the
Default_barline_engraver
and Timing_translator
are moved
from the Score
context to the Staff
context.
If bar numbers are required, the Bar_number_engraver
should also
be moved, since it relies on properties set by the
Timing_translator
; a \with
block can be used to add bar
numbers to the relevant staff.
\paper { indent = #0 ragged-right = ##t tagline = ##f } global = { \time 3/4 { s2.*3 } \bar "" \break { s2.*3 } } \layout { \context { \Score \remove "Timing_translator" \remove "Bar_number_engraver" \override SpacingSpanner.uniform-stretching = ##t \override SpacingSpanner.strict-note-spacing = ##t proportionalNotationDuration = \musicLength 64 } \context { \Staff \consists "Timing_translator" } \context { \Voice \remove "Forbid_line_break_engraver" tupletFullLength = ##t } } Bassklarinette = \new Staff \with { \consists "Bar_number_engraver" barNumberVisibility = #(every-nth-bar-number-visible 2) \override BarNumber.break-visibility = #end-of-line-invisible } << \global { \bar "|" \clef treble \time 3/8 d''4. \bar "|" \time 3/4 r8 des''2( c''8) \bar "|" \time 7/8 r4. ees''2 ~ \bar "|" \time 2/4 \tupletUp \tuplet 3/2 { ees''4 r4 d''4 ~ } \bar "|" \time 3/8 \tupletUp \tuplet 4/3 { d''4 r4 } \bar "|" \time 2/4 e''2 \bar "|" \time 3/8 es''4. \bar "|" \time 3/4 r8 d''2 r8 \bar "|" } >> Perkussion = \new StaffGroup << \new Staff << \global { \bar "|" \clef percussion \time 3/4 r4 c'2 ~ \bar "|" c'2. \bar "|" R2. \bar "|" r2 g'4 ~ \bar "|" g'2. ~ \bar "|" g'2. } >> \new Staff << \global { \bar "|" \clef percussion \time 3/4 R2. \bar "|" g'2. ~ \bar "|" g'2. \bar "|" r4 g'2 ~ \bar "|" g'2 r4 \bar "|" g'2. } >> >> \score { << \Bassklarinette \Perkussion >> }
[ << Rhythms ] | [Top][Contents] | [ Expressive marks >> ] |
[ < Printing music with different time signatures ] | [ Up : Rhythms ] | [ Printing tuplet brackets on the note head side > ] |
Printing the bar number for the first measure
By default, the first bar number in a score is suppressed if it is less
than or equal to 1. By setting barNumberVisibility
to
all-bar-numbers-visible
, any bar number can be printed for the
first measure and all subsequent measures.
\layout { indent = 0 ragged-right = ##t } \relative c' { \set Score.barNumberVisibility = #all-bar-numbers-visible c1 | d | e | f \break g1 | e | d | c }
[ << Rhythms ] | [Top][Contents] | [ Expressive marks >> ] |
[ < Printing the bar number for the first measure ] | [ Up : Rhythms ] | [ Redefining grace note global defaults > ] |
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 } } }
[ << Rhythms ] | [Top][Contents] | [ Expressive marks >> ] |
[ < Printing tuplet brackets on the note head side ] | [ Up : Rhythms ] | [ Removing bar numbers from a score > ] |
Redefining grace note global defaults
The global defaults for grace notes are stored in the following identifiers.
startGraceMusic stopGraceMusic startAcciaccaturaMusic stopAcciaccaturaMusic startAppoggiaturaMusic stopAppoggiaturaMusic
They are defined in file ly/grace-init.ly
. By redefining them
other effects may be obtained.
startAcciaccaturaMusic = { <>( \override Flag.stroke-style = "grace" \slurDashed } stopAcciaccaturaMusic = { \revert Flag.stroke-style \slurSolid <>) } \relative c'' { \acciaccatura d8 c1 }
[ << Rhythms ] | [Top][Contents] | [ Expressive marks >> ] |
[ < Redefining grace note global defaults ] | [ Up : Rhythms ] | [ Removing connecting bar lines on StaffGroup, PianoStaff, or GrandStaff > ] |
Removing bar numbers from a score
Bar numbers can be removed entirely by removing the
Bar_number_engraver
from the Score
context.
\layout { \context { \Score \omit BarNumber % or: %\remove "Bar_number_engraver" } } \relative c'' { c4 c c c \break c4 c c c } \paper { tagline = ##f }
[ << Rhythms ] | [Top][Contents] | [ Expressive marks >> ] |
[ < Removing bar numbers from a score ] | [ Up : Rhythms ] | [ Rest styles > ] |
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 } >> }
[ << Rhythms ] | [Top][Contents] | [ Expressive marks >> ] |
[ < Removing connecting bar lines on StaffGroup, PianoStaff, or GrandStaff ] | [ Up : Rhythms ] | [ Reverting default beam endings > ] |
Rest styles
Rests may be used in various styles.
restsA = { r\maxima r\longa r\breve r1 r2 r4 r8 r16 s32 s64 s128 s256 s512 s1024 s1024 } restsB = { r\maxima r\longa r\breve r1 r2 r4 r8 r16 r32 r64 r128 r256 r512 r1024 s1024 } \new Staff \relative c { \omit Score.TimeSignature \cadenzaOn \override Staff.Rest.style = #'mensural <>^\markup \typewriter { mensural } \restsA \bar "" \break \override Staff.Rest.style = #'neomensural <>^\markup \typewriter { neomensural } \restsA \bar "" \break \override Staff.Rest.style = #'classical <>^\markup \typewriter { classical } \restsB \bar "" \break \override Staff.Rest.style = #'z <>^\markup \typewriter { z-style } \restsB \bar "" \break \override Staff.Rest.style = #'default <>^\markup \typewriter { default } \restsB \bar "" \break } \paper { indent = 0 tagline = ##f }
[ << Rhythms ] | [Top][Contents] | [ Expressive marks >> ] |
[ < Rest styles ] | [ Up : Rhythms ] | [ Rhythmic slashes > ] |
Reverting default beam endings
To typeset beams grouped 3-4-3-2
in 12/8 it is necessary first
to override the default beam endings in 12/8, and then to set up the
new beaming endings:
\relative c'' { \time 12/8 % Default beaming a8 a a a a a a a a a a a % Set new values for beam endings \set Score.beatStructure = 3,4,3,2 a8 a a a a a a a a a a a }
[ << Rhythms ] | [Top][Contents] | [ Expressive marks >> ] |
[ < Reverting default beam endings ] | [ Up : Rhythms ] | [ Skips in lyric mode > ] |
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.
startPat = { \improvisationOn \omit Stem } stopPat = { \improvisationOff \undo \omit Stem } \new Voice \with { \consists Pitch_squash_engraver } { c'4 d' e' f' | \startPat 4 4 4 4 | \stopPat f'4 e' d' c' }
[ << Rhythms ] | [Top][Contents] | [ Expressive marks >> ] |
[ < Rhythmic slashes ] | [ Up : Rhythms ] | [ Skips in lyric mode (2) > ] |
Skips in lyric mode
The s
syntax for skips is only available in note mode and chord
mode. In other situations, for example, when entering lyrics, using the
\skip
command is recommended.
<< \relative c'' { a1 | a } \new Lyrics \lyricmode { \skip 1 bla1 } >>
[ << Rhythms ] | [Top][Contents] | [ Expressive marks >> ] |
[ < Skips in lyric mode ] | [ Up : Rhythms ] | [ Stemlets > ] |
Skips in lyric mode (2)
Although s
skips cannot be used in \lyricmode
(it is
taken to be a literal “s”, not a space), double quotes (""
) or
underscores (_
) are available.
So for example:
<< \relative c'' { a4 b c d } \new Lyrics \lyricmode { a4 "" _ gap } >>
[ << Rhythms ] | [Top][Contents] | [ Expressive marks >> ] |
[ < Skips in lyric mode (2) ] | [ Up : Rhythms ] | [ Strict beat beaming > ] |
Stemlets
In some notational conventions beams are allowed to extend over rests. Depending on preference, these beams may drop ’stemlets’ to help the eye appreciate the rhythm better, and in some modern music the rest itself is omitted and only the stemlet remains.
This snippet shows a progression from traditional notation, to beams
over the rest, to stemlets over the rest, to stemlets alone. Stemlets
are generated by overriding the 'stemlet-length
property of
Stem
, while rests are hidden by setting
'transparent = ##t
.
Some \markup
elements are included in the source to highlight
the different notations.
\paper { ragged-right = ##f } { c'16^\markup { traditional } d' r f' g'16[^\markup { beams over rests } f' r d'] % N.B. use Score.Stem to set for the whole score. \override Staff.Stem.stemlet-length = #0.75 c'16[^\markup { stemlets over rests } d' r f'] g'16[^\markup { stemlets and no rests } f' \once \hide Rest r16 d'] }
[ << Rhythms ] | [Top][Contents] | [ Expressive marks >> ] |
[ < Stemlets ] | [ Up : Rhythms ] | [ Subdividing beams > ] |
Strict beat beaming
Beamlets can be set to point in the direction of the beat to which they belong. The first beam avoids sticking out flags (the default); the second beam strictly follows the beat.
\relative c'' { \time 6/8 a8. a16 a a \set strictBeatBeaming = ##t a8. a16 a a }
[ << Rhythms ] | [Top][Contents] | [ Expressive marks >> ] |
[ < Strict beat beaming ] | [ Up : Rhythms ] | [ Tam-tam example > ] |
Subdividing beams
The beams of consecutive 16th (or shorter) notes are, by default, not
subdivided. That is, the beams of more than two stems stretch unbroken
over entire groups of notes. This behavior can be modified to subdivide
the beams into sub-groups by setting the property subdivideBeams
to true (#t
). When set, a number of beamlets between two
consecutive stems are removed at intervals multiple beams will be
subdivided at intervals to match the metric value of the subdivision.
Properties minimumBeamSubdivisionInterval
and
maximumBeamSubdivisionInterval
allow configuring limits of
automatic beam subdivision: the minimum rhythmic interval at which to
subdivide beams and the number of beamlets removed depending on the
interval respectively. If the numerator of
maximumBeamSubdivisionInterval
is not a power of 2, the
smaller rhythmic intervals considered for subdivision are
maximumBeamSubdivisionInterval
divided by powers of 2 and
stay greater than or equal to minimumBeamSubdivisionInterval
. If
maximumBeamSubdivisionInterval
< minimumBeamSubdivisionInterval
,
then the depths of beam subdivision are limited to
maximumBeamSubdivisionInterval
, but not the frequency/intervals,
therefore possibly deviating from the correct expected metric value. If
respectIncompleteBeams
is set to true (##t
), the depth of the
subdivision (number of beams) reflects the longest possible subdivision interval
within the remaining length of the beam from the current stem. However, the
last two stems of the beam are exempt from this rule.
\relative c'' { c32[ c c c c c c c] \set subdivideBeams = ##t c32[ c c c c c c c] % Set minimum beam subdivision interval to 1/8 just for this beam \once \set minimumBeamSubdivisionInterval = \musicLength 8 c32[ c c c c c c c] % Set maximum beam subdivision interval to 1/16 just for this beam \once \set maximumBeamSubdivisionInterval = \musicLength 16 c32[ c c c c c c c] % Set maximum beam subdivision interval to 3/8 just for this beam \once \set maximumBeamSubdivisionInterval = \musicLength 8*3 [ \repeat unfold 16 c64 ] r2. % Set maximum beam subdivision interval to 1/64 to limit subdivision depth, % despite not being metrically correct \once \set minimumBeamSubdivisionInterval = \musicLength 32 \once \set maximumBeamSubdivisionInterval = \musicLength 64 [ \repeat unfold 32 c128 ] r2. % Shorten beam by 1/32 c32[ c c c c c c] r32 % Shorten beam by 3/32 c32[ c c c c] r16. % Respect the incomplete beams of the previous two examples \set respectIncompleteBeams = ##t c32[ c c c c c c] r32 % no visual change here as last two stems are exempt from this % special rule c32[ c c c c] r16. }
[ << Rhythms ] | [Top][Contents] | [ Expressive marks >> ] |
[ < Subdividing beams ] | [ Up : Rhythms ] | [ Tambourine example > ] |
Tam-tam example
A tam-tam example, entered with ’tt’
#(define mydrums '((tamtam default #f 0))) \new DrumStaff \with { instrumentName = #"Tamtam" } \drummode { \set DrumStaff.drumStyleTable = #(alist->hash-table mydrums) \override Staff.StaffSymbol.line-positions = #'( 0 ) \override Staff.BarLine.bar-extent = #'(-1.5 . 1.5) tt 1 \pp \laissezVibrer } \paper { tagline = ##f }
[ << Rhythms ] | [Top][Contents] | [ Expressive marks >> ] |
[ < Tam-tam example ] | [ Up : Rhythms ] | [ Three-sided box > ] |
Tambourine example
A tambourine example, entered ’tamb’
\paper { tagline = ##f } #(define mydrums '((tambourine default #f 0))) \new DrumStaff \with { instrumentName = #"Tambourine" } \drummode { \set DrumStaff.drumStyleTable = #(alist->hash-table mydrums) \override Staff.StaffSymbol.line-positions = #'( 0 ) \override Staff.BarLine.bar-extent = #'(-1.5 . 1.5) \time 6/8 tamb8. 16 8 8 8 8 | tamb4. 8 8 8 | % the trick with the scaled duration and the shorter rest % is neccessary for the correct ending of the trill-span! tamb2.*5/6 \startTrillSpan s8 \stopTrillSpan | }
[ << Rhythms ] | [Top][Contents] | [ Expressive marks >> ] |
[ < Tambourine example ] | [ Up : Rhythms ] | [ Time signature in brackets > ] |
Three-sided box
This example shows how to add a markup command to get a three sided box around some text (or other markup).
% New command to add a three sided box, with sides north, west and south % Based on the box-stencil command defined in scm/stencil.scm % Note that ";;" is used to comment a line in Scheme #(define-public (NWS-box-stencil stencil thickness padding) "Add a box around STENCIL, producing a new stencil." (let* ((x-ext (interval-widen (ly:stencil-extent stencil X) padding)) (y-ext (interval-widen (ly:stencil-extent stencil Y) padding)) (y-rule (make-filled-box-stencil (cons 0 thickness) y-ext)) (x-rule (make-filled-box-stencil (interval-widen x-ext thickness) (cons 0 thickness)))) ;; (set! stencil (ly:stencil-combine-at-edge stencil X 1 y-rule padding)) (set! stencil (ly:stencil-combine-at-edge stencil X LEFT y-rule padding)) (set! stencil (ly:stencil-combine-at-edge stencil Y UP x-rule 0.0)) (set! stencil (ly:stencil-combine-at-edge stencil Y DOWN x-rule 0.0)) stencil)) % The corresponding markup command, based on the \box command defined % in scm/define-markup-commands.scm #(define-markup-command (NWS-box layout props arg) (markup?) #:properties ((thickness 0.1) (font-size 0) (box-padding 0.2)) "Draw a box round @var{arg}. Looks at @code{thickness}, @code{box-padding} and @code{font-size} properties to determine line thickness and padding around the markup." (let ((pad (* (magstep font-size) box-padding)) (m (interpret-markup layout props arg))) (NWS-box-stencil m thickness pad))) % Test it: \relative c' { c1^\markup { \NWS-box ABCD } c1^\markup { \NWS-box \note {4} #1.0 } }
[ << Rhythms ] | [Top][Contents] | [ Expressive marks >> ] |
[ < Three-sided box ] | [ Up : Rhythms ] | [ Time signature in parentheses > ] |
Time signature in brackets
The time signature can be enclosed within brackets.
\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 }
[ << Rhythms ] | [Top][Contents] | [ Expressive marks >> ] |
[ < Time signature in brackets ] | [ Up : Rhythms ] | [ Time signature printing only the numerator as a number (instead of the fraction) > ] |
Time signature in parentheses
Enclose the time signature in parentheses.
\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 }
[ << Rhythms ] | [Top][Contents] | [ Expressive marks >> ] |
[ < Time signature in parentheses ] | [ Up : Rhythms ] | [ Tweaking grace layout within music > ] |
Time signature printing only the numerator as a number (instead of the fraction)
Sometimes, a time signature should not print the whole fraction (for
example, 7/4), but only the numerator (digit 7 in this case). This
can be easily done by using
\override Staff.TimeSignature.style = #'single-number
to change
the style permanently. By using
\revert Staff.TimeSignature.style
, this setting can be
reversed. To apply the single-number style to only one time signature,
use the \override
command and prefix it with a \once
.
\relative c'' { \time 3/4 c4 c c % Change the style permanently \override Staff.TimeSignature.style = #'single-number \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-number style only for the next time signature \once \override Staff.TimeSignature.style = #'single-number \time 5/4 c4 c c c c \time 2/4 c4 c }
[ << Rhythms ] | [Top][Contents] | [ Expressive marks >> ] |
[ < Time signature printing only the numerator as a number (instead of the fraction) ] | [ Up : Rhythms ] | [ User defined time signatures > ] |
Tweaking grace layout within music
The layout of grace expressions can be changed throughout the music
using the functions add-grace-property
and
remove-grace-property
.
The following example undefines the Stem
direction for this
grace, so that stems do not always point up, and changes the default
note heads to crosses.
\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 } } }
[ << Rhythms ] | [Top][Contents] | [ Expressive marks >> ] |
[ < Tweaking grace layout within music ] | [ Up : Rhythms ] | [ Using alternative flag styles > ] |
User defined time signatures
New time signature styles can be defined. The time signature in the second measure should be upside down in both staves.
#(add-simple-time-signature-style 'topsy-turvy (lambda (fraction) (make-rotate-markup 180 (make-compound-meter-markup fraction)))) << \new Staff { \time 3/4 f'2. \override Score.TimeSignature.style = #'topsy-turvy \time 3/4 R2. \bar "|." } \new Staff { R2. e'' } >>
[ << Rhythms ] | [Top][Contents] | [ Expressive marks >> ] |
[ < User defined time signatures ] | [ Up : Rhythms ] | [ Using grace note slashes with normal heads > ] |
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 } } }
[ << Rhythms ] | [Top][Contents] | [ Expressive marks >> ] |
[ < Using alternative flag styles ] | [ Up : Rhythms ] | [ Using ties with arpeggios > ] |
Using grace note slashes with normal heads
The slash through the stem found in acciaccaturas can be applied in other situations.
\relative c'' { \override Flag.stroke-style = "grace" c8( d2) e8( f4) }
[ << Rhythms ] | [Top][Contents] | [ Expressive marks >> ] |
[ < Using grace note slashes with normal heads ] | [ Up : Rhythms ] | [ Expressive marks > ] |
Using ties with arpeggios
Ties are sometimes used to write out arpeggios. In this case, two tied
notes need not be consecutive. This can be achieved by setting the
tieWaitForNote
property to #t
. The same feature is also
useful, for example, to tie a tremolo to a chord, but in principle, it
can also be used for ordinary consecutive notes.
\relative c' { \set tieWaitForNote = ##t \grace { c16[ ~ e ~ g] ~ } <c, e g>2 \repeat tremolo 8 { c32 ~ c' ~ } <c c,>1 e8 ~ c ~ a ~ f ~ <e' c a f>2 \tieUp c8 ~ a \tieDown \tieDotted g8 ~ c g2 }
[ << Rhythms ] | [Top][Contents] | [ Repeats >> ] |
[ < Using ties with arpeggios ] | [ Up : Top ] | [ Adding beams, slurs, ties etc. when using tuplet and non-tuplet rhythms > ] |
Expressive marks
[ << Expressive marks ] | [Top][Contents] | [ Repeats >> ] |
[ < Expressive marks ] | [ Up : Expressive marks ] | [ Adding parentheses around an expressive mark or chordal note > ] |
Adding beams, slurs, ties etc. when using tuplet and non-tuplet rhythms
LilyPond syntax can involve many unusual placements for parentheses, brackets etc., which might sometimes have to be interleaved.
For example, when entering a manual beam, the left square bracket has to be placed after the starting note and its duration, not before. Similarly, the right square bracket should directly follow the note which is to be at the end of the requested beaming, even if this note happens to be inside a tuplet section.
This snippet demonstrates how to combine manual beaming, manual slurs, ties and phrasing slurs with tuplet sections (enclosed within curly braces).
{ r16[ g16 \tuplet 3/2 { r16 e'8] } g16( a \tuplet 3/2 { b d e') } g8[( a \tuplet 3/2 { b d') e'] ~ } \time 2/4 \tuplet 5/4 { e'32\( a b d' e' } a'4.\) }
[ << Expressive marks ] | [Top][Contents] | [ Repeats >> ] |
[ < Adding beams, slurs, ties etc. when using tuplet and non-tuplet rhythms ] | [ Up : Expressive marks ] | [ Adding timing marks to long glissandi > ] |
Adding parentheses around an expressive mark or chordal note
The \parenthesize
function is a special tweak that encloses
objects in parentheses. The associated grob is ParenthesesItem
.
\relative c' { c2-\parenthesize -> \override Parentheses.padding = #0.1 \override Parentheses.font-size = #-4 <d \parenthesize f a>2 }
[ << Expressive marks ] | [Top][Contents] | [ Repeats >> ] |
[ < Adding parentheses around an expressive mark or chordal note ] | [ Up : Expressive marks ] | [ Adjusting slur positions vertically > ] |
Adding timing marks to long glissandi
Skipped beats in very long glissandi are sometimes indicated by timing marks, often consisting of stems without noteheads. Such stems can also be used to carry intermediate expression markings.
If the stems do not align well with the glissando, they may need to be repositioned slightly.
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 | }
[ << Expressive marks ] | [Top][Contents] | [ Repeats >> ] |
[ < Adding timing marks to long glissandi ] | [ Up : Expressive marks ] | [ Adjusting the shape of falls and doits > ] |
Adjusting slur positions vertically
Using \override Slur.positions
it is possible to set the
vertical position of the start and end points of a slur to absolute
values (or rather, forcing LilyPond’s slur algorithm to consider these
values as desired). In many cases, this means a lot of trial and error
until good values are found. You probably have tried the
\offset
command next just to find out that it doesn’t work for
slurs, emitting a warning instead.
The code in this snippet allows you to tweak the vertical start and end
positions by specifying relative changes, similar to
\offset
.
Syntax: \offsetPositions #'(dy1 . dy2)
offsetPositions = #(define-music-function (offsets) (number-pair?) #{ \once \override Slur.control-points = #(lambda (grob) (match-let ((((_ . y1) _ _ (_ . y2)) (ly:slur::calc-control-points grob)) ((off1 . off2) offsets)) (set! (ly:grob-property grob 'positions) (cons (+ y1 off1) (+ y2 off2))) (ly:slur::calc-control-points grob))) #}) \relative c'' { c4(^"default" c, d2) \offsetPositions #'(0 . 1) c'4(^"(0 . 1)" c, d2) \offsetPositions #'(0 . 2) c'4(^"(0 . 2)" c, d2) \bar "||" g4(^"default" a d'2) \offsetPositions #'(1 . 0) g,,4(^"(1 . 0)" a d'2) \offsetPositions #'(2 . 0) g,,4(^"(2 . 0)" a d'2) }
[ << Expressive marks ] | [Top][Contents] | [ Repeats >> ] |
[ < Adjusting slur positions vertically ] | [ Up : Expressive marks ] | [ Aligning the ends of hairpins to NoteColumn directions > ] |
Adjusting the shape of falls and doits
The shortest-duration-space
property may be tweaked to adjust
the shape of falls and doits.
\relative c'' { \override Score.SpacingSpanner.shortest-duration-space = 4.0 c2-\bendAfter 5 c2-\bendAfter -4.75 c2-\bendAfter 8.5 c2-\bendAfter -6 }
[ << Expressive marks ] | [Top][Contents] | [ Repeats >> ] |
[ < Adjusting the shape of falls and doits ] | [ Up : Expressive marks ] | [ Alternative breve notes > ] |
Aligning the ends of hairpins to NoteColumn directions
The ends of hairpins may be aligned to the LEFT
, CENTER
or RIGHT
of NoteColumn
grobs by overriding the property
endpoint-alignments
, which is a pair of numbers representing the
left and right ends of the hairpin. endpoint-alignments
are
expected to be directions (either -1, 0 or 1). Other values will
be transformed with a warning. The right end of a hairpin terminating
at a rest is not affected, always ending at the left edge of the rest.
{ c'2\< <c' d'>\! | \override Hairpin.endpoint-alignments = #'(1 . -1) c'2\< <c' d'>\! | \override Hairpin.endpoint-alignments = #`(,LEFT . ,CENTER) c'2\< <c' d'>\! | }
[ << Expressive marks ] | [Top][Contents] | [ Repeats >> ] |
[ < Aligning the ends of hairpins to NoteColumn directions ] | [ Up : Expressive marks ] | [ Asymmetric slurs > ] |
Alternative breve notes
Breve notes are also available with two vertical lines on each side of the notehead instead of one line and in baroque style.
\relative c'' { \time 4/2 c\breve | \override Staff.NoteHead.style = #'altdefault b\breve \override Staff.NoteHead.style = #'baroque b\breve \revert Staff.NoteHead.style a\breve }
[ << Expressive marks ] | [Top][Contents] | [ Repeats >> ] |
[ < Alternative breve notes ] | [ Up : Expressive marks ] | [ Breathing signs > ] |
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 }
[ << Expressive marks ] | [Top][Contents] | [ Repeats >> ] |
[ < Asymmetric slurs ] | [ Up : Expressive marks ] | [ Broken Crescendo Hairpin > ] |
Breathing signs
Breathing signs are available in different tastes: commas (default), ticks, vees and “railroad tracks” (caesura).
\new Staff \relative c'' { \key es \major \time 3/4 % this bar contains no \breathe << { g4 as g } \\ { es4 bes es } >> | % Modern notation: % by default, \breathe uses the rcomma, just as if saying: % \override BreathingSign.text = % #(make-musicglyph-markup "scripts.rcomma") << { g4 as g } \\ { es4 \breathe bes es } >> | % rvarcomma and lvarcomma are variations of the default rcomma % and lcomma % N.B.: must use Staff context here, since we start a Voice below \override Staff.BreathingSign.text = \markup { \musicglyph "scripts.rvarcomma" } << { g4 as g } \\ { es4 \breathe bes es } >> | % raltcomma and laltcomma are alternative variations of the % default rcomma and lcomma \override Staff.BreathingSign.text = \markup { \musicglyph "scripts.raltcomma" } << { g4 as g } \\ { es4 \breathe bes es } >> | % vee \override BreathingSign.text = \markup { \musicglyph "scripts.upbow" } es8[ d es f g] \breathe f | % caesura \override BreathingSign.text = \markup { \musicglyph "scripts.caesura.curved" } es8[ d] \breathe es[ f g f] | es2 r4 \bar "||" }
[ << Expressive marks ] | [Top][Contents] | [ Repeats >> ] |
[ < Breathing signs ] | [ Up : Expressive marks ] | [ Caesura ("railtracks") with fermata > ] |
Broken Crescendo Hairpin
In order to make parts of a crescendo hairpin invisible, the following method is used: A white rectangle is drawn on top of the respective part of the crescendo hairpin, making it invisible. The rectangle is defined as postscript code within a text markup.
The markup command with-dimensions
tells LilyPond to consider
only the bottom edge of the rectangle when spacing it against the
hairpin. The property staff-padding
prevents the rectangle from
fitting between the hairpin and staff.
Make sure the hairpin is in a lower layer than the text markup to draw the rectangle over the hairpin.
\relative c' { << { \dynamicUp r2 r16 c'8.\pp r4 } \\ { \override DynamicLineSpanner.layer = #0 des,2\mf\< ~ \override TextScript.layer = #2 \once\override TextScript.staff-padding = #6 \once\override TextScript.vertical-skylines = #'() des16_\markup \with-dimensions #'(2 . 7) #'(0 . 0) \with-color #white \filled-box #'(2 . 7) #'(0 . 2) #0 r8. des4 ~ des16->\sff r8. } >> }
[ << Expressive marks ] | [Top][Contents] | [ Repeats >> ] |
[ < Broken Crescendo Hairpin ] | [ Up : Expressive marks ] | [ Center text below hairpin dynamics > ] |
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 breath mark back to normal \revert BreathingSign.text c2. \breathe c4 \bar "|." }
[ << Expressive marks ] | [Top][Contents] | [ Repeats >> ] |
[ < Caesura ("railtracks") with fermata ] | [ Up : Expressive marks ] | [ Changing text and spanner styles for text dynamics > ] |
Center text below hairpin dynamics
This example provides a function to typeset a hairpin (de)crescendo with some additional text below it, such as “molto” or “poco”. The added text will change the direction according to the direction of the hairpin. The Hairpin is aligned to DynamicText.
The example also illustrates how to modify the way an object is normally printed, using some Scheme code.
\paper { tagline = ##f } hairpinWithCenteredText = #(define-music-function (text) (markup?) #{ \once \override Voice.Hairpin.after-line-breaking = #(lambda (grob) (let* ((stencil (ly:hairpin::print grob)) (par-y (ly:grob-parent grob Y)) (dir (ly:grob-property par-y 'direction)) (staff-line-thickness (ly:output-def-lookup (ly:grob-layout grob) 'line-thickness)) (new-stencil (ly:stencil-aligned-to (ly:stencil-combine-at-edge (ly:stencil-aligned-to stencil X CENTER) Y dir (ly:stencil-aligned-to (grob-interpret-markup grob (make-fontsize-markup (magnification->font-size (+ (ly:staff-symbol-staff-space grob) (/ staff-line-thickness 2))) text)) X CENTER)) X LEFT)) (staff-space (ly:output-def-lookup (ly:grob-layout grob) 'staff-space)) (par-x (ly:grob-parent grob X)) (dyn-text (grob::has-interface par-x 'dynamic-text-interface)) (dyn-text-stencil-x-length (if dyn-text (interval-length (ly:stencil-extent (ly:grob-property par-x 'stencil) X)) 0)) (x-shift (if dyn-text (- (+ staff-space dyn-text-stencil-x-length) (* 0.5 staff-line-thickness)) 0))) (ly:grob-set-property! grob 'Y-offset 0) (ly:grob-set-property! grob 'stencil (ly:stencil-translate-axis new-stencil x-shift X)))) #}) hairpinMolto = \hairpinWithCenteredText \markup { \italic molto } hairpinMore = \hairpinWithCenteredText \markup { \larger moltissimo } \layout { ragged-right = ##f } \relative c' { \hairpinMolto c2\< c\f \hairpinMore c2\ppppp\< c\f \break \hairpinMolto c2^\< c\f \hairpinMore c2\ppppp\< c\f }
[ << Expressive marks ] | [Top][Contents] | [ Repeats >> ] |
[ < Center text below hairpin dynamics ] | [ Up : Expressive marks ] | [ Changing the appearance of a slur from solid to dotted or dashed > ] |
Changing text and spanner styles for text dynamics
The text used for crescendos and decrescendos can be
changed by modifying the context properties crescendoText
and
decrescendoText
.
The style of the spanner line can be changed by modifying the
'style
property of DynamicTextSpanner
. The default value
is 'dashed-line
, and other possible values include 'line
,
'dotted-line
and '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 }
[ << Expressive marks ] | [Top][Contents] | [ Repeats >> ] |
[ < Changing text and spanner styles for text dynamics ] | [ Up : Expressive marks ] | [ Changing the breath mark symbol > ] |
Changing the appearance of a slur from solid to dotted or dashed
The appearance of slurs may be changed from solid to dotted or dashed.
\relative c' { c4( d e c) \slurDotted c4( d e c) \slurSolid c4( d e c) \slurDashed c4( d e c) \slurSolid c4( d e c) }
Changing the breath mark symbol
The glyph of the breath mark can be tuned by overriding the text
property of the BreathingSign
layout object with any markup
text.
\relative c'' { c2 \override BreathingSign.text = \markup { \musicglyph "scripts.rvarcomma" } \breathe d2 }
[ << Expressive marks ] | [Top][Contents] | [ Repeats >> ] |
[ < Changing the breath mark symbol ] | [ Up : Expressive marks ] | [ Combining dynamics with markup texts > ] |
Changing the number of augmentation dots per note
The number of augmentation dots on a single note can be changed independently of the dots placed after the note.
\relative c' { c4.. a16 r2 | \override Dots.dot-count = 4 c4.. a16 r2 | \override Dots.dot-count = 0 c4.. a16 r2 | \revert Dots.dot-count c4.. a16 r2 | }
[ << Expressive marks ] | [Top][Contents] | [ Repeats >> ] |
[ < Changing the number of augmentation dots per note ] | [ Up : Expressive marks ] | [ Contemporary glissando > ] |
Combining dynamics with markup texts
Some dynamics may involve text indications (such as “più forte” or
“piano subito”). These can be produced using a \markup
block.
piuF = \markup { \italic più \dynamic f } \layout { ragged-right = ##f } \relative c'' { c2\f c-\piuF }
[ << Expressive marks ] | [Top][Contents] | [ Repeats >> ] |
[ < Combining dynamics with markup texts ] | [ Up : Expressive marks ] | [ Controlling spanner visibility after a line break > ] |
Contemporary glissando
A contemporary glissando without a final note can be typeset using a hidden note and cadenza timing.
\relative c'' { \time 3/4 \override Glissando.style = #'zigzag c4 c \cadenzaOn c4\glissando \hideNotes c,,4 \unHideNotes \cadenzaOff \bar "|" }
[ << Expressive marks ] | [Top][Contents] | [ Repeats >> ] |
[ < Contemporary glissando ] | [ Up : Expressive marks ] | [ Controlling the vertical ordering of scripts > ] |
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 tagline = ##f } \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 }
[ << Expressive marks ] | [Top][Contents] | [ Repeats >> ] |
[ < Controlling spanner visibility after a line break ] | [ Up : Expressive marks ] | [ Creating a delayed turn > ] |
Controlling the vertical ordering of scripts
The vertical ordering of scripts is controlled with the
script-priority
property. The lower this number, the closer it will
be put to the note. In this example, the TextScript
(the
sharp symbol) first has the lowest priority, so it is put lowest in
the first example. In the second, the prall trill (the
Script
) has the lowest, so it is on the inside. When two objects
have the same priority, the order in which they are entered determines which
one comes first.
Note that for Fingering
, StringNumber
, and StrokeFinger
grobs, if used within a chord, the vertical order is also determined by the
vertical position of the associated note head, which is added to (or,
depending on the direction, subtracted from) the grob’s
script-priority
value. This ensures that for fingerings above a
chord the lower note is associated with the lower fingering (and vice versa
for the other direction); it doesn’t matter whether you input the notes in
the chord from top to bottom or from bottom to top.
By default, the least technical scripts are positioned closest to the note head; the rough order is articulation, flageolet, fingering, right-hand fingering, string number, fermata, bowing, and text script.
\relative c''' { \once \override TextScript.script-priority = -100 a2^\prall^\markup { \sharp } \once \override Script.script-priority = -100 a2^\prall^\markup { \sharp } \set fingeringOrientations = #'(up) <c-2 a-1>2 <a-1 c\tweak script-priority -100 -2>2 }
[ << Expressive marks ] | [Top][Contents] | [ Repeats >> ] |
[ < Controlling the vertical ordering of scripts ] | [ Up : Expressive marks ] | [ Creating arpeggios across notes in different voices > ] |
Creating a delayed turn
Creating a delayed turn, where the lower note of the turn uses the
accidental, requires several overrides. The
outside-staff-priority
property must be set to #f
, as
otherwise this would take precedence over the avoid-slur
property. Changing the fractions 2/3
and 1/3
adjusts the
horizontal position.
\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) }
[ << Expressive marks ] | [Top][Contents] | [ Repeats >> ] |
[ < Creating a delayed turn ] | [ Up : Expressive marks ] | [ Creating cross-staff arpeggios in a piano staff > ] |
Creating arpeggios across notes in different voices
An arpeggio can be drawn across notes in different voices on the
same staff if the Span_arpeggio_engraver
is added to the
Staff
context:
\new Staff \with { \consists "Span_arpeggio_engraver" } \relative c' { \set Staff.connectArpeggios = ##t << { <e' g>4\arpeggio <d f> <d f>2 } \\ { <d, f>2\arpeggio <g b>2 } >> }
[ << Expressive marks ] | [Top][Contents] | [ Repeats >> ] |
[ < Creating arpeggios across notes in different voices ] | [ Up : Expressive marks ] | [ Creating cross-staff arpeggios in other contexts > ] |
Creating cross-staff arpeggios in a piano staff
In a PianoStaff
, it is possible to let an arpeggio cross
between the staves by setting the property
PianoStaff.connectArpeggios
.
\new PianoStaff \relative c'' << \set PianoStaff.connectArpeggios = ##t \new Staff { <c e g c>4\arpeggio <g c e g>4\arpeggio <e g c e>4\arpeggio <c e g c>4\arpeggio } \new Staff { \clef bass \repeat unfold 4 { <c,, e g c>4\arpeggio } } >>
[ << Expressive marks ] | [Top][Contents] | [ Repeats >> ] |
[ < Creating cross-staff arpeggios in a piano staff ] | [ Up : Expressive marks ] | [ Creating double-digit fingerings > ] |
Creating cross-staff arpeggios in other contexts
Cross-staff arpeggios can be created in contexts other than
GrandStaff
, PianoStaff
and StaffGroup
if the
Span_arpeggio_engraver
is included in the Score
context.
\score { \new ChoirStaff { \set Score.connectArpeggios = ##t << \new Voice \relative c' { <c e>2\arpeggio <d f>2\arpeggio <c e>1\arpeggio } \new Voice \relative c { \clef bass <c g'>2\arpeggio <b g'>2\arpeggio <c g'>1\arpeggio } >> } \layout { \context { \Score \consists "Span_arpeggio_engraver" } } }
[ << Expressive marks ] | [Top][Contents] | [ Repeats >> ] |
[ < Creating cross-staff arpeggios in other contexts ] | [ Up : Expressive marks ] | [ Creating "real" parenthesized dynamics > ] |
Creating double-digit fingerings
Creating fingerings larger than 5 is possible.
\relative c' { c1-10 c1-50 c1-36 c1-29 }
[ << Expressive marks ] | [Top][Contents] | [ Repeats >> ] |
[ < Creating double-digit fingerings ] | [ Up : Expressive marks ] | [ Creating slurs across voices > ] |
Creating "real" parenthesized dynamics
Although the easiest way to add parentheses to a dynamic mark is to use
a \markup
block, this method has a downside: the created
objects will behave like text markups, and not like dynamics.
However, it is possible to create a similar object using the equivalent
Scheme code (as described in the Notation Reference), combined with the
make-dynamic-script
function. This way, the markup will be
regarded as a dynamic, and therefore will remain compatible with
commands such as \dynamicUp
or \dynamicDown
.
paren = #(define-event-function (dyn) (ly:event?) (make-dynamic-script #{ \markup \concat { \normal-text \italic \fontsize #2 ( \pad-x #0.2 #(ly:music-property dyn 'text) \normal-text \italic \fontsize #2 ) } #})) \relative c'' { c4\paren\f c c \dynamicUp c\paren\p }
[ << Expressive marks ] | [Top][Contents] | [ Repeats >> ] |
[ < Creating "real" parenthesized dynamics ] | [ Up : Expressive marks ] | [ Creating text spanners > ] |
Creating slurs across voices
In some situations, it may be necessary to create slurs between notes
from different voices. The solution is to add invisible notes to one of
the voices, using \hideNotes
.
This example is measure 235 of the Ciaconna from Bach’s 2nd Partita for solo violin, BWV 1004.
\relative c' { << { d16( a') s a s a[ s a] s a[ s a] } \\ { \slurUp bes,16[ s e]( \hideNotes a) \unHideNotes f[( \hideNotes a) \unHideNotes fis]( \hideNotes a) \unHideNotes g[( \hideNotes a) \unHideNotes gis]( \hideNotes a) } >> }
[ << Expressive marks ] | [Top][Contents] | [ Repeats >> ] |
[ < Creating slurs across voices ] | [ Up : Expressive marks ] | [ Dynamics custom text spanner postfix > ] |
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 }
[ << Expressive marks ] | [Top][Contents] | [ Repeats >> ] |
[ < Creating text spanners ] | [ Up : Expressive marks ] | [ Dynamics text spanner postfix > ] |
Dynamics custom text spanner postfix
Postfix functions for custom crescendo text spanners. The spanners
should start on the first note of the measure. One has to use
-\mycresc
, otherwise the spanner start will rather be assigned
to the next note.
% 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 }
[ << Expressive marks ] | [Top][Contents] | [ Repeats >> ] |
[ < Dynamics custom text spanner postfix ] | [ Up : Expressive marks ] | [ Glissandi can skip grobs > ] |
Dynamics text spanner postfix
Custom text spanners can be defined and used with hairpin and text
crescendos. \<
and \>
produce hairpins by default,
\cresc
etc. produce text spanners by default.
% 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\! }
[ << Expressive marks ] | [Top][Contents] | [ Repeats >> ] |
[ < Dynamics text spanner postfix ] | [ Up : Expressive marks ] | [ Hairpins with different line styles > ] |
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, }
[ << Expressive marks ] | [Top][Contents] | [ Repeats >> ] |
[ < Glissandi can skip grobs ] | [ Up : Expressive marks ] | [ Hiding the extender line for text dynamics > ] |
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\! }
Hiding the extender line for text dynamics
Text style dynamic changes (such as cresc. and dim.) are printed with a dashed line showing their extent. This line can be suppressed in the following way:
\relative c'' { \override DynamicTextSpanner.style = #'none \crescTextCresc c1\< | d | b | c\! }
[ << Expressive marks ] | [Top][Contents] | [ Repeats >> ] |
[ < Hiding the extender line for text dynamics ] | [ Up : Expressive marks ] | [ Inserting a caesura > ] |
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 tagline = ##f } % 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 }
[ << Expressive marks ] | [Top][Contents] | [ Repeats >> ] |
[ < Horizontally aligning custom dynamics (e.g. "sempre pp", "piu f", "subito p") ] | [ Up : Expressive marks ] | [ Laissez vibrer ties > ] |
Inserting a caesura
Caesura marks can be created by overriding the 'text
property of
the BreathingSign
object.
A curved caesura mark is also available.
\relative c'' { \override BreathingSign.text = \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 }
[ << Expressive marks ] | [Top][Contents] | [ Repeats >> ] |
[ < Inserting a caesura ] | [ Up : Expressive marks ] | [ Line arrows > ] |
Laissez vibrer ties
Laissez vibrer ties have a fixed size. Their formatting can be tuned
using 'tie-configuration
.
\relative c' { <c e g>4\laissezVibrer r <c f g>\laissezVibrer r <c d f g>4\laissezVibrer r <c d f g>4.\laissezVibrer r8 <c d e f>4\laissezVibrer r \override LaissezVibrerTieColumn.tie-configuration = #`((-7 . ,DOWN) (-5 . ,DOWN) (-3 . ,UP) (-1 . ,UP)) <c d e f>4\laissezVibrer r }
[ << Expressive marks ] | [Top][Contents] | [ Repeats >> ] |
[ < Laissez vibrer ties ] | [ Up : Expressive marks ] | [ Making slurs with complex dash structure > ] |
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 }
[ << Expressive marks ] | [Top][Contents] | [ Repeats >> ] |
[ < Line arrows ] | [ Up : Expressive marks ] | [ Modifying default values for articulation shorthand notation > ] |
Making slurs with complex dash structure
Slurs can be made with complex dash patterns by defining the
dash-definition
property. dash-definition
is a list of
dash-elements
. A dash-element
is a list of parameters
defining the dash behavior for a segment of the slur.
The slur is defined in terms of the bezier parameter t which ranges
from 0 at the left end of the slur to 1 at the right end of the slur.
dash-element
is a list
(start-t stop-t dash-fraction dash-period)
. The region of the
slur from start-t
to stop-t
will have a fraction
dash-fraction
of each dash-period
black. dash-period
is defined in terms of staff
spaces. dash-fraction
is set to 1 for a solid slur.
\relative c' { \once \override Slur.dash-definition = #'((0 0.3 0.1 0.75) (0.3 0.6 1 1) (0.65 1.0 0.4 0.75)) c4( d e f) \once \override Slur.dash-definition = #'((0 0.25 1 1) (0.3 0.7 0.4 0.75) (0.75 1.0 1 1)) c4( d e f) }
[ << Expressive marks ] | [Top][Contents] | [ Repeats >> ] |
[ < Making slurs with complex dash structure ] | [ Up : Expressive marks ] | [ Moving slur positions vertically > ] |
Modifying default values for articulation shorthand notation
The shorthands are defined in ‘ly/script-init.ly’, where the
variables dashHat
, dashPlus
, dashDash
,
dashBang
, dashLarger
, dashDot
, and
dashUnderscore
are assigned default values. The default values
for the shorthands can be modified. For example, to associate the
-+
(dashPlus
) shorthand with the trill symbol
instead of the default + symbol, assign the value \trill
to the variable dashPlus
:
\paper { tagline = ##f } \relative c'' { c1-+ } dashPlus = \trill \relative c'' { c1-+ }
[ << Expressive marks ] | [Top][Contents] | [ Repeats >> ] |
[ < Modifying default values for articulation shorthand notation ] | [ Up : Expressive marks ] | [ Moving the ends of hairpins > ] |
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) }
[ << Expressive marks ] | [Top][Contents] | [ Repeats >> ] |
[ < Moving slur positions vertically ] | [ Up : Expressive marks ] | [ Positioning arpeggios > ] |
Moving the ends of hairpins
The ends of hairpins may be offset by setting the shorten-pair
property of the Hairpin
object. Positive values move endpoints
to the right, negative to the left. Unlike the minimum-length
property, this property only affects the appearance of the hairpin; it
does not adjust horizontal spacing (including the position of bounding
dynamics). This method is thus suitable for fine-tuning a hairpin
within its allotted space.
{ c'1~\< c'2~ c'\! \once \override Hairpin.shorten-pair = #'(2 . 2) c'1~\< c'2~ c'\! \once \override Hairpin.shorten-pair = #'(-2 . -2) c'1~\< c'2~ c'\! c'1~\p-\tweak shorten-pair #'(2 . 0)\< c'2~ c'\ffff }
[ << Expressive marks ] | [Top][Contents] | [ Repeats >> ] |
[ < Moving the ends of hairpins ] | [ Up : Expressive marks ] | [ Positioning text markups inside slurs > ] |
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 }
[ << Expressive marks ] | [Top][Contents] | [ Repeats >> ] |
[ < Positioning arpeggios ] | [ Up : Expressive marks ] | [ Printing hairpins in various styles > ] |
Positioning text markups inside slurs
Text markups need to have the outside-staff-priority
property
set to false in order to be printed inside slurs.
\relative c'' { \override TextScript.avoid-slur = #'inside \override TextScript.outside-staff-priority = ##f c2(^\markup { \halign #-10 \natural } d4.) c8 }
[ << Expressive marks ] | [Top][Contents] | [ Repeats >> ] |
[ < Positioning text markups inside slurs ] | [ Up : Expressive marks ] | [ Printing hairpins using al niente notation > ] |
Printing hairpins in various styles
Hairpin dynamics may be created in a variety of styles.
\paper { tagline = ##f } \relative c'' { \override Hairpin.stencil = #flared-hairpin a4\< a a a\f a4\p\< a a a\ff a4\sfz\< a a a\! \override Hairpin.stencil = #constante-hairpin a4\< a a a\f a4\p\< a a a\ff a4\sfz\< a a a\! \override Hairpin.stencil = #flared-hairpin a4\> a a a\f a4\p\> a a a\ff a4\sfz\> a a a\! \override Hairpin.stencil = #constante-hairpin a4\> a a a\f a4\p\> a a a\ff a4\sfz\> a a a\! }
[ << Expressive marks ] | [Top][Contents] | [ Repeats >> ] |
[ < Printing hairpins in various styles ] | [ Up : Expressive marks ] | [ Printing metronome and rehearsal marks below the staff > ] |
Printing hairpins using al niente notation
Hairpin dynamics may be printed with a circled tip (“al niente”
notation) by setting the circled-tip
property of the
Hairpin
object to #t
.
\relative c'' { \override Hairpin.circled-tip = ##t c2\< c\! c4\> c\< c2\! }
[ << Expressive marks ] | [Top][Contents] | [ Repeats >> ] |
[ < Printing hairpins using al niente notation ] | [ Up : Expressive marks ] | [ Setting hairpin behavior at bar lines > ] |
Printing metronome and rehearsal marks below the staff
By default, metronome and rehearsal marks are printed above the
staff. To place them below the staff simply set the direction
property of MetronomeMark
or RehearsalMark
appropriately.
\layout { 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 }
[ << Expressive marks ] | [Top][Contents] | [ Repeats >> ] |
[ < Printing metronome and rehearsal marks below the staff ] | [ Up : Expressive marks ] | [ Setting the minimum length of hairpins > ] |
Setting hairpin behavior at bar lines
If the note which ends a hairpin falls on a downbeat, the hairpin stops
at the bar line immediately preceding. This behavior can be controlled
by overriding the 'to-barline
property.
\relative c'' { e4\< e2. e1\! \override Hairpin.to-barline = ##f e4\< e2. e1\! }
[ << Expressive marks ] | [Top][Contents] | [ Repeats >> ] |
[ < Setting hairpin behavior at bar lines ] | [ Up : Expressive marks ] | [ Showing the same articulation above and below a note or chord > ] |
Setting the minimum length of hairpins
If hairpins are too short, they can be lengthened by modifying the
minimum-length
property of the Hairpin
object.
<< { \after 4 \< \after 2 \> \after 2. \! f'1 \override Hairpin.minimum-length = 8 \after 4 \< \after 2 \> \after 2. \! f'1 } { \repeat unfold 8 c'4 } >>
[ << Expressive marks ] | [Top][Contents] | [ Repeats >> ] |
[ < Setting the minimum length of hairpins ] | [ Up : Expressive marks ] | [ Snap-pizzicato or Bartok pizzicato > ] |
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 }
[ << Expressive marks ] | [Top][Contents] | [ Repeats >> ] |
[ < Showing the same articulation above and below a note or chord ] | [ Up : Expressive marks ] | [ Using a tick as the breath mark symbol > ] |
Snap-pizzicato or Bartok pizzicato
A snap-pizzicato (also known as “Bartok pizzicato”) is a “strong pizzicato where the string is plucked vertically by snapping and rebounds off the fingerboard of the instrument” (Wikipedia). It is denoted by a circle with a vertical line going from the center upwards outside the circle.
\relative c' { c4\snappizzicato <c' e g>4\snappizzicato <c' e g>4^\snappizzicato <c, e g>4_\snappizzicato }
[ << Expressive marks ] | [Top][Contents] | [ Repeats >> ] |
[ < Snap-pizzicato or Bartok pizzicato ] | [ Up : Expressive marks ] | [ Using arpeggioBracket to make divisi more visible > ] |
Using a tick as the breath mark symbol
Vocal and wind music frequently uses a tick mark as a breathing sign. This indicates a breath that subtracts a little time from the previous note rather than causing a short pause, which is indicated by the comma breath mark. The mark can be moved up a little to take it away from the stave.
\relative c'' { c2 \breathe d2 \override BreathingSign.Y-offset = #2.6 \override BreathingSign.text = \markup { \musicglyph "scripts.tickmark" } c2 \breathe d2 }
[ << Expressive marks ] | [Top][Contents] | [ Repeats >> ] |
[ < Using a tick as the breath mark symbol ] | [ Up : Expressive marks ] | [ Using double slurs for legato chords > ] |
Using arpeggioBracket to make divisi more visible
The arpeggioBracket
can be used to indicate the division of
voices where there are no stems to provide the information. This is
often seen in choral music.
\include "english.ly" \score { \relative c'' { \key a \major \time 2/2 << \new Voice = "upper" << { \voiceOne \arpeggioBracket a2( b2 <b d>1\arpeggio) <cs e>\arpeggio ~ <cs e>4 } \addlyrics { \lyricmode { A -- men. } } >> \new Voice = "lower" { \voiceTwo a1 ~ a a ~ a4 \bar "|." } >> } \layout { ragged-right = ##t } }
[ << Expressive marks ] | [Top][Contents] | [ Repeats >> ] |
[ < Using arpeggioBracket to make divisi more visible ] | [ Up : Expressive marks ] | [ Using the whiteout property > ] |
Using double slurs for legato chords
Some composers write two slurs when they want legato
chords. This can be achieved by setting doubleSlurs
.
\relative c' { \set doubleSlurs = ##t <c e>4( <d f> <c e> <d f>) }
[ << Expressive marks ] | [Top][Contents] | [ Repeats >> ] |
[ < Using double slurs for legato chords ] | [ Up : Expressive marks ] | [ Vertical line as a baroque articulation mark > ] |
Using the whiteout property
Any graphical object can be printed over a white background to mask
parts of objects that lie beneath. This can be useful to improve the
appearance of collisions in complex situations when repositioning
objects is impractical. It is necessary to explicitly set the
layer
property to control which objects are masked by the white
background.
In this example the collision of the tie with the time signature is
improved by masking out the part of the tie that crosses the time
signature, setting the whiteout
property of
TimeSignature
. To do this, TimeSignature
is moved to a
layer above Tie
, which is left in the default layer 1, and
StaffSymbol
is moved to a layer above TimeSignature
so it
is not masked.
{ \override Score.StaffSymbol.layer = 4 \override Staff.TimeSignature.layer = 3 b'2 b'~ \once \override Staff.TimeSignature.whiteout = ##t \time 3/4 b' r4 }
[ << Expressive marks ] | [Top][Contents] | [ Repeats >> ] |
[ < Using the whiteout property ] | [ Up : Expressive marks ] | [ Vertically aligning dynamics across multiple notes > ] |
Vertical line as a baroque articulation mark
This short vertical line placed above the note is commonly used in baroque music. Its meaning can vary, but generally indicates notes that should be played with more “weight”. The following example demonstrates how to achieve such a notation.
upline = \tweak stencil #(lambda (grob) (grob-interpret-markup grob #{ \markup \draw-line #'(0 . 1) #})) \stopped \relative c' { a'4^\upline a( c d')_\upline }
[ << Expressive marks ] | [Top][Contents] | [ Repeats >> ] |
[ < Vertical line as a baroque articulation mark ] | [ Up : Expressive marks ] | [ Repeats > ] |
Vertically aligning dynamics across multiple notes
Dynamics that occur at, begin on, or end on the same note will be
vertically aligned. To ensure that dynamics are aligned when they do
not occur on the same note, increase the staff-padding
property
of the DynamicLineSpanner
object.
\relative c' { \override DynamicLineSpanner.staff-padding = #4 c2\p f\mf g2\< b4\> c\! }
[ << Expressive marks ] | [Top][Contents] | [ Simultaneous notes >> ] |
[ < Vertically aligning dynamics across multiple notes ] | [ Up : Top ] | [ Adding volta brackets to additional staves > ] |
Repeats
[ << Repeats ] | [Top][Contents] | [ Simultaneous notes >> ] |
[ < Repeats ] | [ Up : Repeats ] | [ Centered measure numbers > ] |
Adding volta brackets to additional staves
The Volta_engraver
by default resides in the Score
context, and brackets for the repeat are thus normally only printed
over the topmost staff. This can be adjusted by adding the
Volta_engraver
to the Staff
context where the brackets
should appear; see also the “Volta multi staff” snippet.
<< \new Staff { \repeat volta 2 { c'1 } \alternative { c' } } \new Staff { \repeat volta 2 { c'1 } \alternative { c' } } \new Staff \with { \consists "Volta_engraver" } { c'2 g' e' a' } \new Staff { \repeat volta 2 { c'1 } \alternative { c' } } >>
[ << Repeats ] | [Top][Contents] | [ Simultaneous notes >> ] |
[ < Adding volta brackets to additional staves ] | [ Up : Repeats ] | [ Changing the default bar lines > ] |
Centered measure numbers
Scores of large ensemble works often have bar numbers placed beneath
the system, centered horizontally on the measure’s extent. This
snippet shows how the Measure_counter_engraver
may be used to
simulate this notational practice. Here, the engraver has been added
to a Dynamics
context.
This snippet presents a legacy method: starting from LilyPond 2.23.3,
\set Score.centerBarNumbers = ##t
is enough.
\layout { \context { \Dynamics \consists #Measure_counter_engraver \override MeasureCounter.direction = #DOWN \override MeasureCounter.font-encoding = #'latin1 \override MeasureCounter.font-shape = #'italic % to control the distance of the Dynamics context from the staff: \override VerticalAxisGroup.nonstaff-relatedstaff-spacing.padding = #2 } \context { \Score \remove "Bar_number_engraver" } } pattern = \repeat unfold 7 { c'4 d' e' f' } \new StaffGroup << \new Staff { \pattern } \new Staff { \pattern } \new Dynamics { \startMeasureCount s1*7 \stopMeasureCount } >>
[ << Repeats ] | [Top][Contents] | [ Simultaneous notes >> ] |
[ < Centered measure numbers ] | [ Up : Repeats ] | [ Controlling the appearance of tremolo slashes > ] |
Changing the default bar lines
Default bar lines can be changed when re-defined in a score context.
% http://lsr.di.unimi.it/LSR/Item?id=964 %%=> http://lists.gnu.org/archive/html/lilypond-user/2014-03/msg00126.html %%=> http://lilypond.1069038.n5.nabble.com/Changing-the-default-end-repeat-bracket-tc169357.html \layout { \context { \Score %% Changing the defaults from engraver-init.ly measureBarType = "!" startRepeatBarType = "[|:" endRepeatBarType = ":|]" doubleRepeatBarType = ":|][|:" } } %% example: { c'1 \repeat volta 2 { \repeat unfold 2 c' } \repeat volta 2 { \repeat unfold 2 c' } \alternative { { c' } { %% v2.18 workaround \once\override Score.VoltaBracket.shorten-pair = #'(1 . -1) c' } } \bar "|." }
[ << Repeats ] | [Top][Contents] | [ Simultaneous notes >> ] |
[ < Changing the default bar lines ] | [ Up : Repeats ] | [ Cross-staff tremolos > ] |
Controlling the appearance of tremolo slashes
Using various properties of the StemTremolo
grob it is possible
to control the appearance of tremolo slashes.
- Property
slope
sets the slope for tremolo slashes. - Property
shape
determines whether tremolo slashes look like rectangles (valuerectangle
) or like very small beams (valuebeam-like
). - Property
style
sets both the slope and the shape depending on whether the note has flags, beams, or only a plain stem. This is in contrast to the previous two properties, which change the slope and shape unconditionally. There are two styles defined.-
default
: slashes for down-stem flags are longer and more sloped than slashes for up-stem flags; slashes on beamed notes have a rectangular shape and are parallel to the beam. -
constant
: all slashes are beam-like and have the same slope except for down-stem flags.
-
music = { a''4:32 a': e''8: \noBeam e': a'':[ a':] f':[ g':] d':[ d':] } \new Staff { <>^\markup "default" \music } \new Staff { <>^\markup \typewriter "style = #'constant" \override StemTremolo.style = #'constant \music } \new Staff { <>^\markup \typewriter "shape = #'rectangle" \override StemTremolo.shape = #'rectangle \music } \new Staff { <>^\markup \typewriter "shape = #'beam-like" \override StemTremolo.shape = #'beam-like \music } \new Staff { <>^\markup \typewriter "slope = -0.2" \override StemTremolo.slope = -0.2 \music } \paper { indent = 0 tagline = ##f }
[ << Repeats ] | [Top][Contents] | [ Simultaneous notes >> ] |
[ < Controlling the appearance of tremolo slashes ] | [ Up : Repeats ] | [ Engraving tremolos with floating beams > ] |
Cross-staff tremolos
Since \repeat tremolo
expects exactly two musical arguments for
chord tremolos, the note or chord which changes staff within a
cross-staff tremolo should be placed inside curly braces together with
its \change Staff
command.
\new PianoStaff << \new Staff = "up" \relative c'' { \key a \major \time 3/8 s4. } \new Staff = "down" \relative c'' { \key a \major \time 3/8 \voiceOne \repeat tremolo 6 { <a e'>32 { \change Staff = "up" \voiceTwo <cis a' dis>32 } } } >>
[ << Repeats ] | [Top][Contents] | [ Simultaneous notes >> ] |
[ < Cross-staff tremolos ] | [ Up : Repeats ] | [ Isolated percent repeats > ] |
Engraving tremolos with floating beams
If a tremolo’s total duration is less than a quarter-note, or exactly a
half-note, or between a half-note and a whole-note, it is normally
typeset with all beams touching the stems. Certain engraving styles
typeset some of these beams as centered floating beams that do not
touch the stems. The number of floating beams in this type of tremolo
is controlled with the 'gap-count
property of the Beam
object, and the size of the gaps between beams and stems is set with
the 'gap
property.
\relative c'' { \repeat tremolo 8 { a32 f } \override Beam.gap-count = #1 \repeat tremolo 8 { a32 f } \override Beam.gap-count = #2 \repeat tremolo 8 { a32 f } \override Beam.gap-count = #3 \repeat tremolo 8 { a32 f } \override Beam.gap-count = #3 \override Beam.gap = #1.33 \repeat tremolo 8 { a32 f } \override Beam.gap = #1 \repeat tremolo 8 { a32 f } \override Beam.gap = #0.67 \repeat tremolo 8 { a32 f } \override Beam.gap = #0.33 \repeat tremolo 8 { a32 f } }
[ << Repeats ] | [Top][Contents] | [ Simultaneous notes >> ] |
[ < Engraving tremolos with floating beams ] | [ Up : Repeats ] | [ Measure counter > ] |
Isolated percent repeats
Isolated percents can also be printed.
makePercent = #(define-music-function (note) (ly:music?) "Make a percent repeat the same length as NOTE." (make-music 'PercentEvent 'length (ly:music-length note))) \relative c'' { \makePercent s1 }
[ << Repeats ] | [Top][Contents] | [ Simultaneous notes >> ] |
[ < Isolated percent repeats ] | [ Up : Repeats ] | [ Numbering groups of measures > ] |
Measure counter
This snippet provides a workaround for emitting measure counters using transparent percent repeats.
<< \context Voice = "foo" { \clef bass c4 r g r c4 r g r c4 r g r c4 r g r } \context Voice = "foo" { \set countPercentRepeats = ##t \hide PercentRepeat \override PercentRepeatCounter.staff-padding = #1 \repeat percent 4 { s1 } } >>
[ << Repeats ] | [Top][Contents] | [ Simultaneous notes >> ] |
[ < Measure counter ] | [ Up : Repeats ] | [ Percent repeat count visibility > ] |
Numbering groups of measures
This snippet demonstrates the use of the
Measure_counter_engraver
to number groups of successive
measures. Any stretch of measures may be numbered, whether consisting
of repetitions or not.
The engraver must be added to the appropriate context. Here, a
Staff
context is used; another possibility is a Dynamics
context.
The counter is begun with \startMeasureCount
and ended with
\stopMeasureCount
. Numbering will start by default
with 1, but this behavior may be modified by overriding the
count-from
property.
When a measure extends across a line break, the number will appear twice, the second time in parentheses.
\layout { \context { \Staff \consists #Measure_counter_engraver } } \new Staff { \startMeasureCount \repeat unfold 7 { c'4 d' e' f' } \stopMeasureCount \bar "||" g'4 f' e' d' \override Staff.MeasureCounter.count-from = #2 \startMeasureCount \repeat unfold 5 { g'4 f' e' d' } g'4 f' \bar "" \break e'4 d' \repeat unfold 7 { g'4 f' e' d' } \stopMeasureCount } \paper { tagline = ##f }
[ << Repeats ] | [Top][Contents] | [ Simultaneous notes >> ] |
[ < Numbering groups of measures ] | [ Up : Repeats ] | [ Percent repeat counter > ] |
Percent repeat count visibility
Percent repeat counters can be shown at regular intervals by setting
the context property 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 } }
[ << Repeats ] | [Top][Contents] | [ Simultaneous notes >> ] |
[ < Percent repeat count visibility ] | [ Up : Repeats ] | [ Positioning segno and coda (with line break) > ] |
Percent repeat counter
Measure repeats of more than two repeats can get a counter when the convenient property is switched, as shown in this example:
\relative c'' { \set countPercentRepeats = ##t \repeat percent 4 { c1 } }
[ << Repeats ] | [Top][Contents] | [ Simultaneous notes >> ] |
[ < Percent repeat counter ] | [ Up : Repeats ] | [ Setting the double repeat default for volte > ] |
Positioning segno and coda (with line break)
If you want to place an exiting segno sign and add text like “D.S. al Coda” next to it where usually the staff lines are you can use this snippet. The coda will resume in a new line. There is a variation documented in this snippet, where the coda will remain on the same line.
{ \relative c'' { c4 c c c c c c c c c c c \repeat segno 2 { c4 c c c c c c c \alternative { \volta 1 { c4 c c c c c c c c c c c % If you don't use \break at Coda, use \noBreak here % and after \bar "" below. \noBreak \section % double bar line \cadenzaOn % pause bar count \stopStaff % remove staff lines % Increasing the unfold counter will expand the staff-free space \repeat unfold 6 { s1 \bar "" } % Place JumpScript where the staff would normally be. \once \override Score.JumpScript.outside-staff-priority = ##f \once \override Score.JumpScript.Y-offset = 0 \startStaff % resume bar count \cadenzaOff % show staff lines again } } } \sectionLabel "Coda" % Show Coda on a new line \break \repeat unfold 8 { c4 c c c } \fine } } \paper { tagline = ##f }
[ << Repeats ] | [Top][Contents] | [ Simultaneous notes >> ] |
[ < Positioning segno and coda (with line break) ] | [ Up : Repeats ] | [ Shortening volta brackets > ] |
Setting the double repeat default for volte
There are three different styles of double repeats for volte, that can
be set using doubleRepeatBarType
.
\relative c'' { \repeat volta 2 { c1 } \set Score.doubleRepeatBarType = ":..:" \repeat volta 2 { c1 } \set Score.doubleRepeatBarType = ":|.|:" \repeat volta 2 { c1 } \set Score.doubleRepeatBarType = ":|.:" \repeat volta 2 { c1 } }
[ << Repeats ] | [ |