Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
Chapter 3: Fundamental concepts 76<br />
3.4.3 Building a score from scratch<br />
After gaining some facility with writing <strong>LilyPond</strong> code, you may find that it is easier to build a<br />
score from scratch rather than modifying one of the templates. You can also develop your own<br />
style this way to suit the sort of music you like. Let’s see how to put together the score for an<br />
organ prelude as an example.<br />
We begin with a header section. Here go the title, name of composer, etc, then come any<br />
variable definitions, and finally the score block. Let’s start with these in outline and fill in the<br />
details later.<br />
We’ll use the first two bars of Bach’s prelude based on Jesu, meine Freude which is written<br />
for two manuals and pedal organ. You can see these two bars of music at the bottom of this<br />
section. The top manual part has two voices, the lower and pedal organ one each. So we need<br />
four music definitions and one to define the time signature and key:<br />
\version "2.12.3"<br />
\header {<br />
title = "Jesu, meine Freude"<br />
composer = "J S Bach"<br />
}<br />
TimeKey = { \time 4/4 \key c \minor }<br />
ManualOneVoiceOneMusic = {s1}<br />
ManualOneVoiceTwoMusic = {s1}<br />
ManualTwoMusic = {s1}<br />
PedalOrganMusic = {s1}<br />
\score {<br />
}<br />
For now we’ve just used a spacer note, s1, instead of the real music. We’ll add that later.<br />
Next let’s see what should go in the score block. We simply mirror the staff structure we<br />
want. Organ music is usually written on three staves, one for each manual and one for the<br />
pedals. The manual staves should be bracketed together, so we need to use a PianoStaff for<br />
them. The first manual part needs two voices and the second manual part just one.<br />
\new PianoStaff % end ManualOne Staff context<br />
\new Staff = "ManualTwo" > % end ManualTwo Staff context<br />
>> % end PianoStaff context<br />
Next we need to add a staff for the pedal organ. This goes underneath the PianoStaff, but<br />
it must be simultaneous with it, so we need angle brackets around the two. Missing these out<br />
would generate an error in the log file. It’s a common mistake which you’ll make sooner or<br />
later! Try copying the final example at the end of this section, remove these angle brackets, and<br />
compile it to see what errors it generates.<br />