Jump to content

Orchestra, choir and piano template: Difference between revisions

From LilyPond wiki
No edit summary
m Use `\book` for the sake of `lilypond-book`, otherwise staves get too much squeezed vertically.
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
This template demonstrates the use of nested <code>StaffGroup</code> and <code>GrandStaff</code> contexts to sub-group instruments of the same type together, and a way to use <code>\transpose</code> so that variables hold music for transposing instruments at concert pitch.
This template demonstrates the use of nested <code>StaffGroup</code> and <code>GrandStaff</code> contexts to sub-group instruments of the same type together, and a way to use <code>\transpose</code> so that variables hold music for transposing instruments at concert pitch.


<lilypond version="2.24" full>
<lilypond version="2.24">
#(set-global-staff-size 17)
#(set-global-staff-size 17)


Line 8: Line 8:
   short-indent = 1.5\cm  % add less space for shortInstrumentName
   short-indent = 1.5\cm  % add less space for shortInstrumentName
}
}
\header { tagline = ##f }


fluteMusic = \relative c' { \key g \major g'1 b }
fluteMusic = \relative c' { \key g \major g'1 b }
Line 16: Line 13:
% Pitches as written on a manuscript for Clarinet in A
% Pitches as written on a manuscript for Clarinet in A
% are transposed to concert pitch.
% are transposed to concert pitch.
clarinetMusic = \transpose c' a
clarinetMusic = \transpose c' a
   \relative c'' { \key bes \major bes1 d }
   \relative c'' { \key bes \major bes1 d }
Line 23: Line 19:


% Key signature is often omitted for horns
% Key signature is often omitted for horns
hornMusic = \transpose c' f
hornMusic = \transpose c' f
   \relative c { d'1 fis }
   \relative c { d'1 fis }
Line 30: Line 25:


sopranoMusic = \relative c'' { \key g \major g'1 b }
sopranoMusic = \relative c'' { \key g \major g'1 b }
sopranoLyrics = \lyricmode { Lyr -- ics }
sopranoLyrics = \lyricmode { Lyr -- ics }


altoIMusic = \relative c' { \key g \major g'1 b }
altoIMusic = \relative c' { \key g \major g'1 b }
 
altoILyrics = \sopranoLyrics
altoIIMusic = \relative c' { \key g \major g'1 b }
altoIIMusic = \relative c' { \key g \major g'1 b }
altoILyrics =  \sopranoLyrics
altoIILyrics = \lyricmode { Ah -- ah }
altoIILyrics = \lyricmode { Ah -- ah }


tenorMusic = \relative c' { \clef "treble_8" \key g \major g1 b }
tenorMusic = \relative c' { \clef "treble_8" \key g \major g1 b }
tenorLyrics = \sopranoLyrics
tenorLyrics = \sopranoLyrics


pianoRHMusic = \relative c { \key g \major g''1 b }
pianoRHMusic = \relative c { \key g \major g''1 b }
pianoLHMusic = \relative c { \clef bass \key g \major g1 b }
pianoLHMusic = \relative c { \clef bass \key g \major g1 b }


violinIMusic = \relative c' { \key g \major g'1 b }
violinIMusic = \relative c' { \key g \major g'1 b }
violinIIMusic = \relative c' { \key g \major g'1 b }
violinIIMusic = \relative c' { \key g \major g'1 b }


Line 59: Line 47:
bassMusic = \relative c { \clef "bass_8" \key g \major g,1 b }
bassMusic = \relative c { \clef "bass_8" \key g \major g,1 b }


\score {
\book {
  <<
  \score {
    \new StaffGroup = "StaffGroup_woodwinds" <<
    <<
      \new Staff = "Staff_flute" \with { instrumentName = "Flute" }
      \new StaffGroup = "StaffGroup_woodwinds" <<
      \fluteMusic
        \new Staff = "Staff_flute" \with { instrumentName = "Flute" }
          \fluteMusic


      \new Staff = "Staff_clarinet" \with {
        \new Staff = "Staff_clarinet" \with {
        instrumentName = \markup { \concat { "Clarinet in B" \flat } }
          instrumentName = \markup { \concat { "Clarinet in B" \flat } }
      }
        }
          % Declare that written Middle C in the music
          % to follow sounds a concert B flat, for
          % output using sounded pitches such as MIDI.
          %\transposition bes


      % Declare that written Middle C in the music
          % Print music for a B-flat clarinet
      % to follow sounds a concert B flat, for
          \transpose bes c' \clarinetMusic
      % output using sounded pitches such as MIDI.
       >>
       %\transposition bes


       % Print music for a B-flat clarinet
       \new StaffGroup = "StaffGroup_brass" <<
      \transpose bes c' \clarinetMusic
        \new Staff = "Staff_hornI" \with {
    >>
          instrumentName = "Horn in F"
        }
          % \transposition f
          \transpose f c' \hornMusic


    \new StaffGroup = "StaffGroup_brass" <<
        \new Staff = "Staff_trumpet" \with {
      \new Staff = "Staff_hornI" \with { instrumentName = "Horn in F" }
          instrumentName = "Trumpet in C"
      % \transposition f
        }
        \transpose f c' \hornMusic
          \trumpetMusic
      >>


       \new Staff = "Staff_trumpet" \with { instrumentName = "Trumpet in  C" }
       \new RhythmicStaff = "RhythmicStaff_percussion" \with {
      \trumpetMusic
        instrumentName = "Percussion"
      }
        \percussionMusic


    >>
       \new PianoStaff \with {
    \new RhythmicStaff = "RhythmicStaff_percussion"
        instrumentName = "Piano"
    \with { instrumentName = "Percussion" }
      } <<
    <<
        \new Staff { \pianoRHMusic }
       \percussionMusic
        \new Staff { \pianoLHMusic }
    >>
      >>
    \new PianoStaff \with { instrumentName = "Piano" }
    <<
      \new Staff { \pianoRHMusic }
      \new Staff { \pianoLHMusic }
    >>
    \new ChoirStaff = "ChoirStaff_choir" <<
      \new Staff = "Staff_soprano" \with { instrumentName = "Soprano" }
      \new Voice = "soprano"
      \sopranoMusic


       \new Lyrics \lyricsto "soprano" { \sopranoLyrics }
       \new ChoirStaff = "ChoirStaff_choir" <<
      \new GrandStaff = "GrandStaff_altos"
         \new Staff = "Staff_soprano" \with {
      \with { \accepts Lyrics } <<
          instrumentName = "Soprano"
         \new Staff = "Staff_altoI" \with { instrumentName = "Alto I" }
        }
        \new Voice = "altoI"
          \new Voice = "soprano" \sopranoMusic
        \altoIMusic
          \new Lyrics \lyricsto "soprano" { \sopranoLyrics }


         \new Lyrics \lyricsto "altoI" { \altoILyrics }
         \new GrandStaff = "GrandStaff_altos" \with {
        \new Staff = "Staff_altoII" \with { instrumentName = "Alto II" }
          \accepts Lyrics
        \new Voice = "altoII"
        } <<
        \altoIIMusic
          \new Staff = "Staff_altoI" \with {
            instrumentName = "Alto I"
          }
            \new Voice = "altoI"
            \altoIMusic
            \new Lyrics \lyricsto "altoI" { \altoILyrics }
          \new Staff = "Staff_altoII" \with {
            instrumentName = "Alto II"
          }
            \new Voice = "altoII"
            \altoIIMusic
            \new Lyrics \lyricsto "altoII" { \altoIILyrics }
        >>


         \new Lyrics \lyricsto "altoII" { \altoIILyrics }
         \new Staff = "Staff_tenor" \with {
          instrumentName = "Tenor"
        }
          \new Voice = "tenor" \tenorMusic
          \new Lyrics \lyricsto "tenor" { \tenorLyrics }
       >>
       >>


       \new Staff = "Staff_tenor" \with { instrumentName = "Tenor" }
       \new StaffGroup = "StaffGroup_strings" <<
         \new Voice = "tenor"
        \new GrandStaff = "GrandStaff_violins" <<
         \tenorMusic
          \new Staff = "Staff_violinI" \with {
            instrumentName = "Violin I"
          }
            \violinIMusic
          \new Staff = "Staff_violinII" \with {
            instrumentName = "Violin II"
          }
            \violinIIMusic
        >>
 
         \new Staff = "Staff_viola" \with {
          instrumentName = "Viola"
         }
          \violaMusic


      \new Lyrics \lyricsto "tenor" { \tenorLyrics }
         \new Staff = "Staff_cello" \with {
    >>
          instrumentName = "Cello"
    \new StaffGroup = "StaffGroup_strings" <<
        }
      \new GrandStaff = "GrandStaff_violins" <<
          \celloMusic
         \new Staff = "Staff_violinI" \with { instrumentName = "Violin I" }
        \violinIMusic


         \new Staff = "Staff_violinII" \with { instrumentName = "Violin II" }
         \new Staff = "Staff_bass" \with {
        \violinIIMusic
          instrumentName = "Double Bass"
        }
          \bassMusic
       >>
       >>
      \new Staff = "Staff_viola" \with { instrumentName = "Viola" }
      \violaMusic
      \new Staff = "Staff_cello" \with { instrumentName = "Cello" }
      \celloMusic
      \new Staff = "Staff_bass" \with { instrumentName = "Double Bass" }
      \bassMusic
     >>
     >>
   >>
   }
  \layout { }
}
}
</lilypond>
</lilypond>
Line 150: Line 158:
[[Category:Template]]
[[Category:Template]]
[[Category:Pitches]]
[[Category:Pitches]]
[[Category:Included in the official documentation]][[Category:Snippet]]
[[Category:Included in the official documentation]]
[[Category:Snippet]]

Latest revision as of 22:12, 7 December 2025

This template demonstrates the use of nested StaffGroup and GrandStaff contexts to sub-group instruments of the same type together, and a way to use \transpose so that variables hold music for transposing instruments at concert pitch.

\version "2.24"

#(set-global-staff-size 17)

\paper {
  indent = 3.0\cm  % add space for instrumentName
  short-indent = 1.5\cm  % add less space for shortInstrumentName
}

fluteMusic = \relative c' { \key g \major g'1 b }

% Pitches as written on a manuscript for Clarinet in A
% are transposed to concert pitch.
clarinetMusic = \transpose c' a
  \relative c'' { \key bes \major bes1 d }

trumpetMusic = \relative c { \key g \major g''1 b }

% Key signature is often omitted for horns
hornMusic = \transpose c' f
  \relative c { d'1 fis }

percussionMusic = \relative c { \key g \major g1 b }

sopranoMusic = \relative c'' { \key g \major g'1 b }
sopranoLyrics = \lyricmode { Lyr -- ics }

altoIMusic = \relative c' { \key g \major g'1 b }
altoILyrics = \sopranoLyrics
altoIIMusic = \relative c' { \key g \major g'1 b }
altoIILyrics = \lyricmode { Ah -- ah }

tenorMusic = \relative c' { \clef "treble_8" \key g \major g1 b }
tenorLyrics = \sopranoLyrics

pianoRHMusic = \relative c { \key g \major g''1 b }
pianoLHMusic = \relative c { \clef bass \key g \major g1 b }

violinIMusic = \relative c' { \key g \major g'1 b }
violinIIMusic = \relative c' { \key g \major g'1 b }

violaMusic = \relative c { \clef alto \key g \major g'1 b }

celloMusic = \relative c { \clef bass \key g \major g1 b }

bassMusic = \relative c { \clef "bass_8" \key g \major g,1 b }

\book {
  \score {
    <<
      \new StaffGroup = "StaffGroup_woodwinds" <<
        \new Staff = "Staff_flute" \with { instrumentName = "Flute" }
          \fluteMusic

        \new Staff = "Staff_clarinet" \with {
          instrumentName = \markup { \concat { "Clarinet in B" \flat } }
        }
          % Declare that written Middle C in the music
          % to follow sounds a concert B flat, for
          % output using sounded pitches such as MIDI.
          %\transposition bes

          % Print music for a B-flat clarinet
          \transpose bes c' \clarinetMusic
      >>

      \new StaffGroup = "StaffGroup_brass" <<
        \new Staff = "Staff_hornI" \with {
          instrumentName = "Horn in F"
        }
          % \transposition f
          \transpose f c' \hornMusic

        \new Staff = "Staff_trumpet" \with {
          instrumentName = "Trumpet in  C"
        }
          \trumpetMusic
      >>

      \new RhythmicStaff = "RhythmicStaff_percussion" \with {
        instrumentName = "Percussion"
      }
        \percussionMusic

      \new PianoStaff \with {
        instrumentName = "Piano"
      } <<
        \new Staff { \pianoRHMusic }
        \new Staff { \pianoLHMusic }
      >>

      \new ChoirStaff = "ChoirStaff_choir" <<
        \new Staff = "Staff_soprano" \with {
          instrumentName = "Soprano"
        }
          \new Voice = "soprano" \sopranoMusic
          \new Lyrics \lyricsto "soprano" { \sopranoLyrics }

        \new GrandStaff = "GrandStaff_altos" \with {
          \accepts Lyrics
        } <<
          \new Staff = "Staff_altoI" \with {
            instrumentName = "Alto I"
          }
            \new Voice = "altoI"
            \altoIMusic
            \new Lyrics \lyricsto "altoI" { \altoILyrics }
          \new Staff = "Staff_altoII" \with {
            instrumentName = "Alto II"
          }
            \new Voice = "altoII"
            \altoIIMusic
            \new Lyrics \lyricsto "altoII" { \altoIILyrics }
        >>

        \new Staff = "Staff_tenor" \with {
          instrumentName = "Tenor"
        }
          \new Voice = "tenor" \tenorMusic
          \new Lyrics \lyricsto "tenor" { \tenorLyrics }
      >>

      \new StaffGroup = "StaffGroup_strings" <<
        \new GrandStaff = "GrandStaff_violins" <<
          \new Staff = "Staff_violinI" \with {
            instrumentName = "Violin I"
          }
            \violinIMusic
          \new Staff = "Staff_violinII" \with {
            instrumentName = "Violin II"
          }
            \violinIIMusic
        >>

        \new Staff = "Staff_viola" \with {
          instrumentName = "Viola"
        }
          \violaMusic

        \new Staff = "Staff_cello" \with {
          instrumentName = "Cello"
        }
          \celloMusic

        \new Staff = "Staff_bass" \with {
          instrumentName = "Double Bass"
        }
          \bassMusic
      >>
    >>
  }
}