![]() |
GNU LilyPond-- -- |
||||||||||
|
A melody with chordsIn this section we show how to typeset a melody with chord
accompaniment. This file is included as \include "paper16.ly" melody = \notes \relative c' { \partial 8 \key c \minor g8 | c4 c8 d es-[ -( d-]-) c4 | f4 f8 g es-[-( d-)-] c g | c4 c8 d es-[ -( d-]-) c4 | d4 es8 d c4. \bar "|." } accompaniment =\chords { r8 c2:3- f:3-.7 d:min es4 c8:min r8 c2:min f:min7 g:7^3.5 c:min } \score { \simultaneous { %\accompaniment \context ChordNames \accompaniment \context Staff = mel { \melody } } \midi { \tempo 4=72 } \paper { linewidth = 10.0\cm } } The result would look this. We will dissect this file line by line. \include "paper16.ly"Smaller size (suitable for inclusion in a book). melody = \notes \relative c' {The structure of the file will be the same as the previous one: a \score block with music in it. To keep things readable, we will
give different names to the different parts of music, and use the names
to construct the music within the score block.
\partial 8 The piece starts with an anacrusis (or "pickup") of one eighth. c4 c8 d [es () d] c4 | f4 f8 g [es() d] c g | c4 c8 d [es () d] c4 | d4 es8 d c4. \bar "|." We use explicit beaming. Since this is a song, we turn automatic beams off and use explicit beaming where needed. }This ends the definition of melody .
text = \lyrics {This defines the lyrics, similar to what we have seen before. accompaniment =\chords {We'll put chords over the music. To enter them, we use a special mode analogous to \lyrics and \notes mode, where you can give
the names of the chords you want instead of listing the notes
comprising the chord.
r8There is no accompaniment during the anacrusis. c2:3- This is a c minor chord, lasting for a half note. Chords are entered using
the tonic. Notes can be changed to create different chords. In this case,
a lowered third is used (making a C major chord into a C minor chord).
The code for this is f:3-.7Similarly, 7 modifies (adds) a seventh, which is small by
default to create the f a c es chord. Multiple modifiers must be
separated by dots.
d:min es4 c8:min r8Some modifiers have predefined names, e.g. min is the same as
3- , so d-min is a minor d chord.
c2:min f:min7 g:7^3.5 c:min } A named modifier \score { \simultaneous {We assemble the music in the \score block. Melody, lyrics and
accompaniment have to sound at the same time, so they should be
\simultaneous .
%\accompanimentChord mode generates notes grouped in \simultaneous music. If
you remove the comment sign, you can see the chords in normal
notation: they will be printed as note heads on a separate
staff. To print them as chords names, they have to be interpreted as
being chords, not notes. This is done with the following command:
\context ChordNames \accompaniment Normally the notes that you enter are transformed into note heads. Note heads alone make no sense, so they need surrounding information: a key signature, a clef, staff lines, etc. They need context. In LilyPond, these symbols are created by objects called `interpretation contexts'. Interpretation contexts exist for generating notation (`notation context') and for generating sound (`performance context'). These objects only exist while LilyPond is executing. When LilyPond interprets music, it will create a Staff context. If
the We don't want that default here, because we want chord names. The
command above explicitly creates an interpretation context of
\context Staff = mel { We place the melody on a staff called \property Staff.autoBeaming = ##fAn interpretation context has variables, called properties, that tune its behavior. One of the variables is autoBeaming . Setting
this Staff 's property to ##f , which is the boolean value
false, turns the automatic beaming mechanism off for the current
staff.
\melody }Finally, we put the melody on the current staff. Note that the \property directives and \melody are grouped in sequential
music, so the property settings are done before the melody is
processed.
\midi { \tempo 4=72}MIDI (Musical Instrument Digital Interface) is a standard for connecting and recording digital instruments. So a MIDI file is like a tape recording of an instrument. The \midi block makes the
music go to a MIDI file, so you can listen to the music you entered. It
is great for checking the music. Whenever you hear something weird, you
probably hear a typing error.
Syntactically, \paper { linewidth = 10.0\cm }We also want notation output. The linewidth is short so that the piece will be set in two lines. |
||||||||||
Go back to index of LilyPond.
Please send GNU LilyPond questions and comments to lilypond-user@gnu.org. Please send comments on these web pages to (address unknown) Copyright (c) 1997--2002 Han-Wen Nienhuys and Jan Nieuwenhuizen. Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved. |
This page was built from LilyPond-1.7.14 (development-branch) by