29.11.2012 Views

mpdolce - LilyPond

mpdolce - LilyPond

mpdolce - LilyPond

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 3: Fundamental concepts 69<br />

3.4.1 Soprano and cello<br />

Start off with the template that seems closest to what you want to end up with. Let’s say that<br />

you want to write something for soprano and cello. In this case, we would start with ‘Notes and<br />

lyrics’ (for the soprano part).<br />

\version "2.12.3"<br />

melody = \relative c' {<br />

\clef treble<br />

\key c \major<br />

\time 4/4<br />

a4 b c d<br />

}<br />

text = \lyricmode {<br />

Aaa Bee Cee Dee<br />

}<br />

\score {<br />

><br />

\layout { }<br />

\midi { }<br />

}<br />

Now we want to add a cello part. Let’s look at the ‘Notes only’ example:<br />

\version "2.12.3"<br />

melody = \relative c' {<br />

\clef treble<br />

\key c \major<br />

\time 4/4<br />

a4 b c d<br />

}<br />

\score {<br />

\new Staff \melody<br />

\layout { }<br />

\midi { }<br />

}<br />

We don’t need two \version commands. We’ll need the melody section. We don’t want two<br />

\score sections – if we had two \scores, we’d get the two parts separately. We want them<br />

together, as a duet. Within the \score section, we don’t need two \layout or \midi.<br />

If we simply cut and paste the melody section, we would end up with two melody definitions.<br />

This would not generate an error, but the second one would be used for both melodies. So<br />

let’s rename them to make them distinct. We’ll call the section for the soprano sopranoMusic<br />

and the section for the cello celloMusic. While we’re doing this, let’s rename text to be<br />

sopranoLyrics. Remember to rename both instances of all these names – both the initial<br />

definition (the melody = \relative c' { part) and the name’s use (in the \score section).

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!