Skip to content

Instantly share code, notes, and snippets.

@fiee
Created September 30, 2011 08:02
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fiee/1253043 to your computer and use it in GitHub Desktop.
Save fiee/1253043 to your computer and use it in GitHub Desktop.
Lead sheet setup for GNU LilyPond 2.14+
\version "2.14.0"
\include "global.ly"
\include "articulate.ly" % for better MIDI
\header{
title = ""
poet = ""
%composer = ""
%arranger = "arr."
%instrument = "2 voc + git"
source = ""
%maintainer = "Henning Hraban Ramm"
%maintainerWeb = "http://"
%lastupdated = "2011-09-30"
}
global = {
\clef treble
\key a \minor
\time 4/4
}
chordsI = \chordmode {
}
dynamicsI = \relative c {
r4\mp
}
soprano = \relative c'' {
\clef "treble^8"
}
alto = \relative c' {
}
tenor = \relative c {
\clef bass
}
basso = \relative c {
\clef bass
}
textI = \lyricmode {
}
% PDF output
\score {
<<
\context ChordNames {
\chordsI
}
\context ChoirStaff <<
\context Staff = one <<
\context Voice = sopranos { \global \soprano }
\lyricsto sopranos \new Lyrics \textI
\set Staff.instrumentName = #"Sopran "
\set Staff.shortInstrumentName = #"S "
>>
\context Staff = two <<
\context Voice = altos { \global \alto }
\lyricsto altos \new Lyrics \textI
\set Staff.instrumentName = #"Alt "
\set Staff.shortInstrumentName = #"A "
>>
\context Staff = three <<
\context Voice = tenors { \global \tenor }
\lyricsto tenors \new Lyrics \textI
\set Staff.instrumentName = #"Tenor "
\set Staff.shortInstrumentName = #"T "
>>
\context Staff = four <<
\context Voice = bassos { \global \basso }
\lyricsto bassos \new Lyrics \textI
\set Staff.instrumentName = #"Bass "
\set Staff.shortInstrumentName = #"B "
>>
>>
>>
\layout { }
}
%{
\markup{ \vspace #2 }
\markup {
\fill-line {
\hspace #0.1 % left margin
\column {
\line { "1."
\column {
""
""
}
}
\vspace #0.5 % between verses
\line { "2."
\column {
""
""
}
}
}
\hspace #0.1 % between columns
\column {
\line { "3."
\column {
""
""
}
}
\vspace #0.5 % between verses
\line { "4."
\column {
""
""
}
}
}
\hspace #0.1 % right margin
}
}
%}
% MIDI output
\score {
\unfoldRepeats {
<<
\context Staff = chords <<
\set Staff.midiInstrument = "fx 4 (atmosphere)"
\context Voice = chords {
<< \dynamicsI \chordsI >>
}
>>
\context Staff = Sopran << \articulate
\set Staff.midiInstrument = "violin"
\context Voice = Sopran \soprano
>>
\context Staff = Alt << \articulate
\set Staff.midiInstrument = "viola"
\context Voice = Alt \alto
>>
\context Staff = Tenor << \articulate
\set Staff.midiInstrument = "cello"
\context Voice = Tenor \tenor
>>
\context Staff = Bass << \articulate
\set Staff.midiInstrument = "contrabass"
\context Voice = Bass \basso
>>
>>
}
\midi{
\context { \Score
tempoWholesPerMinute = #(ly:make-moment 120 4)
}
}
% }
\version "2.14.0"
#(ly:set-option (quote no-point-and-click))
#(ly:set-option 'midi-extension "mid") % default is "midi"
\header{
title = ""
poet = ""
composer = ""
instrument = ""
source = ""
maintainer = "Henning Hraban Ramm"
lastupdated = "2011-09-30"
tagline = ""
copyright = ""
}
\paper {
% I like my TeX fonts...
#(define fonts (make-pango-font-tree "TeX Gyre Schola" "LMSans10" "LMTypewriter10 Regular" (/ 20 20)))
indent = 0\mm
ragged-bottom = ##t
ragged-last-bottom = ##t
print-page-number = ##f
left-margin = 20\mm
line-width = 175\mm
%annotate-spacing = ##t % if you need to see your layout measures
top-margin = 10\mm
%system-system-spacing #'basic-distance = 30\mm
%score-system-spacing #'basic-distance = 30\mm % default: 20\mm
bookTitleMarkup = \markup {
\override #'(baseline-skip . 3.5)
\column {
\fill-line { \fromproperty #'header:dedication }
\override #'(baseline-skip . 3.5)
\column {
\huge \larger \bold
\fill-line {
\override #'(font-name . "DelitschAntiqua") % see http://www.dafont.com/delitschantiqua.font
\larger \fromproperty #'header:title
}
\fill-line {
\large \smaller \bold
\larger \fromproperty #'header:subtitle
}
\vspace #0.33
\fill-line {
\fromproperty #'header:poet
{ \large \bold \fromproperty #'header:instrument }
\fromproperty #'header:composer
}
\fill-line {
\fromproperty #'header:meter
\fromproperty #'header:arranger
}
}
}
}
}
#(define (addBrackets grob)
"Place brackets round a text object."
(let* (
; Get current text
(currentText (ly:grob-property grob 'text))
(bracketedText (markup "(" currentText ")")))
; Store the bracketed text back
(ly:grob-set-property! grob 'text bracketedText)
)
; and print it
(ly:text-interface::print grob))
#(define (conditional-string-downcase str condition)
(if condition
(string-downcase str)
str))
#(define (pitch-alteration-semitones pitch)
(inexact->exact (round (* (ly:pitch-alteration pitch) 2))))
#(define ((chord-name->german-markup-text-alteration
B-instead-of-Bb) pitch lowercase?)
"Return pitch markup for PITCH, using german note names.
If B-instead-of-Bb is set to #t, real german names are returned.
Otherwise, semi-german names (with Bb and below keeping the
british names). Alterations are indicated with -es and -is
instead of the flat and sharp symbols."
(let* ((name (ly:pitch-notename pitch))
(alt-semitones (pitch-alteration-semitones pitch))
(n-a (if (member (cons name alt-semitones) `((6 . -1) (6 . -2)))
(cons 7 (+ (if B-instead-of-Bb 1 0) alt-semitones))
(cons name alt-semitones))))
(make-line-markup
(list
(make-simple-markup
(conditional-string-downcase
(vector-ref #("C" "D" "E" "F" "G" "A" "H" "B") (car n-a))
lowercase?))
(let ((alteration (/ (cdr n-a) 2)))
(cond
((= alteration FLAT) (make-simple-markup "es"))
((= alteration SHARP) (make-simple-markup "is"))
(else empty-markup)))))))
% use \partialInline, if you need a \partial anywhere else than in the first measure
partialInline = #(define-music-function (parser location dur mus)
(ly:duration? ly:music?)
#{
\set Timing.measureLength = $(ly:duration-length dur)
$mus
\unset Timing.measureLength % Sure you need to unset?!?
#})
% capital last letter is always "once"
% sm = small note size, nmN = normal note size
smN = \override NoteHead #'font-size = #-3
smn = \once \override NoteHead #'font-size = #-3
nmN = \override NoteHead #'font-size = #0
% opC = optional chord (in brackets)
opC = \once \override ChordNames.ChordName #'stencil = #addBrackets
% cnh = cross note head (once)
cnh = \once \override NoteHead #'style = #'cross
% ccJ/N = chordChanges ja/nein
ccJ = \set chordChanges = ##t
ccN = \set chordChanges = ##f
\layout {
\context { \Score
%\dynamicUp % doesn’t work here
\override BarNumber #'break-visibility = #all-invisible
\override HeaderText #'font-name = #"DelitschAntiqua" % from http://www.dafont.com/delitschantiqua.font
%\override PaperColumn #'keep-inside-line = ##t % if you want to avoid text hanging out of the systems
}
\context { \Staff
\override TimeSignature #'style = #'numbered
%\override VerticalAxisGroup #'minimum-Y-extent = #'(-3 . 3) % default= (-4 . 4)
%\override DynamicLineSpanner #'staff-padding = #2.0
%\override DynamicLineSpanner #'Y-extent = #'(-1.5 . 1.5)
%\override TextScript #'Y-extent = #'(-1.5 . 1.5)
}
\context { \ChordNames
chordChanges = ##t
chordNameLowercaseMinor = ##t
chordRootNamer = #(chord-name->german-markup-text-alteration #t)
majorSevenSymbol = \markup{ 7+ }
}
}
\version "2.14.0"
\include "global.ly"
\include "articulate.ly" % for better MIDI
\header{
title = ""
poet = ""
%composer = ""
%arranger = "arr."
%instrument = "2 voc + git"
source = ""
%maintainer = "Henning Hraban Ramm"
%maintainerWeb = "http://"
%lastupdated = "2011-09-30"
}
global = {
\clef treble
\key a \minor
\time 4/4
}
chordsI = \chordmode {
}
dynamicsI = \relative c {
r4\mp
}
voiceI = \relative c'' {
\bar "|."
}
%{
voiceII = \relative c' {
}
%}
textI = \lyricmode {
%\set stanza = "1. "
la la la la
}
% PDF output
\score {
<<
\context ChordNames {
\chordsI
}
\context Staff = Upper <<
\global
\context Voice = "first" \voiceI
>>
\lyricsto "first" \new Lyrics { \textI }
%{
\context Staff = Lower <<
\global
\context Voice = "second" \voiceII
>>
%}
>>
\layout { }
}
\markup{ \vspace #2.0 }
\markup {
\fill-line {
\hspace #0.1 % left margin
\column {
\line { "1."
\column {
""
""
}
}
\vspace #0.5 % between verses
\line { "2."
\column {
""
""
}
}
}
\hspace #0.5 % between columns
\column {
\line { "3."
\column {
""
""
}
}
\vspace #0.5 % between verses
\line { "4."
\column {
""
""
}
}
}
\hspace #0.1 % right margin
}
}
% MIDI output
\score {
\unfoldRepeats {
<<
\context Staff = "chords" <<
\set Staff.midiInstrument = #"fx 4 (atmosphere)"
\context Voice = "vchords" {
\transpose c c, << \dynamicsI \chordsI >>
}
>>
\context Staff = ober << \articulate
\set Staff.midiInstrument = #"violin"
\context Voice = vfirst \voiceI
>>
%{
\context Staff = unter << \articulate
\set Staff.midiInstrument = #"viola"
\context Voice = vsecond \voiceII
>>
%}
\lyricsto "vfirst" \new Lyrics { \textI }
>>
}
\midi {
\context { \Score
tempoWholesPerMinute = #(ly:make-moment 120 4)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment