Jump to content

User:Astronouth7303/LilyPond

From Wikipedia, the free encyclopedia

<music> % Theme to "Fire Breathers", a homebrew NES game under development. Composed % by Urpo Lankinen.

% Note: The composer has made available the following source code to % the Wikipedia article under GFDL license. Other versions of this song, % which are available outside Wikipedia and its GFDL-permitted % mirrors/derivants, are typically under CC BY-SA license.

% The version directive identifies the Lilypond syntax version. % This particular source file works in Lilypond 2.2.x. % Typically, there are large changes in syntax (usually for better!) % between the major releases. % The convert-ly program can be used to automatically transform the source % code to most recent version. \version "2.2.0"

% This library file makes Lilypond use the Finnish note names % (for example, where Americans use "F#" and "Bb", Finns use % "Fis" and "B"). Danish note names are used by default. Other % national conventions are supported! \include "suomi.ly"

% The header part is used to control the texts added to the final output. \header {

   title = "Theme to ``Fire Breathers!"
   instrument = "For the 2A03 or SID"
   composer = "Urpo Lankinen"
   enteredby = "Urpo Lankinen"
   date = "June 2004"

}

% Here is the main melody. The character | is used for a bar check; % it's also a convenient way to display where the bars are. As you can see, % the notes are simply entered with their real names, followed by number that % shows their length. The note can have ' or , in it, meaning a leap % of octave up or down. (This tune uses relative note entry mode, which % you can also explicitly note each note's octave, for example, % c' is middle C.) As expected, a period adds a . to the note. % Parentheses show start and end of slurs, brackets show start and end % of 8th-note beams. (The beaming can be done automatically too!) % Notes are tied with ~. The "r" note is a rest. (and "h" is "b" in English.)

Melody = \notes \relative c {

   \clef treble
   \time 3/4
   \key a \minor
   % The piece starts with a quarter-note partial bar, "\partial 4"
   % tells so to Lilypond.
   \partial 4
   a4 | e'4.( d8[ c]) r8 | d4.( c8[ h]) r8 | a2. | e2
   a4 | e'4.( d8[ c]) r8 | d4.( e8[ f]) r8 | e2. | r2
   e4 |  f4.( e8[ d]) r8 | d4.( c8[ h]) r8 | a2. | e2
   a4 | e'4.( d8[ c]) r8 | d4.( c8[ h]) r8 | a2. ~ a2 r4 | \bar "|."

}

% This is the second voice.

SecondVoice = \notes \relative c {

   \clef bass
   \time 3/4
   \key a \minor
   \partial 4
   r4 | e2.              | d2.             | a2. | e2
   a4 | e'2.             | d2       f4     | e2. | r2.
      |  f2.             | d2.             | a2. | e2
   a4 | e'2.             | d2       h4     | a2. ~ a2 r4 | \bar "|."

}


% And now for something really cool... % You can write a lot of different kinds of things easily - melodies, % lyrics, chords, everything. The interesting bit is that they can % always be *reused* elsewhere! Here, I define three different % accompaniment patterns, then use them throughout the accompaniment % melody.

AccompA = \notes \relative c { a4 e'8 a, e' a, | } AccompB = \notes \relative c { g4 d'8 g, d' g, | } AccompC = \notes \relative c { e,4 h'8 e, h' e, | }

Accompaniment = \notes \relative c {

   \clef bass
   \time 3/4
   \key a \minor
   \partial 4
   r4 | \AccompA \AccompB \AccompA \AccompA
        \AccompA \AccompB \AccompA \AccompA
        \AccompC \AccompC \AccompA \AccompA
        \AccompA \AccompB \AccompA | a2 r4 | \bar "|."

}


% Finally, there is the score block. The score block is used to % define what is actually present in the composition, and how is it % going to be printed. Here, we define three simultaneous staffs, % for melody, accompaniment and the second voice. % The score will be printed on paper, without the first line getting indented % (since there is no instrument names, we don't want the space). % We also wish to produce a MIDI output, using metronome tempo of % 120 quarters per minute. (Note that this isn't noted anywhere on the % paper - you need separate commands to add that to the score.)

\score {

   <<
       \new Staff \Melody
       \new Staff \Accompaniment
       \new Staff \SecondVoice
   >>
   \paper { indent = 0 }
   \midi { \tempo 4 = 120 }

} </music>