Next: Vocal ensembles, Previous: Piano templates, Up: Example templates
This template demonstrates a string quartet. It also uses a \global
section for time and key signatures.
\version "2.7.39"
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 "|."}}
\score {
\new StaffGroup <<
\new Staff << \global \violinOne >>
\new Staff << \global \violinTwo >>
\new Staff << \global \viola >>
\new Staff << \global \cello >>
>>
\layout { }
\midi { \tempo 4=60}
}
The previous example produces a nice string quartet, but what if you
needed to print parts? This template demonstrates how to use the
\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. piece.ly
contains all the music definitions. The other files – score.ly,
vn1.ly, vn2.ly, vla.ly, and
vlc.ly – produce the appropiate part.
%%%%% piece.ly
\version "2.7.39"
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 \tag #'vn1 \new Staff { << \global \Violinone >> }
\tag #'score \tag #'vn2 \new Staff { << \global \Violintwo>> }
\tag #'score \tag #'vla \new Staff { << \global \Viola>> }
\tag #'score \tag #'vlc \new Staff { << \global \Cello>> }
>>
}
%%%%% score.ly
\version "2.7.39"
\include "piece.ly"
#(set-global-staff-size 14)
\score {
\new StaffGroup \keepWithTag #'score \music
\layout { }
\midi { \tempo 4 = 60 }
}
%%%%% vn1.ly
\version "2.7.39"
\include "piece.ly"
\score {
\keepWithTag #'vn1 \music
\layout { }
}
%%%%% vn2.ly
\version "2.7.39"
\include "piece.ly"
\score {
\keepWithTag #'vn2 \music
\layout { }
}
%%%%% vla.ly
\version "2.7.39"
\include "piece.ly"
\score {
\keepWithTag #'vla \music
\layout { }
}
%%%%% vlc.ly
\version "2.7.39"
\include "piece.ly"
\score {
\keepWithTag #'vlc \music
\layout { }
}
This page is for LilyPond-2.8.8 (stable-branch).