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
}
>>
A markup command that generates a graphical representation of pitch classes on a circle, connecting the played notes with a polygon (solid or dotted line style). Inspired by the graphical approaches of musicians like Miles Okazaki and Steve Coleman
Used properties are :
size
(default 4)polygon-style
: dotted, line or none – defaultline
thickness
– default2
polygon-thickness
– default#f
(thickness
value will be used)dots-thickness
– default#f
(thickness
value will be used)pitch-name
– default#f
pitch-fontsize
– default0
\markup \line {
\pitchPolygon { c e g b }
\hspace #1
\override #'(polygon-style . dotted)
\override #'(pitch-name . #t)
\pitchPolygon { c e aes }
\hspace #1
\overlay {
\override #'(polygon-style . dotted)
\pitchPolygon { c ees fis a }
\pitchPolygon { d f aes b }
}
\hspace #1
\override #'(pitch-name . #t)
\pitchPolygon { d gis }
}
\score {
\layout {
indent = 1.2\cm
ragged-right = ##t
}
\new Staff \with {
instrumentName = \markup {
\pad-around #1
\override #'(size . 5)
\pitchPolygon { c d ees e fis g aes bes b }
}
} \relative c' {
\cadenzaOn \omit Staff.Stem \omit Staff.TimeSignature
c d ees e fis g aes bes b
}
}
Hide pitches. Useful for an educational document :
\hidePitches [num (optional, raise stems)]
\relative c'' {
g4 g8 a b4 b \hidePitches { fis4 fis8 gis a4 } a
}
Add rhythm indications at the top/bottom of the staff :
\rhythmMarks [num (optional, raise rhythms)]
\relative c' {
\key ees \major
<<
\rhythmMarks 9 {
\repeat unfold 3 { r8 d r4 d2 }
}
\\
{
\override Voice.Rest.Y-offset = 0
ees2. g8 f~f2. aes8 g~g1
}
>>
}
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 #})