This is my personal framework for LilyPond scores. It's a WIP, and I regularly make additions or modifications.
Clone this repository :
git clone https://github.com/martineausimon/lilypond-lib
Add lilypond-lib/
dir to LilyPond include path then use :
\version "2.24.2"
\include "lilypond-lib.ily"
%\include "stylesheet-alt.ly" %% Alternative stylesheet
This framework is based on Futura PT font.
All fonts are included in the repository, and loaded with #(ly:font-config-add-directory "./fonts/")
Insert a non-transposable rythm section with Pitch_squash_engraver
:
\relative c' {
r8 f r f aes aes f c
ees4 f \marquage { b4. b8 }
r8 f r f aes4 bes
}
Insert beats for rhythm section :
<<
\chords {
d2:m7 ees:7 aes:maj7 b:7 e:maj7 g:7 c1:maj7
}
{
\beat 16
}
>>
\hiddenPitch
Hide pitches. Useful for an educational document :
\hiddenPitch [num (optional, raise stems)]
\relative c'' {
g4 g8 a b4 b \hiddenPitch { fis4 fis8 gis a4 } a
}
Insert a non-transposable \xNote
:
music = \relative c' {
\partial 8 f8
bes bes aes bes aes aes f aes
f4 r8 \kick b r2
}
\score { \transpose c d \music }
Quickly add a test spanner with or without text :
\relative c' {
a8 b c d \xSpan "Rit" { a b c d }
}
Add a simple analysis bracket with text :
\relative c' {
\crochet "Phrase A" { a8 b c d }
\crochet "Phrase B" { d c b a }
}
see LilyPond manual :
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 { }
}
Add barre indication for fretted strings instruments
\singleB ["partial num" (optional)] [fret num]
: barre for single note/chord\xBarre ["partial num" (optional)] [fret num] { ... }
: barre for a music section... \startB ["partial num" (optional)] [fret num] ... \stopB
: barre delimiters for more complex situations
\relative c'' {
% Single note/chord barre, partial barre :
<bes d g>1 \singleB "3" 3
% Same, complete barre
<g, d' g bes d g> \singleB 3
\xBarre 3 { g16 d' g bes d g8. }
% equivalent to
g,,16 \startB 3 d' g bes d g8. \stopB
\xBarre "3" 3 { g8 d bes4 }
% Or
\tuplet 3/2 { fis'4 g8 \startB "3" 3 } d8 bes \stopB
}
Add several notes/chords between parenthesis, with a size (optional)
\openParen [size num (optional)] [fist note] ... \closeParen [size num (optional)] [last note]
\relative c' {
\openParen a b c \closeParen d
}
Use this function instead of \book
to compile pdf with personalized odd and even headers. This function takes a string for argument, which will be used for \bookOutputSuffix
and printed in oddHeaderMarkup
and evenHeaderMarkup
. The second argument must be a sheme list containing scores. Useful for transposed music :
\version "2.25.9"
\include "lilypond-lib.ily"
\header {
title = "TITLE"
subtitle = "Subtitle"
subsubtitle = "subsubtitle"
composer = "Composer"
}
music = \relative c'' {
\repeat unfold 20 {
c1 d e f \break
}
}
musicBb = \transpose c d \music
\xBook "" #(list #{ \music #})
\xBook "Bb" #(list #{ \musicBb #})