### 3.1.2 Score is a (single) compound musical expression

We saw the general organization of LilyPond input files in the previous section, Introduction to the LilyPond file structure. But we seemed to skip over the most important part: how do we figure out what to write after \score?

We didn’t skip over it at all. The big mystery is simply that there is no mystery. This line explains it all:

A \score block must begin with a compound music expression.

To understand what is meant by a music expression and a compound music expression, you may find it useful to review the tutorial, Music expressions explained. In that section, we saw how to build big music expressions from small pieces – we started from notes, then chords, etc. Now we’re going to start from a big music expression and work our way down.

\score {
{ % this brace begins the overall compound music expression
\new StaffGroup <<
...insert the whole score of a Wagner opera in here...
>>
} % this brace ends the overall compound music expression
\layout { }
}


A whole Wagner opera would easily double the length of this manual, so let’s just add a singer and piano. We don’t need a StaffGroup for this ensemble, which simply groups a number of staves together with a bracket at the left, so we shall remove it. We do need a singer and a piano, though.

\score {
<<
\new Staff = "singer" <<
>>
\new PianoStaff = "piano" <<
>>
>>
\layout { }
}


Remember that we use << ... >> instead of { ... } to show simultaneous music. And we definitely want to show the vocal part and piano part at the same time, not one after the other! Note that the << ... >> construct is not really necessary for the Singer staff, as it contains only one sequential music expression; however, using << ... >> instead of braces is still necessary if the music in the Staff is made of two simultaneous expressions, e.g. two simultaneous Voices, or a Voice with lyrics. We’ll add some real music later; for now let’s just put in some dummy notes and lyrics.

\score {
<<
\new Staff = "singer" <<
\new Voice = "vocal" { c'1 }
>>
\new PianoStaff = "piano" <<
\new Staff = "upper" { c'1 }
\new Staff = "lower" { c'1 }
>>
>>
\layout { }
}


Now we have a lot more details. We have the singer’s staff: it contains a Voice (in LilyPond, this term refers to a set of notes, not necessarily vocal notes – for example, a violin generally plays one voice) and some lyrics. We also have a piano staff: it contains an upper staff (right hand) and a lower staff (left hand).

At this stage, we could start filling in notes. Inside the curly braces next to \new Voice = "vocal", we could start writing

\relative c'' {
r4 d8\noBeam g, c4 r
}


But if we did that, the \score section would get pretty long, and it would be harder to understand what was happening. So let’s use variables instead. These were introduced at the end of the previous section, remember? So, adding a few notes, we now have a piece of real music:

melody = \relative c'' { r4 d8\noBeam g, c4 r }
text   = \lyricmode { And God said, }
upper  = \relative c'' { <g d g,>2~ <g d g,> }
lower  = \relative c { b2 e2 }

\score {
<<
\new Staff = "singer" <<
\new Voice = "vocal" { \melody }
>>
\new PianoStaff = "piano" <<
\new Staff = "upper" { \upper }
\new Staff = "lower" {
\clef "bass"
\lower
}
>>
>>
\layout { }
}


Be careful about the difference between notes, which are introduced with \relative or which are directly included in a music expression, and lyrics, which are introduced with \lyricmode. These are essential to tell LilyPond to interpret the following content as music and text respectively.

When writing (or reading) a \score section, just take it slowly and carefully. Start with the outer level, then work on each smaller level. It also really helps to be strict with indentation – make sure that each item on the same level starts on the same horizontal position in your text editor.