* Suggestions for writing LilyPond files::
* Single staff::
* Piano templates::
-* Small ensembles::
+* String quartet::
* Vocal ensembles::
* Ancient notation templates::
* Jazz combo::
@itemize @bullet
@item Include @code{\version} numbers in every file. Note that all
-templates contain a @code{\version "2.3.22"} string. We
+templates contain a @code{\version "2.4.0"} string. We
highly recommend that you always include the @code{\version}, no matter
how small your file is. Speaking from personal experience, it's
quite frustrating to try to remember which version of LilyPond you were
add notes, and you're finished!
@lilypond[quote,verbatim,raggedright]
-\version "2.3.22"
+\version "2.4.0"
melody = \relative c' {
\clef treble
\key c \major
line.
@lilypond[quote,verbatim,raggedright]
-\version "2.3.22"
+\version "2.4.0"
melody = \relative c' {
\clef treble
\key c \major
Want to prepare a lead sheet with a melody and chords? Look no further!
@lilypond[quote,verbatim,raggedright]
-\version "2.3.22"
+\version "2.4.0"
melody = \relative c' {
\clef treble
\key c \major
This template allows you to prepare a song with melody, words, and chords.
@lilypond[quote,verbatim,raggedright]
-\version "2.3.22"
+\version "2.4.0"
melody = \relative c' {
\clef treble
\key c \major
Here is a simple piano staff.
@lilypond[quote,verbatim,raggedright]
-\version "2.3.22"
+\version "2.4.0"
upper = \relative c'' {
\clef treble
\key c \major
piano accompaniment underneath.
@lilypond[quote,verbatim,raggedright]
-\version "2.3.22"
+\version "2.4.0"
melody = \relative c'' {
\clef treble
\key c \major
the lyrics between the piano staff (and omit the separate melody staff).
@lilypond[quote,verbatim,raggedright]
-\version "2.3.22"
+\version "2.4.0"
upper = \relative c'' {
\clef treble
\key c \major
tweaking yourself.
@lilypond[quote,verbatim,raggedright]
-\version "2.3.22"
+\version "2.4.0"
upper = \relative c'' {
\clef treble
\key c \major
\override VerticalAlignment #'forced-distance = #7
}
}
+}
+\score {
+ \context PianoStaff <<
+ \context Staff=upper << \upper \dynamics >>
+ \context Staff=lower << \lower \dynamics >>
+ \context Dynamics=pedal \pedal
+ >>
\midi {
\context {
\type "Performer_group_performer"
\name Dynamics
\consists "Piano_pedal_performer"
- \consists "Span_dynamic_performer"
- \consists "Dynamic_performer"
}
\context {
\PianoStaff
@end lilypond
-@node Small ensembles
-@section Small ensembles
+@node String quartet
+@section String quartet
@subsection String quartet
This template demonstrates a string quartet. It also uses a @code{\global}
section for time and key signatures.
@lilypond[quote,verbatim,raggedright]
-\version "2.3.22"
-global = {
- \time 4/4
- \key c \major
-}
+\version "2.4.0"
-violinOne = \relative c''{
- \set Staff.instrument = "Violin 1 "
- c2 d
- e1
+global= {
+ \time 4/4
+ \key c \major
}
-violinTwo = \relative c''{
- \set Staff.instrument = "Violin 2 "
- g2 g
- g1
-}
+violinOne = \new Voice { \relative c''{
+ \set Staff.instrument = "Violin 1 "
-viola = \relative c'{
- \set Staff.instrument = "Viola "
- \clef alto
- e2 d
- c1
-}
+ c2 d e1
-cello = \relative c'{
- \set Staff.instrument = "Cello "
- \clef bass
- c2 g
- c,1
-}
+\bar "|." }}
+violinTwo = \new Voice { \relative c''{
+ \set Staff.instrument = "Violin 2 "
+
+ g2 f e1
+
+\bar "|." }}
+viola = \new Voice { \relative c' {
+ \set Staff.instrument = "Viola "
+ \clef alto
+
+ e2 d c1
+
+\bar "|." }}
+cello = \new Voice { \relative c' {
+ \set Staff.instrument = "Cello "
+ \clef bass
+
+ c2 b a1
+
+\bar "|."}}
\score {
\new StaffGroup <<
}
@end lilypond
+@subsection String quartet parts
+
+The previous example produces a nice string quartet, but what if you
+needed to print parts? This template demonstrates how to use the
+@code{\tag} feature to easily split a piece into individual parts.
+
+You need to split this template into separate files; the filenames
+are contained in comments at the beginning of each file. @code{piece.ly}
+contains all the music definitions. The other files -- @code{score.ly},
+@code{vn1.ly}, @code{vn2.ly}, @code{vla.ly}, and
+@code{vlc.ly} -- produce the appropiate part.
+
+@verbatim
+%%%%% piece.ly
+\version "2.4.0"
+
+global= {
+ \time 4/4
+ \key c \major
+}
+
+Violinone = \new Voice { \relative c''{
+ \set Staff.instrument = "Violin 1 "
+
+ c2 d e1
+
+\bar "|." }} %*********************************
+Violintwo = \new Voice { \relative c''{
+ \set Staff.instrument = "Violin 2 "
+
+ g2 f e1
+
+\bar "|." }} %*********************************
+Viola = \new Voice { \relative c' {
+ \set Staff.instrument = "Viola "
+ \clef alto
+
+ e2 d c1
+
+\bar "|." }} %*********************************
+Cello = \new Voice { \relative c' {
+ \set Staff.instrument = "Cello "
+ \clef bass
+
+ c2 b a1
+
+\bar "|."}} %**********************************
+
+music = {
+ <<
+ \tag #'(score vn1) \new Staff { << \global \Violinone >> }
+ \tag #'(score vn2) \new Staff { << \global \Violintwo>> }
+ \tag #'(score vla) \new Staff { << \global \Viola>> }
+ \tag #'(score vlc) \new Staff { << \global \Cello>> }
+ >>
+}
+
+
+
+%%%%% score.ly
+\version "2.4.0"
+\include "piece.ly"
+#(set-global-staff-size 14)
+\score {
+ \new StaffGroup \keepWithTag #'score \music
+ \layout { }
+ \midi { \tempo 4 = 60 }
+}
+
+
+%%%%% vn1.ly
+\version "2.4.0"
+\include "piece.ly"
+\score {
+ \keepWithTag #'vn1 \music
+ \layout { }
+}
+
+
+%%%%% vn2.ly
+\version "2.4.0"
+\include "piece.ly"
+\score {
+ \keepWithTag #'vn2 \music
+ \layout { }
+}
+
+
+%%%%% vla.ly
+\version "2.4.0"
+\include "piece.ly"
+\score {
+ \keepWithTag #'vla \music
+ \layout { }
+}
+
+
+%%%%% vlc.ly
+\version "2.4.0"
+\include "piece.ly"
+\score {
+ \keepWithTag #'vlc \music
+ \layout { }
+}
+@end verbatim
+
@node Vocal ensembles
@section Vocal ensembles
always the same for all parts.
@lilypond[quote,verbatim,raggedright]
-\version "2.3.22"
+\version "2.4.0"
global = {
\key c \major
\time 4/4
@end lilypond
+@subsection SATB vocal score and automatic piano reduction
+
+This template adds an automatic piano reduction to the SATB vocal
+score. This demonstrates one of the strengths of LilyPond -- you
+can use a music definition more than once. If you make any changes
+to the vocal notes (say, tenorMusic), then the changes will also
+apply to the piano reduction.
+
+@lilypond[quote,verbatim,raggedright]
+\version "2.4.0"
+global = {
+ \key c \major
+ \time 4/4
+}
+
+sopMusic = \relative c'' {
+ c4 c c8[( b)] c4
+}
+sopWords = \lyricmode {
+ hi hi hi hi
+}
+
+altoMusic = \relative c' {
+ e4 f d e
+}
+altoWords =\lyricmode {
+ ha ha ha ha
+}
+
+tenorMusic = \relative c' {
+ g4 a f g
+}
+tenorWords = \lyricmode {
+ hu hu hu hu
+}
+bassMusic = \relative c {
+ c4 c g c
+}
+bassWords = \lyricmode {
+ ho ho ho ho
+}
+
+\layout {
+ \context {
+ % a little smaller so lyrics
+ % can be closer to the staff
+ \Staff
+ minimumVerticalExtent = #'(-3 . 3)
+ }
+}
+
+<<
+ \context ChoirStaff
+ <<
+ \context Lyrics = sopranos { s1 }
+ \context Staff = women <<
+ \context Voice =
+ sopranos { \voiceOne << \global \sopMusic >> }
+ \context Voice =
+ altos { \voiceTwo << \global \altoMusic >> }
+ >>
+ \context Lyrics = altos { s1 }
+ \context Lyrics = tenors { s1 }
+ \context Staff = men <<
+ \clef bass
+ \context Voice =
+ tenors { \voiceOne <<\global \tenorMusic >> }
+ \context Voice =
+ basses { \voiceTwo <<\global \bassMusic >> }
+ >>
+ \context Lyrics = basses { s1 }
+ \context Lyrics = sopranos \lyricsto sopranos \sopWords
+ \context Lyrics = altos \lyricsto altos \altoWords
+ \context Lyrics = tenors \lyricsto tenors \tenorWords
+ \context Lyrics = basses \lyricsto basses \bassWords
+ >>
+ \new PianoStaff
+ <<
+ \new Staff <<
+ \set Staff.printPartCombineTexts = ##f
+ \partcombine
+ << \global \sopMusic >>
+ << \global \altoMusic >>
+ >>
+ \new Staff <<
+ \clef bass
+ \set Staff.printPartCombineTexts = ##f
+ \partcombine
+ << \global \tenorMusic >>
+ << \global \bassMusic >>
+ >>
+ >>
+>>
+@end lilypond
+
+
@c bad node name to avoid node name confict
@node Ancient notation templates
@section Ancient notation templates
staves rather than on the staves.
@lilypond[quote,verbatim,linewidth=11.0\cm]
-\version "2.3.22"
+\version "2.4.0"
global = {
+ \set Score.skipBars = ##t
+
% incipit
\once \override Score.SystemStartBracket #'transparent = ##t
+ \override Score.SpacingSpanner #'spacing-increment = #1.0 % tight spacing
\key f \major
\time 2/2
\once \override Staff.TimeSignature #'style = #'neomensural
\bar ""
% main
+ \revert Score.SpacingSpanner #'spacing-increment % CHECK: no effect?
\cadenzaOff % turn bar lines on again
\once \override Staff.Clef #'full-size-change = ##t
\set Staff.forceClef = ##t
\set Staff.printKeyCancellation = ##t
\set Staff.forceClef = ##f
- \skip 1*5
-
- % last bar contains a brevis (i.e., spans 2 bars);
- % therefore do not draw this particular bar
- \cadenzaOn
- \skip 1*2
- \cadenzaOff
+ \skip 1*7 % the actual music
% let finis bar go through all staves
\override Staff.BarLine #'transparent = ##f
@c The `linewidth' argument is for the \header.
@lilypond[quote,verbatim,raggedright,linewidth]
-\version "2.3.22"
+\version "2.4.0"
\header {
title = "Song"
subtitle = "(tune)"
@ The `linewidth' is for \header.
@lilypond[quote,verbatim,raggedright,linewidth]
-\version "2.3.22"
+\version "2.4.0"
\header {
dedication = "dedication"
title = "Title"
composer = "Composer (xxxx-yyyy)"
opus = "Opus 0"
piece = "Piece I"
+ meter = "meter"
instrument = "Instrument"
arranger = "Arranger"
poet = "Poet"
(@code{taor}, @code{grip}, @code{thrd}, etc), which can be reused easily.
@c TODO - replace Bagpipe template with Andrew McNabb's work?
+@c http://www.mcnabbs.org/andrew/linux/lilypond-ghb/
@lilypond[quote,verbatim]
taor = { \grace { g32[ d' g e'] } }
@section Lilypond-book templates
These templates are for use with @code{lilypond-book}. If you're not familiar
-with this program, please refer to @ref{Integrating text and music}.
+with this program, please refer to @ref{LilyPond-book}.
@subsection LaTeX