Examples
This page mirrors the showcase on lilypond.org/examples, rendered here with astro-lilypond. Each section demonstrates a different notation style LilyPond supports.
Classical Music
Section titled “Classical Music”This organ work by J.S. Bach is a fairly typical engraving project in LilyPond.
View source
\version "2.26.0"
\header { mutopiatitle = "Jesu, meine Freude" mutopiacomposer = "BachJS" poet = "BWV 610" %mutopiaopus = "BWV 610" mutopiainstrument = "Organ" date = "" source = "Bach-Album, Ernst H. Wolfram (editor), 6787, C. F. Peters, Leipzig" style = "Baroque" copyright = "Public Domain" maintainer = "Urs Metzger" maintainerEmail = "urs@ursmetzger.de" lastupdated = "2006/Mar/15"
title = "Jesu, meine Freude" composer = "Johann Sebastian Bach" %opus="BWV 610"
footer = "Mutopia-2006/03/27-706" tagline = \markup { \override #'(baseline-skip . 2.2) \center-column { \abs-fontsize #8 \sans \bold \with-url "http://www.MutopiaProject.org" { "Mutopia" "Project" } } \override #'(baseline-skip . 0) \column { \with-color #grey \filled-box #'( 0 . 1) #'(-2.5 . 1.4) #0 } \override #'(baseline-skip . 2.2) \column { \abs-fontsize #8 \sans \concat{"Typeset using " \with-url "http://www.lilypond.org" "LilyPond" " ©2006 by " \maintainer "." } \abs-fontsize #8 \sans \concat {"This work is licensed under a " \with-url "http://creativecommons.org/about/pdm" \copyright " license."} } }}
\include "deutsch.ly"
global = { \key c \minor \time 4/4 \tempo Largo \accidentalStyle default}
halsup = { \voiceOne}
halsdown = { \voiceTwo}
staffup = { \change Staff = "right" \halsdown}
staffdown = { \change Staff = "left" \halsup}
sopran = { \new Voice \relative g' { \global \halsup \repeat volta 2 { g4 g f es d2 c\fermata g'4 g a h c2 h\fermata %% Takt 5 ============================================== c8. d16 es4 d4. d8 c1\fermata } g4 g as g f4. f8 es2\fermata g4 g a h %% Takt 10 ============================================= c4 b! a2 g1\fermata g4 g f es d2 c2\fermata \bar "|." }}
alt = { \new Voice \relative es' { \global \halsdown \repeat volta 2 { es16 d es8~ 16 f es d c8 d~ d c c8 c4 h8 c8. \staffdown g16 \staffup c h c d es16 d es8~ 16 f es d c8 d16 es f as g f~ 16 e f8~ 16 g f es d es d8~ 16 es f d %% Takt 5 ============================================== g8 f es16 g as es f es f d g as g f e8 f16 g as g as e f g f8~ 16 f es d } es16 d es8~ 16 f es des c8 \staffdown b~ 16 b c g as16 g as f b c b as g f g8~ 16 b \staffup c d es16 d es8~ 16 f es d c8 d16 es f as g f %% Takt 10 ============================================= es16 d es8 d g~g g4 fis8 g16 d es c \staffdown d h c a h a h c d h g h c16 h c \staffup d es d es8~ 8 d4 c8~ 16 h c8~ 8 h c16 \staffdown g as8 g4\fermata }}
tenor = { \new Voice \relative { \global \repeat volta 2 { c'16 h c8~ 16 h c g a8 g~ 16 g as es f16 es f d g as g f es d \tieDown es8~ 16 \tieNeutral f es d c16 h c g' c h c c, f8. g16 as!4~ 16 g as b c h c8 d8. c16 h c d h %% Takt 5 ============================================== es16 d es d~ 8 c~c c4 h8 c4~ 8. b16 as b as8 g16 as g f } \halsdown es16 f g as b des c b as g f8~ 8 es es8 es4 d8 es8. b16 es d es f es16 f g8 c16 d c b a g f8~ 4 %% Takt 10 ============================================= g16 fis g a b a b g c b c a d es d c h8 c16 a h g a fis g8 d16 es f es f8~ 16 d es h c h c8 r16 f g d es g as fis g16 d f! es f as g f e8. f16~ 16 d e8\fermata }}
right = { \clef treble << \alt \sopran >>}
left = { \clef bass << \tenor >>}
pedal = { \global \clef "bass" \relative { \repeat volta 2 { r8 c16 d es d es8~ 16 a, h g c h c8 r16 g as f g f g8 c,2 r8 c'16 d es d es8~ 16 c f es d c d8 c8 f16 g as g as8~ 16 d, fis d g fis g8 %% Takt 5 ============================================== r8 a16 h c h c8 r16 g as f g f g8 r16 g as e f e f8 r16 e f h, c h c8 } r8 es16 f g f g8~ 16 c, d! b es d es8 r16 b c as b as b8 es,2 r8 c'16 d es d es8~ 16 c f es d c d8 %% Takt 10 ============================================= c8 es16 f! g fis g8 r16 d es c d c d8 g,1 c4 c,8 c'16 b! a8 h c16 h c8 r16 g as fis g fis g8 c,2_\fermata }}
\score { \new PianoStaff { \set PianoStaff.instrumentName = \markup { \large \center-column { "a" "" "2 Clav." "" "e" "" "Pedale." } \hspace #0.5 } << \context Staff = right { \context Voice = right \right } \context Staff = left { \context Voice = left \left } \context Staff = pedal { \context Voice = pedal \pedal } >> } \layout{}}Complex Notation
Section titled “Complex Notation”This example from Goyescas by Enrique Granados shows some of the more advanced features of typesetting, including kneed beams, cross-staff stems, and voice-follow lines.
View source
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% This is a brief passage from Enrique Granados %% Goyescas, "Coloquio en la Reja." %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\version "2.26.0"
#(set-global-staff-size 14)
\paper { paper-height = 82\mm}
csh = \change Staff = "high"csm = \change Staff = "middle"csl = \change Staff = "low"
crmolto = \markup { \italic "cresc. molto" }appassmolto = \markup { \whiteout \italic "appassionato molto" }
#(ly:set-option 'point-and-click #f)
global = { \time 3/4 }
upperVoiceOne = \relative { \override TupletBracket.bracket-visibility = ##t \override TupletBracket.tuplet-slur = ##t \override TupletNumber.padding = #0 \override TupletBracket.padding = #0.9
% 1 \voiceOne <aes' f'>8\tweak height-limit #4 ([ \tuplet 5/4 { g'32 aes g f g] } <es aes>8[ \tuplet 5/4 { <d bes'>32 c' bes aes bes] } <es, aes es'>8 <d fis bes d>) |
% 2 <c g' c>4( \voiceTwo <bes es bes'>4)\arpeggio <aes aes'>16^( <bes bes'> <g g'>8) |
% 3 \voiceOne <f aes d f>8\tweak height-limit #4 ([ \tuplet 5/4 { <g g'>32 aes' g f g] } <aes, aes'>16 \set stemRightBeamCount = #1 <c f> \set stemLeftBeamCount = #1 \tuplet 5/4 { bes'32 c bes aes bes] } \ottava #1 <es es'>16 <f f'> <d d'> \slashedGrace f8 <es es'>16) |}
upperVoiceTwo = \relative { % 1 \voiceTwo s8 c''8\< <bes, f'>[ <bes aes'> c' <bes, d fis>\!] |
% 2 s4_\tweak X-offset #1 -\appassmolto \voiceOne a'''8\rest <bes, es bes'>-> s4 |
% 3 s8 \voiceTwo \crossStaff { g,8 aes4 }}
middleVoiceOne = \relative { % 1 \crossStaff { d'!8 } s8 s8 s8\offset Y-offset #-2 _\crmolto s4 |
% 2 s4 <g bes>8[ <es' g>] \voiceOne e,8( dis16 e) |
% 3 \once \override VoiceFollower.bound-details.left.Y = 1 \showStaffSwitch \csh \stemUp f4}
middleVoiceTwo = \relative { % 1 s2. |
% 2 s4 \hideNotes \stemUp bes'\arpeggio \unHideNotes \voiceTwo \crossStaff { e,!4 } |
% 3 s4 <bes c es f>8 <f' aes es'>16 d' <bes, f' aes c>8 <bes' fis'> |}
lowerVoiceOne = \relative { \mergeDifferentlyHeadedOn \mergeDifferentlyDottedOn
% 1 \once \override Beam.damping = #5 bes,,8 \csm \stemDown <bes'' c es>8 s2 |
% 2 \csl \stemUp s8 \hideNotes \stemDown es,,64\tweak eccentricity #-1 \tweak height-limit #5 ^( s64 s \unHideNotes \stemUp g'64\offset positions #'(-0.7 . -0.7) \tweak damping #3 [ \set stemLeftBeamCount = #1 bes c d c]) s2 |
% 3 \once \override Beam.damping = #5 bes,,8 \csm \stemDown <bes'' c es>8 s2 |}
lowerVoiceTwo = \relative { % 1 \voiceTwo bes,,2. |
% 2 \csh \once \override Beam.damping = #+inf.0 % XXX Currently, cross-staff beaming support is partially broken. This % means we have to adjust the vertical beam position manually. \once \override Beam.positions = #'(-30 . -30) <bes'' es g>8 \csl es,,64 bes' es g s32. c64 s4 <bes des>4
% 3 bes,,2.}
\score { \new PianoStaff << \set PianoStaff.connectArpeggios = ##t \override PianoStaff.Arpeggio.padding = #-0.5
\new Staff = "high" << \global \context Voice = "upperVoiceOne" { \upperVoiceOne } \context Voice = "upperVoiceTwo" { \upperVoiceTwo } >> \new Staff = "middle" << \global \context Voice = "middleVoiceOne" { \middleVoiceOne } \context Voice = "middleVoiceTwo" { \middleVoiceTwo } >> \new Staff = "low" << \clef bass \global \context Voice = "lowerVoiceOne" { \lowerVoiceOne } \context Voice = "lowerVoiceTwo" { \lowerVoiceTwo } >> >>
\layout { \context { \Score \omit TimeSignature \remove Bar_number_engraver } \context { \PianoStaff \consists #Span_stem_engraver } \context { \Staff } }}Early Music
Section titled “Early Music”A passage of Gregorian chant, showcasing support for ancient notation types.
View source
\version "2.26.0"
#(set-global-staff-size 23)
\new VaticanaScore { << \new VaticanaVoice = "cantus" { \clef "vaticana-do3" % Verse 1 — Salve, Regína a\melisma \[ a \flexa g \pes a\melismaEnd \] d \divisioMinima \[ a\melisma \flexa g\melismaEnd \] \[ f\melisma \flexa e f \pes g \flexa f\melismaEnd \] \[ e\melisma \flexa d\melismaEnd \] \divisioMaior c d \[d\melisma \flexa c\melismaEnd \] d \[ e\melisma \pes f\melismaEnd\] g \[d\melisma \pes e \flexa c\melismaEnd \] d \finalis % Verse 2 — Vita, dulcédo % a\melisma \[ a \flexa g \pes a\melismaEnd \] d % \divisioMinima % \[ a\melisma \flexa g\melismaEnd \] % \[ f\melisma \flexa e f \pes g \flexa f\melismaEnd \] % \[ e\melisma \flexa d\melismaEnd \] % \divisioMaior % c d \[e\melisma \pes f\melismaEnd \] g % \[d\melisma \pes e \flexa c\melismaEnd \] d % \finalis % Verse 3 — Ad te clamámus \[ d\melisma \pes f\melismaEnd\] a g \[ g\melisma \flexa f \pes a\melismaEnd\] e \divisioMaior g f \[ e\melisma \flexa d \pes g\melismaEnd \] \divisioMinima c d \[ e\melisma \flexa d \pes g\melismaEnd \] \[ f\melisma \flexa e\melismaEnd \] d \finalis % Verse 4 — Ad te suspirámus \[ d\melisma \pes f\melismaEnd \] a c' g \[ g\melisma \flexa f \pes g\melismaEnd \] a \divisioMaior d \[ f\melisma \pes \deminutum g\melismaEnd \] g d \[ \virga f\melisma \inclinatum e \inclinatum d\melismaEnd \] c \divisioMaior d \[ d\melisma \flexa c \pes f\melismaEnd \] \[ g\melisma \pes a\melismaEnd \] g \[ f\melisma \flexa e\melismaEnd \] g \[ f\melisma \flexa \deminutum e\melismaEnd \] \[ d\melisma \flexa c \pes d\melismaEnd \] \finalis % Verse 5 — Eia ergo, Advocáta nostra f\melisma \[ f \pes g\melismaEnd \] f \[ g\melisma \pes \deminutum a\melismaEnd \] a \divisioMinima c' g \[ \virga a\melisma \inclinatum g \inclinatum f\melismaEnd \] d g a \divisioMaior d' d' \[ c'\melisma \flexa b c' \pes d'\melismaEnd \] a \divisioMinima d' c' a \[ g\melisma \flexa f \pes a\melismaEnd \] g \[ d\melisma \pes e\melismaEnd \] f \[ \virga e\melisma \inclinatum d \inclinatum c\melismaEnd \] \divisioMaior \[ c\melisma \pes d\melismaEnd \] f \[ g\melisma \flexa \deminutum f\melismaEnd \] \[ d\melisma \flexa c \pes d\melismaEnd \] d \finalis % Verse 6 — Et Jesum d a, \[ c\melisma \pes d\melismaEnd \] \divisioMinima d \[ d\melisma \pes e\melismaEnd \] \[ e\melisma \flexa d d\melismaEnd \] c g f \[ e\melisma \flexa \deminutum d\melismaEnd \] g \[ f\melisma \flexa e\melismaEnd \] \[ d\melisma \flexa c \pes d\melismaEnd \] \[ d\melisma \pes a \] \virga bes\melismaEnd a \divisioMinima \[ \virga a\melisma \inclinatum g \inclinatum f\melismaEnd \] g d f \[ f\melisma \flexa e\melismaEnd \] \[ d\melisma \flexa c\melismaEnd \] \divisioMinima \[ e\melisma \pes f \flexa e\melismaEnd \] d d \finalis % Verse 7 ad finem — O clemens: O pia: O dulcis Virgo María a\melisma \[a \flexa g a \quilisma b \pes c'\melismaEnd \] \[ \virga b\melisma \inclinatum a \inclinatum g\melismaEnd \] a \finalis \[ g\melisma \pes a \quilisma b \pes c' \] \[ c' \flexa b\melismaEnd \] \[ a\melisma \flexa g\melismaEnd \] \[ g\melisma \pes a\melismaEnd \] \finalis \[ a\melisma \flexa d \virga f \inclinatum e \inclinatum d \inclinatum c d \] \divisioMinima \[ d \pes e f \pes g\melismaEnd \] \[ g\melisma \flexa \deminutum f\melismaEnd \] \[ g\melisma \pes a\melismaEnd \] d c d \[ d\melisma \pes g \flexa f f\melismaEnd \] \[ e\melisma \flexa d\melismaEnd \] \finalis }
\new VaticanaLyrics \lyricsto "cantus" { Sal -- ve, Re -- gí -- na, ma -- ter mi -- se -- ri -- cór -- di -- ae: % Vi -- ta, dul -- cé -- do, et spes no -- stra, sal -- ve. Ad te cla -- má -- mus, éx -- su -- les, fi -- li -- i He -- vae. Ad te su -- spi -- rá -- mus, ge -- mén -- tes et flen -- tes in hac la -- cri -- má -- rum val -- le. E -- ia er -- go, Ad -- vo -- cá -- ta no -- stra, il -- los tu -- os mi -- se -- ri -- cór -- des ó -- cu -- los ad nos con -- vér -- te. Et Je -- sum, be -- ne -- díc -- tum fruc -- tum ven -- tris tu -- i, no -- bis post hoc ex -- sí -- li -- um os -- tén -- de. O cle -- mens: O pi -- a: O dul -- cis Vir -- go Ma -- rí -- a. } >>}
\layout { ragged-last = ##t}Modern Music
Section titled “Modern Music”Contemporary composers find LilyPond well-suited to displaying unusual notation. Here is an excerpt from Trevor Bača’s Čáry, for unaccompanied bass flute.
View source
\version "2.26.0"\include "english.ly"
% \header {% dedication = "Carin Levine"% instrument = "bass flute"% title = "ČÁRY"% year = "2004--2006"
% subtitle = \markup { \italic Sorcery (extract) }
% composer = "Trevor Bača"% copyright = "Copyright 2006 Trevor Bača, licensed under the FDL 1.1 or higher"% }
% Verbatim from composer's score.%% Upper staff gives fingerings;% Lower staff gives special types of breath.%% Copyright 2006 Trevor Baca, but this exerpt is licensed under% the FDL 1.1 or higher.
% The excerpt as published on lilypond.org references custom notation% macros from Bača's full score that weren't included in the snippet% (\fraction, \beam, \square, \triangle, \blackdiamond, \semicircle,% \harmonic, \fX, \ffX, \sffp). These are stand-in approximations so the% file compiles; they won't exactly match the original engraving.fraction = #(define-music-function (music) (ly:music?) #{ $music #})
square = #(define-music-function (note) (ly:music?) #{ \tweak NoteHead.style #'cross $note #})triangle = #(define-music-function (note) (ly:music?) #{ \tweak NoteHead.style #'triangle $note #})blackdiamond = #(define-music-function (note) (ly:music?) #{ \tweak NoteHead.style #'harmonic-black $note #})semicircle = #(define-music-function (note) (ly:music?) #{ \tweak NoteHead.style #'slash $note #})harmonic = #(define-music-function (note) (ly:music?) #{ \tweak NoteHead.style #'harmonic $note #})
beam = #(define-music-function (left right note) (number? number? ly:music?) #{ $note #})
fX = _\markup { \italic "fx" }ffX = _\markup { \italic "ffx" }sffp = _\markup { \dynamic "sfp" }
\score { <<
\new StaffGroup <<
\new Staff \with { \override Stem.direction = #down \override Beam.positions = #'(-7 . -7) \override TupletBracket.direction = #down \override TupletBracket.staff-padding = #5 \override TupletBracket.padding = #2.25 } <<
\new Voice {
\override Score.MetronomeMark.extra-offset = #'(0 . 6) \override Score.MetronomeMark.font-size = #3 \tempo 8=42 \time 5/16 s4 s16 \noBreak % measure 6 \time 4/8 s2 \noBreak % measure 7 \time 4/8 s2 \noBreak % measure 8
}
\new Voice \with { \remove Forbid_line_break_engraver } {
% measure 6 \fraction \tuplet 3/5 { \tuplet 5/4 { a'64 [ % 36 cs''64 % 37 f''64 % 38 cs''64 % 39 ef'''64 ] % 40 } \tuplet 5/4 { g''64 [ % 41 c''64 % 42 e''64 % 43 g''64 % 44 ef'''64 ] % 45 } bf''16 % 46 }
% measure 7 r8 % 47 \tuplet 5/4 { d''32 [ % 48 af''32 % 49 e'32 % 50 b'32 % 51 b'32 ] % 52 } ef'''4 % 53
% measure 8 b''8 [ % 54 g''8 ] % 55 d''4 % 56
} >>
\new Staff \with { \hide Clef \override StaffSymbol.line-positions = #'(-4 -2 2 4) \override Stem.direction = #down \override TupletBracket.staff-padding = #5 \override TupletBracket.padding = #2.25 } <<
\new Voice \with { \remove Forbid_line_break_engraver \override Stem.direction = #up \override Flag.stroke-style = "grace" \override Stem.font-size = #-3 \hide Rest \override NoteHead.no-ledgers = ##t \hide Dots \hide TupletBracket \hide TupletNumber } {
% measure 6 \fraction \tuplet 3/5 { \square f''16 * 1/8 % 40 \square f''16 * 1/8 % 41 \square f''16 * 1/8 % 42 \square f''16 * 1/8 % 43 \square f''16 * 1/8 % 44 \square f''16 * 1/8 % 45 \square f''16 * 1/8 % 46 \square f''16 * 1/8 % 47 \tuplet 3/2 { \square f''16 % 48 \square f''16 * 1/2 % 49 } \tuplet 3/2 { \square f''16 * 1/4 % 50 \square f''16 * 1/4 % 51 \square f''16 * 1/4 % 52 \square f''16 * 1/4 % 53 \square f''16 * 1/4 % 54 \square f''16 * 1/4 % 55 } }
% measure 7 s8 % 56 \square g''16 * 2/1 % 57 \square g''16 % 58 \square g''16 % 59 \tuplet 9/8 { s16 % 60 f''16 * 1/4 % 61 f''16 * 1/4 % 62 f''16 * 1/4 % 63 f''16 * 1/4 % 64 f''16 * 1/4 % 65 }
% measure 8 \tuplet 5/4 { \tuplet 7/4 { s4 % 66 \triangle a''16 % 67 \triangle a''16 % 68 \triangle a''16 % 69 } s8 % 70 \triangle a''16 * 1/2 % 71 \triangle a''16 * 1/2 % 72 \triangle a''16 * 1/2 % 73 \triangle a''16 * 1/2 % 74 \triangle a''16 * 1/2 % 75 \triangle g''16 * 1/2 % 76 \triangle g''16 * 1/2 % 77 \triangle g''16 * 1/2 % 78 }
}
\new Voice \with { \remove Forbid_line_break_engraver \hide Stem \hide Rest \override Rest.staff-position = #-0.5 \hide Dots \hide Beam \hide TupletBracket \hide TupletNumber } {
% measure 6 \fraction \tuplet 3/5 { \blackdiamond f'128 [ % 40 \blackdiamond f'128 % 41 \blackdiamond f'128 % 42 \blackdiamond f'128 % 43 \blackdiamond f'128 % 44 \blackdiamond f'128 % 45 \blackdiamond f'128 % 46 \blackdiamond f'128 ] % 47 \tuplet 3/2 { \blackdiamond f'16 % 48 \blackdiamond f'32 % 49 } \tuplet 3/2 { \blackdiamond f'64 % 50 \blackdiamond f'64 % 51 \blackdiamond f'64 % 52 \blackdiamond f'64 % 53 \blackdiamond f'64 % 54 \blackdiamond f'64 % 55 } }
% measure 7 s8 % 56 \harmonic a'8 \glissando % 57 \harmonic a'16 \glissando % 58 \blackdiamond a'16 % 59 \tuplet 9/8 { s16 % 60 \harmonic g'64 \glissando % 61 \harmonic g'64 \glissando % 62 \harmonic g'64 \glissando % 63 \harmonic g'64 \glissando % 64 \blackdiamond g'64 % 65 }
% measure 8 \tuplet 5/4 { \tuplet 7/4 { s4 % 66 \blackdiamond f'16 % 67 \blackdiamond f'16 % 68 \blackdiamond f'16 % 69 } s8 % 70 \blackdiamond f'32 % 71 \blackdiamond f'32 % 72 \blackdiamond f'32 % 73 \blackdiamond f'32 % 74 \blackdiamond f'32 % 75 \harmonic e'32 \glissando % 76 \harmonic e'32 \glissando % 77 \blackdiamond e'32 % 78 }
}
\new Voice \with { \remove Forbid_line_break_engraver \override Stem.direction = #down \override Stem.font-size = #-3 \override Flag.stroke-style = "grace" \hide Rest \override NoteHead.no-ledgers = ##t \hide Dots \hide TupletBracket \hide TupletNumber } {
% measure 6 \fraction \tuplet 3/5 { s128 % 40 s128 % 41 s128 % 42 s128 % 43 s128 % 44 s128 % 45 s128 % 46 s128 % 47 \tuplet 3/2 { \semicircle a16 % 48 \semicircle a16 * 1/2 % 49 } \tuplet 3/2 { \semicircle a16 * 1/4 % 50 \semicircle a16 * 1/4 % 51 \semicircle a16 * 1/4 % 52 \semicircle a16 * 1/4 % 53 \semicircle a16 * 1/4 % 54 \semicircle a16 * 1/4 % 55 } }
% measure 7 s8 % 56 s8 % 57 s16 % 58 \triangle a16 % 59 \tuplet 9/8 { s16 % 60 s64 % 61 s64 % 62 s64 % 63 s64 % 64 \triangle a16 * 1/4 % 65 }
% measure 8 \tuplet 5/4 { \tuplet 7/4 { s4 % 66 \semicircle a16 % 67 \semicircle a16 % 68 \semicircle a16 % 69 } s8 % 70 \semicircle a16 * 1/2 % 71 \semicircle a16 * 1/2 % 72 \semicircle a16 * 1/2 % 73 \semicircle a16 * 1/2 % 74 \semicircle a16 * 1/2 % 75 s32 % 76 s32 % 77 \semicircle a16 * 1/2 % 78 }
}
\new Voice \with { \remove Forbid_line_break_engraver \override Stem.direction = #down \hide NoteHead \override NoteHead.no-ledgers = ##t \override Rest.staff-position = #-18 \override Stem.length = #10 \override Beam.positions = #'(-13 . -13) \override DynamicLineSpanner.staff-padding = #18 \override TextSpanner.bound-details.left.text = #(markup (#:italic "covered")) \override TextSpanner.dash-period = #1 \override TextSpanner.dash-fraction = #0.2 \override TextSpanner.bound-details.left.padding = #0.5 \override TextSpanner.bound-details.right.padding = #0.5 \override TextSpanner.staff-padding = #4 } {
% measure 6 \fraction \tuplet 3/5 { \beam #0 #5 g,128 \sffp \< [ % 40 \beam #5 #5 g,128 % 41 \beam #5 #5 g,128 % 42 \beam #5 #5 g,128 % 43 \beam #5 #5 g,128 % 44 \beam #5 #5 g,128 % 45 \beam #5 #5 g,128 % 46 \beam #5 #1 g,128 % 47 \tuplet 3/2 { \beam #1 #2 g,16 % 48 \beam #3 #1 g,32 \fX % 49 } \tuplet 3/2 { \beam #1 #4 g,64 \sffp \< % 50 \beam #4 #4 g,64 % 51 \beam #4 #4 g,64 % 52 \beam #4 #4 g,64 % 53 \beam #4 #4 g,64 % 54 \beam #4 #0 g,64 \fX ] % 55 } }
% measure 7 r8 % 56 g,8 \sf \< [ % 57 g,16 % 58 \beam #2 #0 g,16 \ffX ] % 59 \tuplet 9/8 { r16 % 60 \beam #4 #4 g,64 \sfp \< [ % 61 \beam #4 #4 g,64 % 62 \beam #4 #4 g,64 % 63 \beam #4 #4 g,64 % 64 \beam #4 #0 g,64 \fX ] % 65 }
% measure 8 \tuplet 5/4 { \tuplet 7/4 { r4 % 66 \beam #2 #2 g,16 \fX [ % 67 \beam #2 #2 g,16 \f % 68 \beam #2 #0 g,16 \fX ] % 69 } r8 % 70 \beam #3 #3 g,32 \fX [ % 71 \beam #3 #3 g,32 \fX % 72 \beam #3 #3 g,32 \fX % 73 \beam #3 #3 g,32 \fX % 74 \beam #3 #3 g,32 \fX % 75 \beam #3 #3 g,32 \sf \< % 76 \beam #3 #3 g,32 % 77 \beam #3 #0 g,32 \ffX ] % 78 }
} >> >> >>}Flexible Creation
Section titled “Flexible Creation”Various performance materials can be created from the same source code. This is an excerpt of Nicolas Sceaux’s engraving of Handel’s Giulio Cesare, in full score, piano-vocal reduction, and a violin part.
View source
%%% G.F Haendel, Giulio Cesare in Egitto%%% Act I, scene IV%%% Sesto: Svegliatevi nel core, furie d'un alma offesa (excerpt)%%%%%% Nicolas Sceaux <nicolas.sceaux@free.fr>
\version "2.26.0"\include "sesto.ily"
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Lead sheet%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\book { \paper { #(layout-set-staff-size 14) } \score { \new StaffGroupNoBar << \new StaffGroupNoBracket << \new Staff << \set Staff.instrumentName = "Violino I." \global \clef treble \keepWithTag #'violin \violinoI >> \new Staff << \set Staff.instrumentName = "Violino II." \global \clef treble \keepWithTag #'violin \violinoII >> >> \new Staff << \new Voice = "sesto" \with { autoBeaming = ##f } << \set Staff.instrumentName = \markup \smallCaps Sesto. \global \clef treble \sesto >> \new Lyrics \lyricsto "sesto" \sestoLyrics >> \new Staff << \set Staff.instrumentName = "Bassi." \global \clef bass \bassi >> >> \layout { indent = 20\mm \context { \Score \accepts StaffGroupNoBar skipBars = ##t } \context { \StaffGroup \name StaffGroupNoBar \description "Like StaffGroup, but without spanbar" \remove Span_bar_engraver \accepts StaffGroupNoBracket } \context { \StaffGroup \name StaffGroupNoBracket \description "Like StaffGroup, but without brackets" \remove System_start_delimiter_engraver } } }}View source
%%% G.F Haendel, Giulio Cesare in Egitto%%% Act I, scene IV%%% Sesto: Svegliatevi nel core, furie d'un alma offesa (excerpt)%%%%%% Nicolas Sceaux <nicolas.sceaux@free.fr>
\version "2.26.0"\include "sesto.ily"
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Reduction%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\book { \header { instrument = "Vocal part and keyboard reduction" } \paper { #(layout-set-staff-size 16) } \score { << \new Staff << \new Voice = "sesto" \with { autoBeaming = ##f } << \set Staff.instrumentName = \markup \smallCaps Sesto. \global \clef treble \sesto >> \new Lyrics \lyricsto "sesto" \sestoLyrics >> \new PianoStaff << \new Staff << \global \clef treble \partCombine \keepWithTag #'reduction \violinoI \keepWithTag #'reduction \violinoII >> \new Staff << \global \clef bass \bassi >> >> >> \layout { indent = 20\mm \context { \Voice printPartCombineTexts = ##f } } }}View source
%%% G.F Haendel, Giulio Cesare in Egitto%%% Act I, scene IV%%% Sesto: Svegliatevi nel core, furie d'un alma offesa (excerpt)%%%%%% Nicolas Sceaux <nicolas.sceaux@free.fr>
\version "2.26.0"\include "sesto.ily"
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Violino I%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\book { \header { instrument = "Violino I" } \paper { #(layout-set-staff-size 18) } \score { \new Staff << \global \clef treble \keepWithTag #'violin \violinoI >> \layout { indent = 5\mm } }}Tablature
Section titled “Tablature”LilyPond supports tablature notation, which can be customized to suit any instrument that reads from tablature. The tablature staff is generated automatically from notes entered for the 5-line staff.
View source
\version "2.26.0"
#(define (glissando::calc-extra-dy grob) (let* ((original (ly:grob-original grob)) (left-bound (ly:spanner-bound original LEFT)) (right-bound (ly:spanner-bound original RIGHT)) (left-pitch (ly:event-property (event-cause left-bound) 'pitch)) (right-pitch (ly:event-property (event-cause right-bound) 'pitch)))
(if (and (= (ly:pitch-octave left-pitch) (ly:pitch-octave right-pitch)) (= (ly:pitch-notename left-pitch) (ly:pitch-notename right-pitch))) (- (ly:pitch-alteration right-pitch) (ly:pitch-alteration left-pitch)) 0 )))
upper= \relative c' { \time 4/4 \key e \major \set Staff.midiInstrument = "acoustic guitar (steel)" \set fingeringOrientations = #'(left)
\partial 4. \acciaccatura c16 \glissando cis8 e4 < cis-1 g'-3 >2 s8 \grace a16 ( \glissando < b-2 >8\3 ) < d-1 > ( b ) < e-3 >\2 ( <d-1> b ) \grace < ais-2 >16 ( \glissando a8 g ) s4. s4. < d'\3 g\2 >8 < gis,\4 d'\3 fis\2 >2\arpeggio ~ < gis\4 d'\3 fis\2 >2 < b'\2\harmonic e\harmonic >2\fermata}
lower= \relative { \set fingeringOrientations = #'(left)
\partial 4. s4. s4 e,4 s2 s2 s8 < e'-3 >4. ~ e4 \hideNotes \grace { b8 \glissando s4 } \unHideNotes < e-2 >4\5 e,2 ~ 2 < e'\6\harmonic >}
\score { \new StaffGroup \with {instrumentName = "Guitar" } << \new Staff = "guitar" << \context Voice = "upper guitar" { \clef "G_8" \voiceOne \override Glissando.gap = #0.5 \override Glissando.extra-offset = #'(-0.5 . 0) \override Glissando.springs-and-rods = #ly:spanner::set-spacing-rods \override Glissando.minimum-length = #4 \override Glissando.extra-dy = #glissando::calc-extra-dy \upper } \context Voice = "lower guitar" { \clef "G_8" \voiceTwo \override Glissando.bound-details.right.padding = #1 \override Glissando.bound-details.left.padding = #0.2 \lower } >> \new TabStaff = "tab" << \context TabVoice = "upper tab" { \clef "moderntab" \voiceOne \upper } \context TabVoice = "lower tab" { \clef "moderntab" \voiceTwo \lower } >> >>
\layout { \context { \Staff \hide StringNumber } \context { \TabStaff \revert Arpeggio.stencil } }}Vocal Music
Section titled “Vocal Music”LilyPond is excellent for vocal music of all kinds, from sacred hymns to opera. Here is a medieval motet with slightly unusual requirements. The tenor voice is written in a different meter than the others, but must line up as if it were in the same meter. LilyPond handles this most elegantly. Note also the incipits with Vaticana style clefs, the slashed stems indicating plicated notes, and the ligature braces above certain groups of notes.
View source
\version "2.26.0"\include "example-header.ily"
\paper { %line-width = 158\mm % produces 624 pixels line-width = 143\mm % reserve 15mm for incipit}
% Aucun ont trouvé, from Montpellier Codex%% Put brackets in where the original has ligatures, using% "Analysis Brackets," and adjust the "bracket-flare" property% to make the ends vertical instead of slanted.
#(set-global-staff-size 15)
%%%%%%%%%%% INCIPIT DEFS %%%%%%%%%%
incipitGlobal = { \override NoteHead.style = #'mensural \override Accidental.style = #'mensural \override KeySignature.style = #'mensural \override Rest.style = #'mensural %\override Staff.TimeSignature.style = #'mensural \cadenzaOn \override Score.Clef.extra-offset = #'(-0.0 . 0.5) \override Score.Clef.font-size = #3 \clef "vaticana-do1"}
incipitTriplum = \markup { \score { { \set Staff.instrumentName = "Triplum" \incipitGlobal s1. } \layout { %indent = 1\cm \context { \Voice \remove Ligature_bracket_engraver \consists Mensural_ligature_engraver } \context { \Staff \remove Time_signature_engraver } line-width = 5\mm } }}
incipitMotetus = \markup { \score { { \set Staff.instrumentName = "Motetus" \incipitGlobal s1. } \layout { % indent = 1\cm \context { \Voice \remove Ligature_bracket_engraver \consists Mensural_ligature_engraver } \context { \Staff \remove Time_signature_engraver } line-width = 5\mm } }}
incipitTenor = \markup { \score { { \set Staff.instrumentName = "Tenor" \incipitGlobal s1.*2 } \layout { %indent = 1\cm \context { \Voice \remove Ligature_bracket_engraver \consists Mensural_ligature_engraver } \context { \Staff \remove Time_signature_engraver } line-width = 5\mm } }}
incipitBassus = \markup { \score { { \set Staff.instrumentName = "Bassus" \override NoteHead.style = #'neomensural \override Accidental.style = #'neomensural \override Rest.style = #'neomensural \override Staff.TimeSignature.style = #'neomensural \cadenzaOn \clef "petrucci-f3" \key f \major \time 3/2 \relative c' { s1. % R1.*2 } } \layout { \context { \Voice \remove Ligature_bracket_engraver \consists Mensural_ligature_engraver } line-width = 5\mm } }}
%%%%%%%%%%% END INCIPIT DEFS %%%%%%%%%%%
#(ly:set-option 'point-and-click #f)
global = { \override Staff.TimeSignature.stencil = #(lambda (grob) (bracketify-stencil (ly:time-signature::print grob) Y 0.1 0.2 0.1)) \time 3/4 \hide Staff.BarLine \override HorizontalBracket.direction = #UP \override HorizontalBracket.bracket-flare = #'(0 . 0)}
%%%%%%%%% MACRO FOR MAKING SLASHES THROUGH STEMS %%%%%%%%%%MakeSlash =#(define-music-function (angle len-left len-right thick y-factor offset) (number? number? number? number? number? pair?) #{ \once\override Voice.Stem.text = \markup { \postscript #(let ((x-off (car offset)) (y-off (cdr offset))) (string-append (ly:number->string (car offset)) " " (ly:number->string (cdr offset)) "translate " (ly:number->string angle) " rotate " (ly:number->string (- x-off)) " " (ly:number->string (- y-off)) " translate 0 setlinewidth " (ly:number->string (- x-off len-left)) " " (ly:number->string (+ y-off thick)) " moveto " (ly:number->string (- x-off len-left)) " " (ly:number->string y-off) " " (ly:number->string thick) "90 270 arc " (ly:number->string (+ x-off len-right)) " " (ly:number->string y-off) " " (ly:number->string thick) "270 90 arc " " gsave fill grestore stroke")) }
\once\override Voice.Stem.stencil = #(lambda (grob) (let* ((sten1 (ly:stem::print grob)) (sten2 (ly:text-interface::print grob)) (extent1 (ly:stencil-extent sten1 Y)) (extent2 (ly:stencil-extent sten2 Y))) (ly:stencil-add sten1 (ly:stencil-translate sten2 (cons 0 (+ (* y-factor (cdr extent1)) (* (- 1 y-factor) (car extent1)))))))) #})
slash = { \MakeSlash #20 #1.0 #1.1 #0.05 #0.75 #'(0 . -.5) }
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
triplumWords = \lyricmode { Au -- cun ont trou -- ve chant par u -- sa -- ge, mes a moi en doune o -- choi -- son __ a -- mours, qui res -- bou -- dist mon cou -- ra -- ge si que m'ès -- tuet fai -- re _ chan -- _ _ çon}
triplumNotes = \relative { \clef "treble_8" %\set Staff.midiInstrument = "flute" %\global \override StemTremolo.beam-thickness = #.125 \override StemTremolo.slope = #1.0 f'8 f4 e8 d c f f f | % 1 % the \scaleDurations command below makes 5 notes last the % duration of a dotted quarter e8 c4 \scaleDurations 3/2 \tuplet 5/4 { e16[ d e d e] } e8 f4 | % 2 g2.~ 4. | % 3 f8 d4 f4. \scaleDurations 3/2 \tuplet 6/4 { g16[ f e f e f] } % 4 g8 g4 g4. e4. | % 5 fis8 d4 e8\startGroup g4\stopGroup f8[ e d] | % 6 c2. r4. | % 7}
motetusWords = \lyricmode { lonc tans _ _ me fiu -- te -- nu de chan -- _ _ ter __ mes or ai _ _}
motetusNotes = \relative { \clef "treble_8" c'2. c8\startGroup b8 \slash c\stopGroup | % 1 a2. c4. | d2. e4. | % 2-3 f2. f8 e d | % 4 c2.~ 4. | r2. r4. | % 5-6 g'4. g g8 f e | % 7}
tenorNotes = \relative { \clef "treble_8" f2. | a2. | g2. | r2. | % 1-4 c2. | b2. | c2. | % 5-7}
\score { \new StaffGroup << \new Staff = "triplum" << %\set Staff.instrumentName = "Triplum" \set Staff.instrumentName = \incipitTriplum \set Staff.shortInstrumentName = "Tr." \set Staff.timeSignature = 9/8
\new Voice = "triplum" \scaleDurations 2/3 { \global \triplumNotes } %\scaleDurations 2/3 %\new Voice = "slashes" { \triplumSkips } \new Lyrics \lyricsto "triplum" \triplumWords >> \new Staff = "motetus" << %\set Staff.instrumentName = "Motetus" \set Staff.instrumentName = \incipitMotetus \set Staff.shortInstrumentName = "M." \set Staff.timeSignature = 9/8
\context Voice = "motetus" \scaleDurations 2/3 { \global \motetusNotes } \new Lyrics \lyricsto "motetus" \motetusWords >> \new Staff = "tenor" { %\set Staff.instrumentName = "Tenor" \set Staff.instrumentName = \incipitTenor \set Staff.shortInstrumentName = "T." \global \tenorNotes } >> %\midi {} \layout { \context { \Staff %\consists Horizontal_bracket_engraver } \context { \Voice \consists Horizontal_bracket_engraver } }}Lead Sheets
Section titled “Lead Sheets”It is simple to create lead sheets with melody, lyrics, chord names, and fretboards. In this example you see some of the predefined fretboard diagrams, but these can be heavily customized to suit nearly any situation.
View source
\version "2.26.0"\include "example-header.ily"\include "predefined-guitar-fretboards.ly"
#(set-global-staff-size 17)
global = { \time 4/4 \key g \major \partial 4 \numericTimeSignature}
melody = \relative { \global d'4 g4 b8( a) g4 fis e e e e a c8( b) a4 g fis a d}
harmonies = \chordmode { \global s4 g1 | c | a:m | d % 1-3}
text = \lyricmode { My eyes are __ dim, I can -- not see, I have not __ brought my specs with me!}
\score { << \new ChordNames { \harmonies } \new FretBoards { \harmonies } \new Staff { \context Voice = "vocal" { \melody } } \new Lyrics \lyricsto "vocal" \text >>}Educational Applications
Section titled “Educational Applications”LilyPond is perfectly suited for educational purposes as well. Here is an example of a simple counterpoint exercise.
View source
\version "2.26.0"\include "example-header.ily"
#(ly:set-option 'point-and-click #f)#(set-global-staff-size 24)
global = { \time 4/4 \numericTimeSignature \key c \major}
cf = \relative { \clef bass \global c4 c' b a | g a f d | e f g g, | c1}
upper = \relative c'' { \global r4 s4 s2 | s1*2 | s2 s4 s \bar "||"}
bassFigures = \figuremode { s1*2 | s4 <6> <6 4> <7> | s1}
\markup { "Exercise 3: Write 8th notes against the given bass line." }
\score { \new PianoStaff << \new Staff { \context Voice = "added voice" \with { \consists Balloon_engraver } \upper }
\new Staff = lower { << \context Staff = lower \cf \new FiguredBass \bassFigures >> } >>}Large Projects
Section titled “Large Projects”LilyPond is excellent for large projects like operas or works for full symphony orchestra, as well. In addition, the text-based input provides greater accessibility—this example was contributed by Hu Haipeng, a blind composer.
View source
\version "2.26.0"
\header { tagline = ##f title = "Violent Dance For Orchestra" composer = "Hu Haipeng"}
\paper{ line-width = 158\mm}
%% text defspresto = \markup { \bold \italic "Presto" }div = \markup { \bold "Div." }nondiv = \markup { \bold "Non div." }unis = \markup { \bold "Unis." }piz = \markup { \bold "Pizz." }arc = \markup { \bold "Arco" }pizz = \set Staff.midiInstrument = "pizzicato strings"arco = \set Staff.midiInstrument = "string ensemble 1"pont = \markup { \bold \italic "Sul ponticello" }naturale = \markup { \bold \italic "Naturale" }moltocr = { \set crescendoText = \markup { \italic "Molto cresc." } \set crescendoSpanner = #'text \override DynamicTextSpanner.style = #'dotted-line}offCr = { \unset crescendoText \unset crescendoSpanner \revert DynamicTextSpanner.style}
%% Layout for piano dynamics\layout { \context { \Voice \override Glissando.breakable = ##t \override TextSpanner.breakable = ##t \override DynamicLineSpanner.breakable = ##t \override DynamicTextSpanner.breakable = ##t \override TrillSpanner.breakable = ##t }}
%% layout to create orchestra staff group%% with non-spanned barlines between two instrument groups\layout { \context { \StaffGroup \name Orchestra \remove Span_bar_engraver } \context { \Score \accepts Orchestra }}
%% Layout to produce SquareStaff context%% to group similar instruments in a staff group with thin square bracket\layout { \context { \StaffGroup \name SquareStaff systemStartDelimiter = #'SystemStartSquare } \context { \Orchestra \accepts SquareStaff } \context { \StaffGroup \accepts SquareStaff }}
%% Layout to produce MarkLine context%% to place rehearsal marks and texts above full score\layout { \context { \type Engraver_group \name MarkLine \consists Apply_output_engraver \consists Axis_group_engraver \consists Mark_engraver \consists Metronome_mark_engraver \consists Script_engraver \consists Text_engraver \consists Text_spanner_engraver \consists Font_size_engraver \override VerticalAxisGroup.staff-affinity = #DOWN \override VerticalAxisGroup.nonstaff-relatedstaff-spacing.padding = #2 \override VerticalAxisGroup.nonstaff-unrelatedstaff-spacing.padding = #5 \override TextSpanner.breakable = ##t } \context { \Score \accepts MarkLine } \context { \Orchestra \accepts MarkLine } \context { \StaffGroup \accepts MarkLine }}
%% layout to produce a smaller markline%% put before 1st violin part\layout { \context { \MarkLine \name SmallMarkLine \override MetronomeMark.outside-staff-priority = #800 \override RehearsalMark.outside-staff-priority = #1200 } \context { \Score \accepts SmallMarkLine } \context { \Orchestra \accepts SmallMarkLine } \context { \StaffGroup \accepts SmallMarkLine }}
modern =#`(Staff ,(make-accidental-rule 'same-octave 0) ,(make-accidental-rule 'any-octave 0) ,(make-accidental-rule 'same-octave 1))
\layout { \context { \Score autoAccidentals = #modern autoCautionaries = #modern }}
marks = \relative c' { \set rehearsalMarkFormatter = #format-mark-box-numbers \tempo \presto 4.=112\set Score.currentBarNumber = #11 s2.*4 | s1*9/8 | }
piccolo = \relative c'''' { \clef treble \key ees \minor \time 6/8 \transposition c'' R2. ges,16(\mf\< ees c ees ges bes) c( bes ges bes c ees) | ges8-.->\!\ff \offCr r r r4 r8 | R2. | \time 9/8 R1*9/8 | }
flutes = \relative { \clef treble \key ees \minor \time 6/8 R2. <ges'' c,>16(\mf\< <ees bes> <c ges> <ees bes> <ges c,> <bes ees,>) <c ges>( <bes ees,> <ges c,> <bes ees,> <c ges> <ees bes>) | <ges c,>8-.->\!\ff \offCr r r r4 r8 | R2. | \time 9/8 R1*9/8 | }
oboes = \relative { \clef treble \key ees \minor \time 6/8 R2. | <ges' c,>4(\mf\< <bes ees,>8 <c ges>4 <ees bes>8) | <ges c,>-.->\!\ff \offCr r r r4 r8 | R2. | \time 9/8 R1*9/8 | }
clarinets = \relative c' { \clef treble \key f \minor \time 6/8 \transposition bes <aes' d,>4(\p\< <c f,>8) <d aes>4( <f c>8) | <aes d,>4( <c f,>8) <d aes>4( <f c>8) | <aes d,>-.->\!\ff \offCr r r r4 r8 | R2. | \time 9/8 R1*9/8 | }
bassoons = \relative { \clef bass \key ees \minor \time 6/8 <ees, bes'>4.\pp\< c'^"a2" | bes8-. bes-. bes-. ges-. ges-. ges-. | ees-.->\!\ff \offCr <ees bes'>4\pp ~ <ees bes'>4. ~ | <ees bes'>2. | \time 9/8 ges4\p^"I" aes8 aes ees ges ges4 aes16( ges) | }
hornI = \relative c'' { \clef treble \key bes \minor \time 6/8 \transposition f r4 r8 <f bes,>4.\p\< ~ | <f bes,>8-. <f bes,>-. <f bes,>-. <f bes,>-. <f bes,>-. <f bes,>-. | <f bes,>-.->\!\ff \offCr r r r4 r8 | R2. | \time 9/8 r4 r8 <b, g>2.\pp | }
hornII = \relative c'' { \clef treble \key bes \minor \time 6/8 \transposition f \moltocr <des g,>2.\pp\< ~ | <des g,>8-. <f bes,>-. <f bes,>-. <f bes,>-. <f bes,>-. <f bes,>-. | <f bes,>-.->\!\ff \offCr r r r4 r8 | R2. | \time 9/8 <f, des>2.\pp <f des>4. ~ | }
trumpetI = \relative c''' { \clef treble \key f \minor \time 6/8 \transposition besR2. | r4 r8 <aes f>-.\f\< <aes f>-. <aes f>-. | <c aes>-.->\!\ff r r r4 r8 | R2. | \time 9/8 R1*9/8 | }
trumpetII = \relative c'' { \clef treble \key f \minor \time 6/8 \transposition besR2. | r8 d-.\mf\< d-. d-. d-. d-. | d-.->\!\ff \offCr r r r4 r8 | R2. | \time 9/8 R1*9/8 | }
trombones = \relative { \clef tenor \key ees \minor \time 6/8 r4 r8 <ges c>4.\mp\< ~ | <ges c>8-. <ges c>-. <ges c>-. <ges c>-. <ges c>-. <ges c>-. | <ges c>-.->\!\ff \offCr r r r4 r8 | R2. | \time 9/8 R1*9/8 | }
tuba = \relative { \clef bass \key ees \minor \time 6/8 <ees, ees'>4.(\pp\< <c c'> | <bes bes'>8-.) <bes bes'>-. <bes bes'>-. <ges ges'>-. <ges ges'>-. <ges ges'>-. | <ees ees'>-.->\!\ff \offCr r r r4 r8 | R2. | \time 9/8 R1*9/8 | }
timpani = \relative { \clef bass \key ees \minor \time 6/8 ees8\< ees ees ees ees ees | bes bes bes bes bes bes | ees,->\!\f \offCr ees'\pp ees ees ees ees | ees ees ees ees ees ees | \time 9/8 ees r r r4 r8 r4 r8 | }
trian = { \clef percussion \time 6/8 R2.*4 | \time 9/8 R1*9/8 | }
cym = { \clef percussion \time 6/8 R2.*4 | \time 9/8 R1*9/8 | }
tamt = { \clef percussion \time 6/8R2. | r4 r8 r c4\mf\<^"*" ~ | 8\!\ff r r r4 r8 | R2. | \time 9/8 R1*9/8 | }
tamb = { \clef percussion \time 6/8 R2.*4 | \time 9/8 R1*9/8 | }
snare = { \clef percussion \time 6/8 R2.*4 | \time 9/8 c8\pp 8 8 8 8 8 8 8 8 | }
bsdrum = { \clef percussion \time 6/8 c2.:32\pp\< ~ | 2.: ~ | 8\!\ff \offCr r r r4 r8 | R2. | \time 9/8 2.:32\pp ~ 4.: | }
harprh = \relative c'' { \clef treble \key ees \minor \time 6/8 \showStaffSwitch R2.*4_\markup { \harp-pedal "--^|^^^^" } | \time 9/8 R1*9/8 | }
harplh = \relative c { \clef bass \key ees \minor \showStaffSwitch R2.*4 | R1*9/8 | }
dynamics = { s2.*4 | s1*9/8 | }
violinI = \relative { \clef treble \key ees \minor \time 6/8 ges'16(\pp\< ees c ees ges bes) c( bes ges bes c ees) | ges( ees c ees ges bes) c( bes ges bes c ees) | ges8-.->\!\ff \offCr r r r4 r8 | R2. | \time 9/8 R1*9/8 | }
violinII = \relative { \clef treble \key ees \minor \time 6/8 c'16(\pp\< bes ges bes c ees) ges( ees c ees ges bes) | c( bes ges bes c ees) ges( ees c ees ges bes) | c8-.->\!\ff \offCr r r r4 r8 | R2. | \time 9/8 r4 r8 \repeat tremolo 6 { c,,32->\pp^\pont e } r4 r8 | }
viola = \relative { \clef alto \key ees \minor \time 6/8 <ees bes'>8-.\pp\< <ees bes'>-. <ees bes'>-. <ges c>-. <ges c>-. <ges c>-. | <bes ees>-. <bes ees>-. <bes ees>-. <c ges'>-. <c ges'>-. <c ges'>-. | <ees bes'>-.->\!\ff \offCr r r r4 r8 | R2. | \time 9/8 \repeat tremolo 12 { ges,32->^\pont bes } \repeat tremolo 6 {ges->( bes) } | }
cello = \relative { \clef bass \key ees \minor \time 6/8 <c ges'>8-.\pp\< <c ges'>-. <c ges'>-. <bes ees>-. <bes ees>-. <bes ees>-. | <c ges'>-. <c ges'>-. <c ges'>-. <c ges'>-. <c ges'>-. <c ges'>-. | <bes ges'>8-.->\!\ff \offCr <c ges'>-.\pp <c ges'>-. <c ges'>-. <c ges'>-. <c ges'>-. | <c ges'>-. r r r4 r8 | \time 9/8 \repeat tremolo 12 <c ges'>32(^\pont \repeat tremolo 12 <cis g'> \repeat tremolo 12 <c ges'>) | }
contrabass = \relative c { \clef bass \key ees \minor \time 6/8 \transposition c <ees bes'>8-.\pp\< ees-. ees-. c-. c-. c-. | bes-. bes-. ges-. ges-. ges-. ges-. | ees-.->\!\ff \offCr <ees' bes'>-.\pp <ees bes'>-. <ees bes'>-. <ees bes'>-. <ees bes'>-. | <ees bes'>-. <ees bes'>-. <ees bes'>-. <ees bes'>-. <ees bes'>-. <ees bes'>-. | \time 9/8 <ees bes'>-. <ees bes'>-. <ees bes'>-. <ees bes'>-. <ees bes'>-. <ees bes'>-. <ees bes'>-. <ees bes'>-. <ees bes'>-. | }
#(set-global-staff-size 10)
\score { \new Orchestra = "orchestra" << \set Score.skipBars = ##f \new MarkLine { \marks } \new StaffGroup = "woodwind" << \new SquareStaff = "picc fl" << \new Staff = "piccolo" { \set Staff.instrumentName = "Piccolo" \set Staff.shortInstrumentName = "Picc." \piccolo } \new Staff = "flutes" { \set Staff.instrumentName = "Flutes I & II" \set Staff.shortInstrumentName = "Fl." \flutes } >> \new Staff = "oboes" { \set Staff.instrumentName = "Oboes I & II" \set Staff.shortInstrumentName = "Ob." \oboes } \new Staff = "clarinets" { \set Staff.instrumentName = \markup { \column { \line { "Clarinets I & II" } \line { "in B" \smaller \flat } } } \set Staff.shortInstrumentName = "Cl." \clarinets } \new Staff = "bassoons" { \set Staff.instrumentName = "Bassoons I & II" \set Staff.shortInstrumentName = "Bn." \bassoons } >> \new StaffGroup = "brass" << \new SquareStaff = "horns" << \new Staff = "hornsI" { \set Staff.instrumentName = \markup { \column { \line { "Horns I & II" } \line { "in F" } } } \set Staff.shortInstrumentName = "Hn. I & II" \hornI } \new Staff = "hornsII" { \set Staff.instrumentName = \markup { \column { \line { "Horns III & IV" } \line { "in F" } } } \set Staff.shortInstrumentName = "Hn. III & IV" \hornII } >> \new SquareStaff = "trumpets" << \new Staff = "trumpetI" { \set Staff.instrumentName = \markup { \column { \line { "Trumpets I & II" } \line { "in B" \smaller \flat } } } \set Staff.shortInstrumentName = "Tp. I & II" \trumpetI } \new Staff = "trumpetII" { \set Staff.instrumentName = \markup { \column { \line { "Trumpet III" } \line { "in B" \smaller \flat } } } \set Staff.shortInstrumentName = "Tp. III" \trumpetII } >> \new SquareStaff = "trombones" << \new Staff = "trombones 1 & 2" { \set Staff.instrumentName = "Trombones I & II" \set Staff.shortInstrumentName = "Tb. I & II" \trombones } \new Staff = "tuba" { \set Staff.instrumentName = "Bass trombone & Tuba" \set Staff.shortInstrumentName = "Btb. & Tu." \tuba } >> >> \new Staff = "timpani" { \set Staff.instrumentName = "Timpani in A, D & E" \set Staff.shortInstrumentName = "Tim." \timpani } \new GrandStaff = "drums" << \new RhythmicStaff = "triangle" { \set RhythmicStaff.instrumentName = "Triangle" \set RhythmicStaff.shortInstrumentName = "Tri." \trian } \new RhythmicStaff = "cymbals" { \set RhythmicStaff.instrumentName = "Suspended cymbal" \set RhythmicStaff.shortInstrumentName = "Susp. cym." \cym } \new RhythmicStaff = "tamtam" { \set RhythmicStaff.instrumentName = "Tamtam" \set RhythmicStaff.shortInstrumentName = "Tamt." \tamt } \new RhythmicStaff = "tambourine" { \set RhythmicStaff.instrumentName = "Tambourine" \set RhythmicStaff.shortInstrumentName = "Tamb." \tamb } \new RhythmicStaff = "snare" { \set RhythmicStaff.instrumentName = "Snare drum" \set RhythmicStaff.shortInstrumentName = "Sn." \snare } \new RhythmicStaff = "bass drum" { \set RhythmicStaff.instrumentName = "Bass drum" \set RhythmicStaff.shortInstrumentName = "Bd." \bsdrum } >> \new PianoStaff = "harp" << \set PianoStaff.instrumentName = "Harp" \set PianoStaff.shortInstrumentName = "Hrp." \set PianoStaff.connectArpeggios = ##t \new Staff = "rh" { \harprh } \new Dynamics { \dynamics } \new Staff = "lh" { \harplh } >> \new SmallMarkLine { \marks } \new StaffGroup = "strings" << \new SquareStaff = "violins" << \new Staff = "violin I" { \set Staff.instrumentName = "Violin I" \set Staff.shortInstrumentName = "Vn. I" \violinI } \new Staff = "violin II" { \set Staff.instrumentName = "Violin II" \set Staff.shortInstrumentName = "Vn. II" \violinII } >> \new Staff = "viola" { \set Staff.instrumentName = "Viola" \set Staff.shortInstrumentName = "Vl." \viola } \new SquareStaff = "Cello and Bass" << \new Staff = "violoncello" { \set Staff.instrumentName = "Violoncello" \set Staff.shortInstrumentName = "Vc." \cello } \new Staff = "contrabass" { \set Staff.instrumentName = "Contrabass" \set Staff.shortInstrumentName = "Cb." \contrabass } >> >> >> \layout { \context { \Score \remove Mark_engraver \remove Metronome_mark_engraver } \context { \Staff \RemoveEmptyStaves } } }Customized Output
Section titled “Customized Output”A short excerpt from Stockhausen’s Klavierstück II to demonstrate LilyPond’s ability to provide customised output.
View source
\version "2.26.0"
\paper { tagline = ##f paper-height = 70\mm}
% A function to display large and centered time signatures between the% staves, using a text font.largeTimeSignatures =\override TimeSignature.stencil =#(lambda (grob) (let ((fraction (ly:grob-property grob 'time-signature '(4 . 4)))) (grob-interpret-markup grob (markup #:override '(font-size . 6) #:override '(font-name . "New Century Schoolbook") #:override '(baseline-skip . 3.5) #:column ((ly:number->string (car fraction)) (ly:number->string (cdr fraction)))))))
% This function makes all tuplet brackets horizontal.horizontalTuplets =\override TupletBracket.stencil =#(lambda (grob) (let* ((pos (ly:grob-property grob 'positions)) (dir (ly:grob-property grob 'direction)) (new-pos ((if (= dir UP) max min) (car pos) (cdr pos)))) (ly:grob-set-property! grob 'positions (cons new-pos new-pos)) (ly:tuplet-bracket::print grob)))
\layout { \context { \Score % Put the change clef after the bar line and time signature. \breakAlignInsert #center-visible clef after time-signature \override TimeSignature.space-alist.clef = #'(minimum-space . 0) } \context { \Staff \hide TimeSignature % Give more horizontal space for the (hidden) time signature. \override TimeSignature.extra-spacing-width = #'(0.0 . 1.5) } \context { \name TimeSignatureContainer \type Engraver_group \consists Axis_group_engraver \consists Time_signature_engraver \largeTimeSignatures \override VerticalAxisGroup.staff-affinity = #CENTER \override VerticalAxisGroup.nonstaff-relatedstaff-spacing = #'((basic-distance . 5) (padding . 0.5)) } \context { \StaffGroup \accepts TimeSignatureContainer }
\set subdivideBeams = ##t \set strictBeatBeaming = ##t \override TupletBracket.bracket-visibility = ##t \override TupletBracket.outside-staff-priority = #3 \horizontalTuplets
\accidentalStyle dodecaphonic}
% Within a `PianoStaff' context, dynamic marks can't be moved to the left of% the preceding bar line by default (to avoid collisions with bar lines).% The following macro overrides this, assigning a zero horizontal width to% the dynamic mark.noHorzSpace =\tweak DynamicText.extra-spacing-width #empty-interval \etc
% A tweak-like function to move dynamics.moveDyn =#(define-event-function (x y event) (number? number? ly:event?) #{ \tweak DynamicLineSpanner.outside-staff-priority ##f \offset DynamicText.X-offset #x \offset DynamicLineSpanner.Y-offset #y #event #})
% Color shorthands.blue = \override NoteHead.color = #bluered = \override NoteHead.color = #red
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
RH = { \tupletUp
% 1 \clef treble \red \tweak style #'dashed-line \tuplet 3/2 { \tuplet 3/2 { d'4\noHorzSpace \moveDyn -1.5 -3.2 ^\ff r8 } r8 } |
% 2 \blue \tuplet 5/4 { b'''16[\noHorzSpace \moveDyn -3.7 4 ^\mf a''16.~\moveDyn 0 0.5 ^\ff } \tuplet 5/4 { a''32 \red d'''8 \moveDyn 0 0 ^\ff } \tuplet 5/4 { \blue r16. <g'' aes'''>16]\moveDyn -0.2 -0.5 ^\p } |
% XXX Currently, cross-staff beaming support is partially broken. This % means we have to apply some work-arounds. % % - The `outside-staff-priority' property of tuplet brackets must be % set to `#f'; any other value makes the cross-staff beaming go % crazy. % - Vertical position adjustments are taken relative to the other % staff; this means that they are sensitive to staff distances (as % set by `staff-staff-spacing', for example).
% 3 \once \override TupletBracket.outside-staff-priority = ##f \tweak text #tuplet-number::calc-fraction-text \tweak style #'dashed-line \tweak positions #'(20.5 . 20.5) \tuplet 4/3 { \tweak positions #'(18 . 18) \tuplet 5/4 { \red \change Staff = LH \stemUp <d'' es'>8\tweak positions #'(5 . 7) [_\pp_\laissezVibrer \change Staff = RH \stemDown f''32\moveDyn -2 0 ^\f_\laissezVibrer } \blue b''32\moveDyn 0 0.2 ^\ff_\laissezVibrer a'16.\moveDyn 0 -0.4 ^\ff_\laissezVibrer gis''8\moveDyn 0 0.2 ^\ff_\laissezVibrer \change Staff = LH \clef bass \red \stemUp cis'8]_\pp } |
% 4 \change Staff = RH \stemNeutral c''4.~_\p \tuplet 5/4 { c''32 r8 } |}
LH = { % 1 \clef bass \tupletDown << { \red ees4\moveDyn -0.5 0 ^\f } \\ { \red \tweak style #'dashed-line \tuplet 3/2 { f,4~\noHorzSpace \moveDyn -2 -2 _\f \tuplet 3/2 { f,16 r8 } } } >> |
% 2 \tupletUp \clef treble \tuplet 5/4 { \blue \set stemRightBeamCount = #1 r16.[ gis'16~_\f } \tuplet 5/4 { gis'32 \red c'8\moveDyn 0 -0.4 _\pp } \tuplet 5/4 { cis''16. _\mf \blue fis'16] _\p } |
% 3 <> \single \textSpannerDown \tweak dash-fraction 0.1 \tweak bound-details.left.text \markup \musicglyph "pedal.Ped" \tweak bound-details.right.text \markup \musicglyph "pedal.*" \tweak dash-period 1.5 \startTextSpan \after 32*11 \stopTextSpan s4. |
% 4 \red d,4.~_\mf \tuplet 5/4 { d,32 r8 } |}
\score{ \new PianoStaff << \new Staff = RH { \RH } \new TimeSignatureContainer { \time 2/8 s4 | \time 3/8 s4. | s4. | \time 4/8 s2 | } \new Staff = LH { \LH } >>}Schenker Graphs
Section titled “Schenker Graphs”Standard output can be modified heavily. Here is an impressive Schenkerian analysis, created by Kris Schaffer, for an article in Linux Journal. The colors have been added for better visibility.
View source
\version "2.26.0"
\header{ composer = "J.S. Bach" title = "Wenn wir in höchsten Nöten sein (BWV 641)" subtitle = "Analysis from Gene Biringer's Schenker Text, Ex. 5-27" enteredby = "Kris Shaffer, Werner Lemberg"}
setup = { \oneVoice \override NoteColumn.ignore-collision = ##t }
% Some remarks.%% - Number `i' in the comments below gives the `i'th column in the graph.% Rhythmically, every column is (arbitrarily) represented as an eighth.% In total, the graph has 15 columns.%% - Using `\stemUp' and `\stemDown' influences the positioning of slurs even% if `\omit Stem' disables printing of stems.%% - Since each layer of the Schenker graph uses `\\' to create a new voice% it is not necessary to undo `\omit' or `\hide' commands. The same holds% for overridden properties.%% The `price' for using `\\' is to call the above-defined macro `\setup'% at the beginning of each voice to undo horizontal voice shifts and to% make LilyPond ignore collisions.%% - Trailing (musical) skips in voices are omitted.
rightHand = { \clef treble \key g \major
<< { \setup % This produces half notes as note heads of eighths. \override NoteHead.duration-log = #1
% 1 s2 % 5 b'8\tweak positions #'(8 . 8) ^[ ^\markup { \override #'(baseline-skip . 0.8) \column { \with-color #red \small { ^ 3 } } } s4. % 9 s4 a'8 ^\markup { \override #'(baseline-skip . 0.8) \column { \with-color #red \small { ^ 2 } } } s8 % 13 s4 g'8] ^\markup { \override #'(baseline-skip . 0.8) \column { \with-color #red \small { ^ 1 } } } } \\ { \setup \override Slur.color = #(x11-color "purple") \stemUp \omit Stem \hide NoteHead \slurDashed
% 1 s2 % 5 b'2\tweak height-limit #6 _( % 9 b'4) a'4\tweak height-limit #3.25 _( % 13 s8 a'4) } \\ { \setup
% 1 \stemUp g'8\tweak positions #'(4.5 . -3.25) -[ s4. % 5 \stemDown \once \hide NoteHead b'8] \stemUp a'8\tweak positions #'(3 . -3) -[ s \stemDown c''8] } \\ { \setup \override Slur.color = #(x11-color "violet")
% 1 \stemDown \omit Stem \omit Flag s8 fis'^(_\markup { \with-color #blue \tiny N } g') a'8^(^\markup { \with-color #blue \tiny P } % 5 \hideNotes b'4) \unHideNotes \once \override TextScript.outside-staff-priority = ##f b'8^(^\markup { \with-color #blue \tiny P } \undo \omit Stem \undo \omit Flag \stemUp \override Stem.length = #10 c''8)^( % 9 \override Stem.length = #14 b'4) s8 \stemDown \omit Stem \omit Flag c''8^( % 13 b'8_\markup { \with-color #blue \tiny P } a') } \\ { \setup \override Slur.color = #(x11-color "violet")
% 1 \stemUp \omit Stem \omit Flag g'8_( fis' g'4) % 5 s2 % 9 s2 % 13 b'8_( a') } \\ { \setup \omit Stem \hide NoteHead
% 1 s2 % 5 s8 d'4 \change Staff = "LH" b4 } \\ { \setup \omit Stem \hide NoteHead
% 1 s2 % 5 s2 % 9 s4 d'4 \change Staff = "LH" % 13 b4 } >>
\bar "|."}
leftHand = { \clef bass \key g \major
<< { \setup % This produces half notes as note heads of eighths. \override NoteHead.duration-log = #1
% 1 g8\tweak positions #'(-8 . -8) _[ _\markup { \with-color #(x11-color 'LawnGreen) \bold I } s4. % 5 s2 % 9 s2 % 13 d8_\markup { \with-color #(x11-color 'LawnGreen) \bold V } s8 g,8]_\markup { \with-color #(x11-color 'LawnGreen) \bold I } } \\ { \setup \override Slur.color = #(x11-color "violet") \stemUp \hide Stem \hide Flag
% 1 s8 \once \override TextScript.outside-staff-priority = ##f \once \override TextScript.padding = #1 a8_(^\markup { \with-color #blue \tiny P } b) \stemDown fis8^(^\markup { \with-color #blue \tiny P } % 5 e8) c8\tweak height-limit #1.5 ^( d8)^\markup { \with-color #blue \tiny N } \stemUp fis,8_( % 9 \undo \hide Stem \undo \hide Flag \override Stem.length = #10 \stemDown g,4) c8_( \hide Stem \hide Flag a,8) % 13 \once \hide NoteHead d8^( d,) } \\ { \setup \override Slur.color = #(x11-color "violet")
% 1 \hide Stem \hide Flag \hide NoteHead g4\tweak height-limit #4 ^( b8) s8 % 5 s8 \undo \hide Stem \undo \hide NoteHead \override Beam.positions = #'(-4 . 1) \stemDown c8[ s \stemUp fis,8] % 9 \override Beam.positions = #'(1 . -4) g,8[ \stemDown b,8] \hide Stem \hide NoteHead c8^( s % 13 d4) } \\ { \setup \override Slur.color = #(x11-color "violet") \hide Stem \hide NoteHead
% 1 g2\tweak height-limit #3 _( % 5 e4) } \\ { \setup \override Slur.color = #(x11-color "purple") \hide Stem \hide NoteHead \slurDashed
% 1 g2\tweak height-limit #8 _( % 5 s2 % 9 g,4) } >>
\bar "|."}
\score { \new PianoStaff << \new Staff = "RH" \rightHand \new Staff = "LH" \leftHand >>
\layout { \context { \Score timing = ##f \override StaffGrouper.staff-staff-spacing.basic-distance = #13 }
\context { \Staff \remove Time_signature_engraver }
\context { \PianoStaff followVoice = ##t }
\context { \Voice % We use `VoiceFollower' lines to indicate related columns % instead of related voices; we thus avoid vertical offsets. \override VoiceFollower.bound-details.left.padding = #0 \override VoiceFollower.bound-details.right.padding = #0 } }}
\paper { indent = 0.0 ragged-right = ##f tagline = ##f paper-height = 100\mm
markup-system-spacing.padding = #4}