This file documents GNU LilyPond.
Copyright 1999–2004 by the authors
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections. A copy of the license is included in the section entitled “GNU Free Documentation License”.
This is the user manual for GNU LilyPond 2.5.x series. (See the bottom of this page for the exact version number).
A further source of information is the website, which can be found at http://www.lilypond.org/. The website contains on-line copies of this and other documentation.
We want to dedicate this program to all the friends that we met through music.Han-Wen and Jan
It must have been during a rehearsal of the EJE (Eindhoven Youth Orchestra), somewhere in 1995 that Jan, one of the cranked violists told Han-Wen, one of the distorted French horn players, about the grand new project he was working on. It was an automated system for printing music (to be precise, it was MPP, a preprocessor for MusiXTeX). As it happened, Han-Wen accidentally wanted to print out some parts from a score, so he started looking at the software, and he quickly got hooked. It was decided that MPP was a dead end. After lots of philosophizing and heated email exchanges Han-Wen started LilyPond in 1996. This time, Jan got sucked into Han-Wen's new project.
In some ways, developing a computer program is like learning to play an instrument. In the beginning, discovering how it works is fun, and the things you cannot do are challenging. After the initial excitement, you have to practice and practice. Scales and studies can be dull, and if you are not motivated by others—teachers, conductors or audience—it is very tempting to give up. You continue, and gradually playing becomes a part of your life. Some days it comes naturally, and it is wonderful, and on some days it just does not work, but you keep playing, day after day.
Like making music, working on LilyPond can be dull work, and on some days it feels like plodding through a morass of bugs. Nevertheless, it has become a part of our life, and we keep doing it. Probably the most important motivation is that our program actually does something useful for people. When we browse around the net we find many people that use LilyPond, and produce impressive pieces of sheet music. Seeing that feels unreal, but in a very pleasant way.
Our users not only give us good vibes by using our program, many of them also help us by giving suggestions and sending bug reports, so we would like to thank all users that sent us bug reports, gave suggestions or contributed in any other way to LilyPond.
Playing and printing music is more than nice analogy. Programming together is a lot of fun, and helping people is deeply satisfying, but ultimately, working on LilyPond is a way to express our deep love for music. May it help you create lots of beautiful music!
Han-Wen and Jan
Utrecht/Eindhoven, The Netherlands, July 2002.
The most important developments in 2.4 are related. In LilyPond 2.4 TeX is no longer strictly necessary to engrave music. This is because LilyPond can now also layout pages and determine page breaks. Another notable feature is the syntax, which has been simplified even further compared to previous versions.
Special thanks for go to Lisa Opus Goldstein, who gave us many valuable suggestions for improving the manual.
Han-Wen and Jan
Utrecht/Eindhoven, The Netherlands, September 2004.
The art of music typography is called (plate) engraving. The term derives from the traditional process of music printing. Just a few decades ago, sheet music was made by cutting and stamping the music into a zinc or pewter plate in mirror image. The plate would be inked, the depressions caused by the cutting and stamping would hold ink. An image was formed by pressing paper to the plate. The stamping and cutting was completely done by hand. Making a correction was cumbersome, if possible at all, so the engraving had to be perfect in one go. Engraving was a highly specialized skill; a craftsman had to complete around five years of training before earning the title of master engraver, and another five years of experience were necessary to become truly skilled.
Nowadays, all newly printed music is produced with computers. This has obvious advantages; prints are cheaper to make, and editorial work can be delivered by email. Unfortunately, the pervasive use of computers has also decreased the graphical quality of scores. Computer printouts have a bland, mechanical look, which makes them unpleasant to play from.
The images below illustrate the difference between traditional engraving and typical computer output, and the third picture shows how LilyPond mimics the traditional look. The left picture shows a scan of a flat symbol from a Henle edition published in 2000. The center depicts a symbol from a hand-engraved Bärenreiter edition of the same music. The left scan illustrates typical flaws of computer print: the staff lines are thin, the weight of the flat symbol matches the light lines and it has a straight layout with sharp corners. By contrast, the Bärenreiter flat has a bold, almost voluptuous rounded look. Our flat symbol is designed after, among others, this one. It is rounded, and its weight harmonizes with the thickness of our staff lines, which are also much thicker than Henle's lines.
|
|
| |
| Henle (2000) | Bärenreiter (1950) |
LilyPond Feta font (2003)
|
In spacing, the distribution of space should reflect the durations between notes. However, many modern scores adhere to the durations with mathematical precision, which leads to poor results. In the next example a motive is printed twice. It is printed once using exact mathematical spacing, and once with corrections. Can you spot which fragment is which?
The fragment only uses quarter notes: notes that are played in a constant rhythm. The spacing should reflect that. Unfortunately, the eye deceives us a little; not only does it notice the distance between note heads, it also takes into account the distance between consecutive stems. As a result, the notes of an up-stem/down-stem combination should be put farther apart, and the notes of a down-up combination should be put closer together, all depending on the combined vertical positions of the notes. The first two measures are printed with this correction, the last two measures without. The notes in the last two measures form down-stem/up-stem clumps of notes.
Musicians are usually more absorbed with performing than with studying the looks of piece of music, so nitpicking about typographical details may seem academical. But it is not. In larger pieces with monotonous rhythms, spacing corrections lead to subtle variations in the layout of every line, giving each one a distinct visual signature. Without this signature all lines would look the same, and they become like a labyrinth. If a musician looks away once or has a lapse in concentration, they might lose their place on the page.
Similarly, the strong visual look of bold symbols on heavy staff lines stands out better when music is far away from reader, for example, if it is on a music stand. A careful distribution of white space allows music to be set very tightly without cluttering symbols together. The result minimizes the number of page turns, which is a great advantage.
This is a common characteristic of typography. Layout should be pretty, not only for its own sake, but especially because it helps the reader in her task. For performance material like sheet music, this is of double importance: musicians have a limited amount of attention. The less attention they need for reading, the more they can focus on playing itself. In other words, better typography translates to better performances.
These examples demonstrate that music typography is an art that is subtle and complex, and that producing it requires considerable expertise, which musicians usually do not have. LilyPond is our effort to bring the graphical excellence of hand-engraved music to the computer age, and make it available to normal musicians. We have tuned our algorithms, font-designs, and program settings to produce prints that match the quality of the old editions we love to see and love to play from.
How do we go about implementing typography? If craftsmen need over ten years to become true masters, how could we simple hackers ever write a program to take over their jobs?
The answer is: we cannot. Typography relies on human judgment of appearance, so people cannot be replaced completely. However, much of the dull work can be automated. If LilyPond solves most of the common situations correctly, this will be a huge improvement over existing software. The remaining cases can be tuned by hand. Over the course of years, the software can be refined to do more and more automatically, so manual overrides are less and less necessary.
When we started we wrote the LilyPond program entirely in the C++ programming language; the program's functionality was set in stone by the developers. That proved to be unsatisfactory for a number of reasons:
These problems have been addressed by integrating an interpreter for the Scheme programming language and rewriting parts of LilyPond in Scheme. The current formatting architecture is built around the notion of graphical objects, described by Scheme variables and functions. This architecture encompasses formatting rules, typographical style and individual formatting decisions. The user has direct access to most of these controls.
Scheme variables control layout decisions. For example, many graphical objects have a direction variable that encodes the choice between up and down (or left and right). Here you see two chords, with accents and arpeggio. In the first chord, the graphical objects have all directions down (or left). The second chord has all directions up (right).
The process of formatting a score consists of reading and writing the variables of graphical objects. Some variables have a preset value. For example, the thickness of many lines – a characteristic of typographical style – is a variable with a preset value. You are free to alter this value, giving your score a different typographical impression.
Formatting rules are also preset variables: each object has variables containing procedures. These procedures perform the actual formatting, and by substituting different ones, we can change the appearance of objects. In the following example, the rule which note head objects use to produce their symbol is changed during the music fragment.
The formatting process decides where to place symbols. However, this can only be done once it is decided what symbols should be printed, in other words what notation to use.
Common music notation is a system of recording music that has evolved over the past 1000 years. The form that is now in common use dates from the early renaissance. Although the basic form (i.e., note heads on a 5-line staff) has not changed, the details still change to express the innovations of contemporary notation. Hence, it encompasses some 500 years of music. Its applications range from monophonic melodies to monstrous counterpoint for large orchestras.
How can we get a grip on such a many-headed beast, and force it into
the confines of a computer program? Our solution is break up the
problem of notation (as opposed to engraving, i.e., typography) into
digestible and programmable chunks: every type of symbol is handled by
a separate module, a so-called plug-in. Each plug-in is completely
modular and independent, so each can be developed and improved
separately. Such plug-ins are called engraver, by analogy with
craftsmen who translate musical ideas to graphic symbols.
In the following example, we see how we start out with a plug-in for
note heads, the Note_heads_engraver.
Then a Staff_symbol_engraver adds the staff
the Clef_engraver defines a reference point for the staff
and the Stem_engraver adds stems.
The Stem_engraver is notified of any note head coming along.
Every time one (or more, for a chord) note head is seen, a stem
object is created and connected to the note head. By adding
engravers for beams, slurs, accents, accidentals, bar lines,
time signature, and key signature, we get a complete piece of
notation.
This system works well for monophonic music, but what about polyphony? In polyphonic notation, many voices can share a staff.
In this situation, the accidentals and staff are shared, but the stems, slurs, beams, etc., are private to each voice. Hence, engravers should be grouped. The engravers for note heads, stems, slurs, etc., go into a group called `Voice context,' while the engravers for key, accidental, bar, etc., go into a group called `Staff context.' In the case of polyphony, a single Staff context contains more than one Voice context. Similarly, more Staff contexts can be put into a single Score context. The Score context is the top level notation context.
Program reference: Contexts .
Ideally, the input format for any high-level formatting system is an abstract description of the content. In this case, that would be the music itself. This poses a formidable problem: how can we define what music really is? Instead of trying to find an answer, we have reversed the question. We write a program capable of producing sheet music, and adjust the format to be as lean as possible. When the format can no longer be trimmed down, by definition we are left with content itself. Our program serves as a formal definition of a music document.
The syntax is also the user-interface for LilyPond, hence it is easy to type
c'4 d'8
a quarter note C1 (middle C) and an eighth note D1 (D above middle C)
On a microscopic scale, such syntax is easy to use. On a larger scale, syntax also needs structure. How else can you enter complex pieces like symphonies and operas? The structure is formed by the concept of music expressions: by combining small fragments of music into larger ones, more complex music can be expressed. For example
c4
Chords can be constructed with << and >> enclosing the notes
<<c4 d4 e4>>
This expression is put in sequence by enclosing it in curly braces
{ ... }
{ f4 <<c4 d4 e4>> }
The above is also an expression, and so it may be combined
again with another simultaneous expression (a half note) using <<,
\\, and >>
<< g2 \\ { f4 <<c4 d4 e4>> } >>
Such recursive structures can be specified neatly and formally in a context-free grammar. The parsing code is also generated from this grammar. In other words, the syntax of LilyPond is clearly and unambiguously defined.
User-interfaces and syntax are what people see and deal with most. They are partly a matter of taste, and also subject of much discussion. Although discussions on taste do have their merit, they are not very productive. In the larger picture of LilyPond, the importance of input syntax is small: inventing neat syntax is easy, while writing decent formatting code is much harder. This is also illustrated by the line-counts for the respective components: parsing and representation take up less than 10% of the source code.
We have written LilyPond as an experiment of how to condense the art of music engraving into a computer program. Thanks to all that hard work, the program can now be used to perform useful tasks. The simplest application is printing notes.
By adding chord names and lyrics we obtain a lead sheet.
Polyphonic notation and piano music can also be printed. The following example combines some more exotic constructs.
The fragments shown above have all been written by hand, but that is not a requirement. Since the formatting engine is mostly automatic, it can serve as an output means for other programs that manipulate music. For example, it can also be used to convert databases of musical fragments to images for use on websites and multimedia presentations.
This manual also shows an application: the input format is text, and can therefore be easily embedded in other text-based formats such as LaTeX, HTML, or in the case of this manual, Texinfo. By means of a special program, the input fragments can be replaced by music images in the resulting PDF or HTML output files. This makes it easy to mix music and text in documents.
The manual is divided into the following chapters:
.ly format. In addition, this section explains
how to upgrade input files from previous versions of LilyPond.
Once you are an experienced user, you can use the manual as reference: there is an extensive index1, but the document is also available in a big HTML page which can be searched easily using the search facility of a web browser. If you are not familiar with music notation or music terminology (especially if you are a non-native English speaker), it is advisable to consult the glossary as well. The glossary explains musical terms, and includes translations to various languages. It is a separate document.
This manual is not complete without a number of other documents. They are not available in print, but should be included with the documentation package for your platform:
The program reference is a set of heavily cross linked HTML pages, which document the nit-gritty details of each and every LilyPond class, object, and function. It is produced directly from the formatting definitions used.
Almost all formatting functionality that is used internally, is available directly to the user. For example, all variables that control thickness values, distances, etc., can be changed in input files. There are a huge number of formatting options, and all of them are described in this document. Each section of the notation manual has a See also subsection, which refers to the the generated documentation. In the HTML document, these subsections have clickable links.
This collection of files tests each notation and engraving feature of LilyPond in one file. The collection is primarily there to help us debug problems, but it can be instructive to see how we exercise the program. The format is similar to the the tips and tricks document.
In all HTML documents that have music fragments embedded, the LilyPond input that was used to produce that image can be viewed by clicking the image.
The location of the documentation files that are mentioned here can vary from system to system. On occasion, this manual refers to initialization and example files. Throughout this manual, we refer to input files relative to the top-directory of the source archive. For example, input/test/bla.ly may refer to the file lilypond-2.3.14/input/test/bla.ly. On binary packages for the Unix platform, the documentation and examples can typically be found somewhere below /usr/share/doc/lilypond/. Initialization files, for example scm/lily.scm, or ly/engraver-init.ly, are usually found in the directory /usr/share/lilypond/.
Finally, this and all other manuals, are available online both as PDF files and HTML from the web site, which can be found at http://www.lilypond.org/.
This tutorial starts with a short introduction to the LilyPond music language. After this first contact we will show you how to produce printed output. Then you will be able to create and print your own sheets of music.
Many people learn programs by trying and fiddling around with the program. This is also possible with LilyPond. If you click on a picture in the HTML version of this manual, you will see the exact LilyPond input that was used to generate that image. Try it on this image
By cutting and pasting the full input into a test file, you have a starting template for experiments. If you like learning in this way, you will probably want to print out or bookmark the Cheat sheet, which is a table listing all commands for quick reference.
The first example demonstrates how to enter the most elementary piece of music, a scale. A note can be entered by typing its name, from `a' through `g'. So, if you enter
c d e f g a b
the result looks like this
The duration of a note is specified by a number after the note name. `1' for a whole note, `2' for a half note, `4' for a quarter note and so on
a1 a2 a4 a16 a32
If you do not specify a duration, the duration last entered is used for the next notes. The duration of the first note in input defaults to a quarter
a a8 a a2 a
Rests are entered just like notes, but with the name `r'
r2 r4 r8 r16
Add a dot `.' after the duration to get a dotted note
a2. a4 a8. a16
The
meter (or
time signature) can be set with the
\time command
\time 3/4 \time 6/8 \time 4/4
The
clef can be set using the \clef command
\clef treble \clef bass \clef alto \clef tenor
Remember to enclose the notes and commands in curly braces
{ ... } to convert it to printable output.
For more elaborate information on
- Entering pitches and durations
- see Pitches, and Durations.
- Clefs
- see Clef.
- Rests
- see Rests.
- Time signatures and other timing commands
- see Time signature.
In the last section we explained what kind of things you could enter in a LilyPond file. In this section we will explain what commands to run and how to view or print the output. If you have not used LilyPond before, want to test your setup, or want to run an example file yourself, read this section. The instructions that follow are for Unix-like systems. Some additional instructions for Microsoft Windows are given at the end of this section.
Begin by opening a terminal window and starting a text editor. For
example, you could open an xterm and execute
joe.2 In your text editor, enter the following
input and save the file as test.ly
{ c'4 e' g' }
To process test.ly, proceed as follows
lilypond test.ly
You will see something resembling
lilypond test.ly GNU LilyPond 2.5.0 Processing `test.ly' Parsing... Interpreting music... [1] Preprocessing graphical objects... Calculating line breaks... [2] Layout output to `test.tex'... Converting to `test.dvi'... Converting to `test.ps'... Converting to `test.pdf'...
The result is the file test.pdf3 which you can print or with the standard facilities of your operating system.4
On Windows, start up a text-editor5 and enter
{ c'4 e' g' }
Save it on the desktop as test.ly and make sure that it is not called test.ly.TXT. Double clicking test.ly will process the file and show the resulting PDF file.
A sharp (#) pitch is made by adding `is' to the name, a flat (b) pitch by adding `es'. As you might expect, a double sharp or double flat is made by adding `isis' or `eses'6
cis1 ees fisis aeses
The key signature is set with the command \key, followed by
a pitch and \major or \minor
\key d \major g1 \key c \minor g
Key signatures together with the pitches (including alterations) are used to determine when to print accidentals. This is a feature that often causes confusion to newcomers, so let us explain it in more detail.
LilyPond makes a sharp distinction between musical content and layout. The alteration (flat, natural or sharp) of a note is part of the pitch, and is therefore musical content. Whether an accidental (a flat, natural or sharp sign) is printed in front of the corresponding note is a question of layout. Layout is something that follows rules, so accidentals are printed automatically according to those rules. The pitches in your music are works of art, so they will not be added automatically, and you must enter what you want to hear.
In this example
no note has an explicit accidental, but you still must enter
\key d \major d cis fis
The code `d' does not mean `print a black dot just below the staff.' Rather, it means: `a note with pitch D-natural.' In the key of A-flat major, it does get an accidental
\key as \major
d
Adding all alterations explicitly might require a little more effort when typing, but the advantage is that transposing is easier, and accidentals can be printed according to different conventions. See Accidentals, for some examples how accidentals can be printed according to different rules.
For more information on
- Accidentals
- see Accidentals.
- Key signature
- see Key signature.
A tie is created by appending a tilde `~' to the first note being tied
g4~ g a2~ a4
For more information on Ties see Ties.
a8 ais d es r d
If you do not like where beams are put, they can be entered by hand. Mark the first note to be beamed with `[' and the last one with `]'.
a8[ ais] d[ es r d]
For more information on beams, see Beaming.
Here are key signatures, accidentals and ties in action
\relative c'' {
\time 4/4
\key g \minor
\clef treble
r4 r8 a8 gis4 b
a8 d4.~ d e,8
fis4 fis8 fis8 eis4 a8 gis~
gis2 r2
}
There are some interesting points to note in this example. Bar lines and beams are drawn automatically. Line breaks are calculated automatically; it does not matter where the line breaks are in the source file. Finally, the order in which time, key and clef changes are entered is not relevant: in the printout, these are ordered according to standard notation conventions.
To raise a note by an octave, add a high quote ' (apostrophe) to
the note name, to lower a note one octave, add a `low quote' ,
(a comma). Middle C is c'
c'4 c'' c''' \clef bass c c,
An example of the use of quotes is in the following Mozart fragment
\key a \major
\time 6/8
cis''8. d''16 cis''8 e''4 e''8
b'8. cis''16 b'8 d''4 d''8
The last example shows that music in a high register needs lots of quotes. This makes the input less readable, and it is a source of errors. The solution is to use `relative octave' mode. This is the most convenient way to copy existing music.
In relative mode, a note without octavation quotes (i.e. the '
or , after a note) is chosen so it it is closest to the
previous one. For example, `c f' goes up while `c g' goes
down
To use relative mode, add \relative before the piece of
music. The first note is taken relative to the middle C
(i.e., c')
\relative {
c' f c g c
}
Since most music has small intervals, pieces can be written almost without octavation quotes in relative mode. The previous example is entered as
\relative {
\key a \major
\time 6/8
cis'8. d16 cis8 e4 e8
b8. cis16 b8 d4 d8
}
Larger intervals are made by adding octavation quotes.
\relative c {
c'' f, f c' c g' c,
}
In summary, quotes or commas no longer determine the absolute height
of a note in \relative mode. Rather, the height of a note is
relative to the previous one, and changing the octave of a single note
shifts all following notes an octave up or down.
For more information on Relative octaves see Relative octaves, and Octave check.
In input files, music is represent by so-called music expression. We have already seen in the previous examples; a single note is a music expression
a4
Enclosing group of notes in braces creates a new music expression
{ a4 g4 }
Putting a bunch of music expressions (notes) in braces, means that they should be played in sequence. The result again is a music expression, which can be grouped with other expressions sequentially. Here, the expression from the previous example is combined with two notes
{ { a4 g } f g }
This technique is useful for non-monophonic music. To enter music
with more voices or more staves, we also combine expressions in
parallel. Two voices that should play at the same time, are entered
as a simultaneous combination of two sequences. A `simultaneous'
music expression is formed by enclosing expressions in << and
>>. In the following example, three sequences (all containing
two other notes) are combined simultaneously
<<
{ a4 g }
{ f e }
{ d b }
>>
This mechanism is similar to mathematical formulas: a big formula is created by composing small formulas. Such formulas are called expressions, and their definition is recursive, so you can make arbitrarily complex and large expressions. For example,
1 1 + 2 (1 + 2) * 3 ((1 + 2) * 3) / (4 * 5)
This is a sequence of expressions, where each expression is contained in the next one. The simplest expressions are numbers, and larger ones are made by combining expressions with operators (like `+', `*' and `/') and parentheses. Like mathematical expressions, music expressions can be nested arbitrarily deep, which is necessary for complex music like polyphonic scores.
Note that this example only has one staff, whereas the previous example had three seperate staves. That is because this example begins with a single note. To determine the number of staves, LilyPond looks at the first element. If it is a single note, there is one staff; if there is a simultaneous expression, there is more than one staff.
{
c <<c e>>
<< { e f } { c <<b d>> } >>
}
Music files with deep nesting can be confusing to enter and maintain. One convention that helps against this confusion is indenting. When entering a file with deep nesting of braces and angles, it is customary to use an indent that indicates the nesting level. Formatting music like this eases reading and helps you insert the right number of closing braces at the end of an expression. For example,
<<
{
...
}
{
...
}
>>
Some editors have special support for entering LilyPond, and can help indenting source files. See Editor support for more information.
To print more than one staff, each piece of music that makes up a
staff is marked by adding \new Staff before it. These
Staff elements are then combined parallel with << and
>>, as demonstrated here
<<
\new Staff { \clef treble c'' }
\new Staff { \clef bass c }
>>
The command \new introduces a `notation context.' A notation
context is an environment in which musical events (like notes or
\clef commands) are interpreted. For simple pieces, such
notation contexts are created automatically. For more complex pieces, it
is best to mark contexts explicitly. This ensures that each fragment
gets its own stave.
There are several types of contexts. Staff, Voice and
Score handle melodic notation, while Lyrics sets lyric
texts and ChordNames prints chord names.
In terms of syntax, prepending \new to a music expression
creates a bigger music expression. In this way it resembles the minus
sign in mathematics. The formula (4+5) is an expression, so
-(4+5) is a bigger expression.
We can now typeset a melody with two staves
\relative <<
\new Staff {
\time 3/4
\clef treble
e'2 d4 c2 b4 a8[ a]
b[ b] g[ g] a2.
}
\new Staff {
\clef bass
c,,2 e4 g2.
f4 e d c2.
}
>>
For more information on context see the description in Interpretation contexts.
Common accents can be added to a note using a dash (`-') and a single character
c-. c-- c-> c-^ c-+ c-_
Similarly, fingering indications can be added to a note using a dash (`-') and the digit to be printed
c-3 e-5 b-2 a-1
Articulations and fingerings are usually placed automatically, but you can specify a direction using `^' (up) or `_' (down). You can also use multiple articulations on the same note. In most cases, it is best to let LilyPond determine the articulation directions.
c_-^1 d^. f^4_2-> e^-_+
Dynamic signs are made by adding the markings (with a backslash) to the note
c\ff c\mf
Crescendi and decrescendi are started with the commands \< and
\>. An ending dynamic, for example \f, will finish the
crescendo, or the command \! can be used
c2\< c2\ff\> c2 c2\!
A slur is a curve drawn across many notes, and indicates legato articulation. The starting note and ending note are marked with `(' and `)', respectively
d4( c16) cis( d e c cis d) e( d4)
A slur looks like a tie, but it has a different meaning. A tie simply makes the first note sound longer, and can only be used on pairs of notes with the same pitch. Slurs indicate the articulations of notes, and can be used on larger groups of notes. Slurs and ties can be nested
Slurs to indicate phrasing can be entered with \( and
\), so you can have both legato slurs and phrasing slurs at the
same time.
a8(\( ais b c) cis2 b'2 a4 cis, c\)
For more information on
- Fingering
- see Fingering instructions.
- Articulations
- see Articulations.
- Slurs
- see Slurs.
- Phrasing slurs
- see Phrasing slurs.
- Dynamics
- see Dynamics.
Chords can be made by surrounding pitches with angle brackets. Angle brackets are the symbols `<' and `>'.
r4 <c e g>4 <c f a>8
You can combine markings like beams and ties with chords. They must be placed outside the angled brackets
r4 <c e g>8[ <c f a>]~ <c f a>
r4 <c e g>8\>( <c e g> <c e g> <c f a>\!)
A pickup is entered with the keyword \partial. It
is followed by a duration: \partial 4 is a quarter note upstep
and \partial 8 an eighth note
\partial 8
f8 c2 d e
Tuplets are made with the \times keyword. It takes two
arguments: a fraction and a piece of music. The duration of the piece
of music is multiplied by the fraction. Triplets make notes occupy
2/3 of their notated duration, so a triplet has 2/3 as its fraction
\times 2/3 { f8 g a }
\times 2/3 { c r c }
Grace notes are also made by prefixing a music expression with the
keyword \appoggiatura or \acciaccatura
c4 \appoggiatura b16 c4
c4 \acciaccatura b16 c4
For more information on
- Grace notes
- see Grace notes,
- Tuplets
- see Tuplets,
- Pickups
- see Partial measures.
A comment is a remark for the human reader of the music input; it is
ignored while parsing, so it has no effect on the printed output.
There are two types of comments. The percent symbol `%'
introduces a line comment; after % the rest of the line is
ignored. A block comments marks a whole section of music
input. Anything that is enclosed in %{ and %} is
ignored. The following fragment shows possible uses for comments
% notes for twinkle twinkle follow
c4 c g' g a a g2
%{
This line, and the notes below
are ignored, since they are in a
block comment.
g g f f e e d d c2
%}
There is a special statement that is a kind of comment. The \version
statement marks for which version of LilyPond the file was written.
To mark a file for version 2.4.0, use
\version "2.4.0"
These annotations make future upgrades of LilyPond go more
smoothly. Changes in the syntax are handled with a special program,
convert-ly (see Invoking convert-ly), and it uses
\version to determine what rules to apply.
Lyrics are entered by separating each syllable with a space
I want to break free
Consider the melody
\relative {
r4 c \times 2/3 { f g g }
\times 2/3 { g4( a2) }
}
The lyrics can be set to these notes, combining both with the
\addlyrics keyword
<<
\relative {
r4 c \times 2/3 { f g g }
\times 2/3 { g4( a2) }
}
\addlyrics { I want to break free }
>>
This melody ends on a melisma, a single syllable (`free') sung to more than one note. This is indicated with an extender line. It is entered as two underscores, i.e.,
{ I want to break free __ }
Similarly, hyphens between words can be entered as two dashes, resulting in a centered hyphen between two syllables
Twin -- kle twin -- kle
More options, like putting multiple lines of lyrics below a melody are discussed in Vocal music.
In popular music, it is common to denote accompaniment with chord names. Such chords can be entered like notes,
\chordmode { c2 f4. g8 }
Now each pitch is read as the root of a chord instead of a note.
This mode is switched on with \chordmode
Other chords can be created by adding modifiers after a colon. The following example shows a few common modifiers
\chordmode { c2 f4:m g4:maj7 gis1:dim7 }
For lead sheets, chords are not printed on staves, but as names on a
line of themselves. This is achieved by using \chords instead
of \chordmode. This uses the same syntax as \chordmode,
but renders the notes in a ChordNames context, with the
following result.
\chords { c2 f4.:m g4.:maj7 gis8:dim7 }
When put together, chord names, lyrics and a melody form a lead sheet, for example,
<<
\chords { chords }
the melody
\addlyrics { the text }
>>
}
A complete list of modifiers and other options for layout can be found in Chords.
Bibliographic information is entered in a separate block, the
\header block. The name of the piece, its composer, etc., are
entered as an assignment, within \header
{ ... }. The \header block is usually put at
the top of the file. For example,
\header {
title = "Miniature"
composer = "Igor Stravinsky"
}
{ ... }
When the file is processed the title and composer are printed above the music. More information on titling can be found in Creating titles.
When different melodic lines are combined on a single staff they are printed as polyphonic voices; each voice has its own stems, slurs and beams, and the top voice has the stems up, while the bottom voice has them down.
Entering such parts is done by entering each voice as a sequence (with
{...}), and combining those simultaneously, separating the
voices with \\
<< { a4 g2 f4~ f4 } \\
{ r4 g4 f2 f4 } >>
For polyphonic music typesetting, spacer rests can also be convenient;
these are rests that do not print. They are useful for filling up
voices that temporarily do not play. Here is the same example with a
spacer rest (s) instead of a normal rest (r),
<< { a4 g2 f4~ f4 } \\
{ s4 g4 f2 f4 } >>
Again, these expressions can be nested arbitrarily
<<
\new Staff <<
{ a4 g2 f4~ f4 } \\
{ s4 g4 f2 f4 }
>>
\new Staff <<
\clef bass
{ <c, g>1 ~ <c g>4 } \\
{ e,4 d e2 ~ e4}
>>
>>
More features of polyphonic typesetting in the notation manual are described in Polyphony.
Piano music is typeset in two staves connected by a brace. Printing such a staff is similar to the polyphonic example in More staves,
<< \new Staff { ... }
\new Staff { ... } >>
but now this entire expression must be interpreted as a
PianoStaff
\new PianoStaff << \new Staff ... >>
Here is a small example
\new PianoStaff <<
\new Staff { \time 2/4 c4 c g' g }
\new Staff { \clef bass c,, c' e c }
>>
More information on formatting piano music is in Piano music.
When all of the elements discussed earlier are combined to produce
larger files, the \score blocks get a lot bigger, because the
music expressions are longer, and, in the case of polyphonic pieces,
more deeply nested. Such large expressions can become unwieldy.
By using variables, also known as identifiers, it is possible to break up complex music expressions. An identifier is assigned as follows
namedMusic = { ... }
The contents of the music expression namedMusic, can be used
later by preceding the name with a backslash, i.e., \namedMusic.
In the next example, a two-note motive is repeated two times by using
variable substitution
seufzer = {
e'4( dis'4)
}
{ \seufzer \seufzer }
The name of an identifier should have alphabetic characters only; no numbers, underscores or dashes. The assignment should be outside of running music.
It is possible to use variables for many other types of objects in the input. For example,
width = 4.5\cm
name = "Wendy"
aFivePaper = \paper { paperheight = 21.0 \cm }
Depending on its contents, the identifier can be used in different places. The following example uses the above variables
\paper {
\aFivePaper
linewidth = \width
}
{ c4^\name }
More information on the possible uses of identifiers is in the technical manual, in Input variables and Scheme.
In orchestral music, all notes are printed twice. Once in a part for the musicians, and once in a full score for the conductor. Identifiers can be used to avoid double work. The music is entered once, and stored in a variable. The contents of that variable is then used to generate both the part and the score.
It is convenient to define the notes in a special file. For example, suppose that the file horn-music.ly contains the following part of a horn/bassoon duo
hornNotes = \relative c {
\time 2/4
r4 f8 a cis4 f e d
}
Then, an individual part is made by putting the following in a file
\include "horn-music.ly"
\header {
instrument = "Horn in F"
}
{
\transpose f c' \hornNotes
}
The line
\include "horn-music.ly"
substitutes the contents of horn-music.ly at this position in
the file, so hornNotes is defined afterwards. The command
\transpose f c' indicates that the argument, being
\hornNotes, should be transposed by a fifth downwards. Sounding
`f' is denoted by notated c', which corresponds with
tuning of a normal French Horn in F. The transposition can be seen
in the following output
In ensemble pieces, one of the voices often does not play for many measures. This is denoted by a special rest, the multi-measure rest. It is entered with a capital `R' followed by a duration (1 for a whole note, 2 for a half note, etc.). By multiplying the duration, longer rests can be constructed. For example, this rest takes 3 measures in 2/4 time
R2*3
When printing the part, multi-rests must be condensed. This is done by setting a run-time variable
\set Score.skipBars = ##t
This command sets the property skipBars in the
Score context to true (##t). Prepending the rest and
this option to the music above, leads to the following result
The score is made by combining all of the music together. Assuming
that the other voice is in bassoonNotes in the file
bassoon-music.ly, a score is made with
\include "bassoon-music.ly" \include "horn-music.ly" << \new Staff \hornNotes \new Staff \bassoonNotes >>
leading to
More in-depth information on preparing parts and scores can be found in the notation manual; see Orchestral music.
Setting run-time variables (`properties') is discussed in Changing context properties on the fly.
This section of the manual contains templates with the LilyPond score already set up for you. Just add notes, run LilyPond, and enjoy beautiful printed scores!
Now you're ready to begin writing bigger LilyPond files – not just the little examples in the tutorial, but whole pieces. But how should you go about doing it?
The best answer is “however you want to do it”. As long as LilyPond can understand your files and produces the output that you want, it doesn't matter what your files look like. That said, sometimes we make mistakes when writing files. If LilyPond can't understand your files, or produces output that you don't like, how do you fix the problem?
Here are a few suggestions that can help you in avoiding or fixing problems:
\version numbers in every file. Note that all
templates contain a \version "2.3.22" string. We
highly recommend that you always include the \version, no matter
how small your file is. Speaking from personal experience, it's
quite frustrating to try to remember which version of LilyPond you were
using a few years ago. convert-ly requires you to declare
which version of LilyPond you used.
The first example gives you a staff with notes, suitable for a solo instrument or a melodic fragment. Cut and paste this into a file, add notes, and you're finished!
\version "2.3.22"
melody = \relative c' {
\clef treble
\key c \major
\time 4/4
a4 b c d
}
\score {
\new Staff \melody
\layout { }
\midi { \tempo 4=60 }
}
The next example demonstrates a simple melody with lyrics. Cut and paste, add notes, then words for the lyrics. This example turns off automatic beaming, which is common for vocal parts. If you want to use automatic beaming, you'll have to change or comment out the relevant line.
\version "2.3.22"
melody = \relative c' {
\clef treble
\key c \major
\time 4/4
a4 b c d
}
text = \lyricmode {
Aaa Bee Cee Dee
}
\score{
<<
\context Voice = one {
\autoBeamOff
\melody
}
\lyricsto "one" \new Lyrics \text
>>
\layout { }
\midi { \tempo 4=60 }
}
Want to prepare a lead sheet with a melody and chords? Look no further!
\version "2.3.22"
melody = \relative c' {
\clef treble
\key c \major
\time 4/4
f4 e8[ c] d4 g |
a2 ~ a2 |
}
harmonies = \chordmode {
c4:m f:min7 g:maj c:aug d2:dim b:sus
}
\score {
<<
\context ChordNames {
\set chordChanges = ##t
\harmonies
}
\context Staff = one \melody
>>
\layout{ }
\midi { \tempo 4=60}
}
This template allows you to prepare a song with melody, words, and chords.
\version "2.3.22"
melody = \relative c' {
\clef treble
\key c \major
\time 4/4
a b c d
}
text = \lyricmode {
Aaa Bee Cee Dee
}
harmonies = \chordmode {
a2 c2
}
\score {
<<
\context ChordNames {
\set chordChanges = ##t
\harmonies
}
\context Voice = one {
\autoBeamOff
\melody
}
\lyricsto "one" \new Lyrics \text
>>
\layout { }
\midi { \tempo 4=60 }
}
Here is a simple piano staff.
\version "2.3.22"
upper = \relative c'' {
\clef treble
\key c \major
\time 4/4
a b c d
}
lower = \relative c {
\clef bass
\key c \major
\time 4/4
a2 c
}
\score {
\context PianoStaff <<
\set PianoStaff.instrument = "Piano "
\context Staff = upper \upper
\context Staff = lower \lower
>>
\layout { }
\midi { \tempo 4=60 }
}
Here is a typical song format: one staff with the melody and lyrics, with piano accompaniment underneath.
\version "2.3.22"
melody = \relative c'' {
\clef treble
\key c \major
\time 4/4
a b c d
}
text = \lyricmode {
Aaa Bee Cee Dee
}
upper = \relative c'' {
\clef treble
\key c \major
\time 4/4
a b c d
}
lower = \relative c {
\clef bass
\key c \major
\time 4/4
a2 c
}
\score {
<<
\context Voice = mel {
\autoBeamOff
\melody
}
\lyricsto mel \new Lyrics \text
\context PianoStaff <<
\context Staff = upper \upper
\context Staff = lower \lower
>>
>>
\layout {
\context { \RemoveEmptyStaffContext }
}
\midi { \tempo 4=60 }
}
Instead of having a full staff for the melody and lyrics, you can place the lyrics between the piano staff (and omit the separate melody staff).
\version "2.3.22"
upper = \relative c'' {
\clef treble
\key c \major
\time 4/4
a b c d
}
lower = \relative c {
\clef bass
\key c \major
\time 4/4
a2 c
}
text = \lyricmode {
Aaa Bee Cee Dee
}
\score {
\context GrandStaff <<
\context Staff = upper {
\context Voice = singer \upper }
\lyricsto "singer" \new Lyrics \text
\context Staff = lower <<
\clef bass
\lower
>>
>>
\layout {
\context { \GrandStaff \accepts "Lyrics" }
\context { \Lyrics \consists "Bar_engraver" }
}
\midi { \tempo 4=60 }
}
Many piano scores have the dynamics centered between the two staffs. This requires a bit of tweaking to implement, but since the template is right here, you don't have to do the tweaking yourself.
\version "2.3.22"
upper = \relative c'' {
\clef treble
\key c \major
\time 4/4
a b c d
}
lower = \relative c {
\clef bass
\key c \major
\time 4/4
a2 c
}
dynamics = {
s2\fff\> s4
s\!\pp
}
pedal = {
s2\sustainDown s2\sustainUp
}
\score {
\context PianoStaff <<
\context Staff=upper \upper
\context Dynamics=dynamics \dynamics
\context Staff=lower <<
\clef bass
\lower
>>
\context Dynamics=pedal \pedal
>>
\layout {
\context {
\type "Engraver_group_engraver"
\name Dynamics
\alias Voice % So that \cresc works, for example.
\consists "Output_property_engraver"
minimumVerticalExtent = #'(-1 . 1)
pedalSustainStrings = #'("Ped." "*Ped." "*")
pedalUnaCordaStrings = #'("una corda" "" "tre corde")
\consists "Piano_pedal_engraver"
\consists "Script_engraver"
\consists "Dynamic_engraver"
\consists "Text_engraver"
\override TextScript #'font-size = #2
\override TextScript #'font-shape = #'italic
\override DynamicText #'extra-offset = #'(0 . 2.5)
\override Hairpin #'extra-offset = #'(0 . 2.5)
\consists "Skip_event_swallow_translator"
\consists "Axis_group_engraver"
}
\context {
\PianoStaff
\accepts Dynamics
\override VerticalAlignment #'forced-distance = #7
}
}
\midi {
\context {
\type "Performer_group_performer"
\name Dynamics
\consists "Piano_pedal_performer"
\consists "Span_dynamic_performer"
\consists "Dynamic_performer"
}
\context {
\PianoStaff
\accepts Dynamics
}
}
}
This template demonstrates a string quartet. It also uses a \global
section for time and key signatures.
\version "2.3.22"
global = {
\time 4/4
\key c \major
}
violinOne = \relative c''{
\set Staff.instrument = "Violin 1 "
c2 d
e1
}
violinTwo = \relative c''{
\set Staff.instrument = "Violin 2 "
g2 g
g1
}
viola = \relative c'{
\set Staff.instrument = "Viola "
\clef alto
e2 d
c1
}
cello = \relative c'{
\set Staff.instrument = "Cello "
\clef bass
c2 g
c,1
}
\score {
\new StaffGroup <<
\new Staff << \global \violinOne >>
\new Staff << \global \violinTwo >>
\new Staff << \global \viola >>
\new Staff << \global \cello >>
>>
\layout { }
\midi { \tempo 4=60}
}
Here is a standard four-part SATB vocal score. With larger ensembles, it's often useful to include a section which is included in all parts. For example, the time signature and key signatures are almost always the same for all parts.
\version "2.3.22"
global = {
\key c \major
\time 4/4
}
sopMusic = \relative c'' {
c4 c c8[( b)] c4
}
sopWords = \lyricmode {
hi hi hi hi
}
altoMusic = \relative c' {
e4 f d e
}
altoWords =\lyricmode {
ha ha ha ha
}
tenorMusic = \relative c' {
g4 a f g
}
tenorWords = \lyricmode {
hu hu hu hu
}
bassMusic = \relative c {
c4 c g c
}
bassWords = \lyricmode {
ho ho ho ho
}
\score {
\context ChoirStaff <<
\context Lyrics = sopranos { s1 }
\context Staff = women <<
\context Voice =
sopranos { \voiceOne << \global \sopMusic >> }
\context Voice =
altos { \voiceTwo << \global \altoMusic >> }
>>
\context Lyrics = altos { s1 }
\context Lyrics = tenors { s1 }
\context Staff = men <<
\clef bass
\context Voice =
tenors { \voiceOne <<\global \tenorMusic >> }
\context Voice =
basses { \voiceTwo <<\global \bassMusic >> }
>>
\context Lyrics = basses { s1 }
\context Lyrics = sopranos \lyricsto sopranos \sopWords
\context Lyrics = altos \lyricsto altos \altoWords
\context Lyrics = tenors \lyricsto tenors \tenorWords
\context Lyrics = basses \lyricsto basses \bassWords
>>
\layout {
\context {
% a little smaller so lyrics
% can be closer to the staff
\Staff minimumVerticalExtent = #'(-3 . 3)
}
}
}
When transcribing mensural music, an incipit at the beginning of the piece is useful to indicate the original key and tempo. While today musicians are used to bar lines in order to faster recognize rhythmic patterns, bar lines where not yet invented during the period of mensural music; in fact, the meter often changed after every few notes. As a compromise, bar lines are often printed between the staves rather than on the staves.
\version "2.3.22"
global = {
% incipit
\once \override Score.SystemStartBracket #'transparent = ##t
\key f \major
\time 2/2
\once \override Staff.TimeSignature #'style = #'neomensural
\override Voice.NoteHead #'style = #'neomensural
\override Voice.Rest #'style = #'neomensural
\set Staff.printKeyCancellation = ##f
\cadenzaOn % turn off bar lines
\skip 1*10
\once \override Staff.BarLine #'transparent = ##f
\bar "||"
\skip 1*1 % need this extra \skip such that clef change comes
% after bar line
\bar ""
% main
\cadenzaOff % turn bar lines on again
\once \override Staff.Clef #'full-size-change = ##t
\set Staff.forceClef = ##t
\key g \major
\time 4/4
\override Voice.NoteHead #'style = #'default
\override Voice.Rest #'style = #'default
% FIXME: setting printKeyCancellation back to #t must not
% occur in the first bar after the incipit. Dto. for forceClef.
% Therefore, we need an extra \skip.
\skip 1*1
\set Staff.printKeyCancellation = ##t
\set Staff.forceClef = ##f
\skip 1*5
% last bar contains a brevis (i.e., spans 2 bars);
% therefore do not draw this particular bar
\cadenzaOn
\skip 1*2
\cadenzaOff
% let finis bar go through all staves
\override Staff.BarLine #'transparent = ##f
% finis bar
\bar "|."
}
discantusNotes = {
\transpose c' c'' {
\set Staff.instrument = "Discantus "
% incipit
\clef "neomensural-c1"
c'1. s2 % two bars
\skip 1*8 % eight bars
\skip 1*1 % one bar
% main
\clef "treble"
d'2. d'4 |
b e' d'2 |
c'4 e'4.( d'8 c' b |
a4) b a2 |
b4.( c'8 d'4) c'4 |
\once \override NoteHead #'transparent = ##t c'1 |
b\breve |
}
}
discantusLyrics = \lyricmode {
% incipit
IV-
% main
Ju -- bi -- |
la -- te De -- |
o, om --
nis ter -- |
ra, __ om- |
"..." |
-us. |
}
altusNotes = {
\transpose c' c'' {
\set Staff.instrument = "Altus "
% incipit
\clef "neomensural-c3"
r1 % one bar
f1. s2 % two bars
\skip 1*7 % seven bars
\skip 1*1 % one bar
% main
\clef "treble"
r2 g2. e4 fis g | % two bars
a2 g4 e |
fis g4.( fis16 e fis4) |
g1 |
\once \override NoteHead #'transparent = ##t g1 |
g\breve |
}
}
altusLyrics = \lyricmode {
% incipit
IV-
% main
Ju -- bi -- la -- te | % two bars
De -- o, om -- |
nis ter -- ra, |
"..." |
-us. |
}
tenorNotes = {
\transpose c' c' {
\set Staff.instrument = "Tenor "
% incipit
\clef "neomensural-c4"
r\longa % four bars
r\breve % two bars
r1 % one bar
c'1. s2 % two bars
\skip 1*1 % one bar
\skip 1*1 % one bar
% main
\clef "treble_8"
R1 |
R1 |
R1 |
r2 d'2. d'4 b e' | % two bars
\once \override NoteHead #'transparent = ##t e'1 |
d'\breve |
}
}
tenorLyrics = \lyricmode {
% incipit
IV-
% main
Ju -- bi -- la -- te | % two bars
"..." |
-us. |
}
bassusNotes = {
\transpose c' c' {
\set Staff.instrument = "Bassus "
% incipit
\clef "bass"
r\maxima % eight bars
f1. s2 % two bars
\skip 1*1 % one bar
% main
\clef "bass"
R1 |
R1 |
R1 |
R1 |
g2. e4 |
\once \override NoteHead #'transparent = ##t e1 |
g\breve |
}
}
bassusLyrics = \lyricmode {
% incipit
IV-
% main
Ju -- bi- |
"..." |
-us. |
}
\score {
\context StaffGroup = choirStaff <<
\context Voice =
discantusNotes << \global \discantusNotes >>
\context Lyrics =
discantusLyrics \lyricsto discantusNotes { \discantusLyrics }
\context Voice =
altusNotes << \global \altusNotes >>
\context Lyrics =
altusLyrics \lyricsto altusNotes { \altusLyrics }
\context Voice =
tenorNotes << \global \tenorNotes >>
\context Lyrics =
tenorLyrics \lyricsto tenorNotes { \tenorLyrics }
\context Voice =
bassusNotes << \global \bassusNotes >>
\context Lyrics =
bassusLyrics \lyricsto bassusNotes { \bassusLyrics }
>>
\layout {
\context {
\Score
\override BarLine #'transparent = ##t
\remove "System_start_delimiter_engraver"
}
\context {
\Voice
\override Slur #'transparent = ##t
}
}
}
This is a much more complicated template, for a jazz ensemble. Note that all
instruments are notated \key c \major. This refers to the key in
concert pitch; LilyPond will automatically transpose the key if the music
is within a \transpose section.
\version "2.3.22"
\header {
title = "Song"
subtitle = "(tune)"
composer = "Me"
meter = "moderato"
piece = "Swing"
tagline = "LilyPond example file by Amelie Zapf,
Berlin 07/07/2003"
texidoc = "Jazz tune for combo
(horns, guitar, piano, bass, drums)."
}
#(set-global-staff-size 16)
\include "english.ly"
%%%%%%%%%%%% Some macros %%%%%%%%%%%%%%%%%%%
sl = {
\override NoteHead #'style = #'slash
\override Stem #'transparent = ##t
}
nsl = {
\revert NoteHead #'style
\revert Stem #'transparent
}
cr = \override NoteHead #'style = #'cross
ncr = \revert NoteHead #'style
%% insert chord name style stuff here.
jzchords = { }
%%%%%%%%%%%% Keys'n'thangs %%%%%%%%%%%%%%%%%
global = {
\time 4/4
}
Key = { \key c \major }
% ############ Horns ############
% ------ Trumpet ------
trpt = \transpose c d \relative c'' {
\Key
c1 c c
}
trpharmony = \transpose c' d {
\jzchords
}
trumpet = {
\global
\set Staff.instrument = #"Trumpet"
\clef treble
\context Staff <<
\trpt
>>
}
% ------ Alto Saxophone ------
alto = \transpose c a \relative c' {
\Key
c1 c c
}
altoharmony = \transpose c' a {
\jzchords
}
altosax = {
\global
\set Staff.instrument = #"Alto Sax"
\clef treble
\context Staff <<
\alto
>>
}
% ------ Baritone Saxophone ------
bari = \transpose c a' \relative c {
\Key
c1 c \sl d4^"Solo" d d d \nsl
}
bariharmony = \transpose c' a \chordmode {
\jzchords s1 s d2:maj e:m7
}
barisax = {
\global
\set Staff.instrument = #"Bari Sax"
\clef treble
\context Staff <<
\bari
>>
}
% ------ Trombone ------
tbone = \relative c {
\Key
c1 c c
}
tboneharmony = \chordmode {
\jzchords
}
trombone = {
\global
\set Staff.instrument = #"Trombone"
\clef bass
\context Staff <<
\tbone
>>
}
% ############ Rhythm Section #############
% ------ Guitar ------
gtr = \relative c'' {
\Key
c1 \sl b4 b b b \nsl c1
}
gtrharmony = \chordmode {
\jzchords
s1 c2:min7+ d2:maj9
}
guitar = {
\global
\set Staff.instrument = #"Guitar"
\clef treble
\context Staff <<
\gtr
>>
}
%% ------ Piano ------
rhUpper = \relative c'' {
\voiceOne
\Key
c1 c c
}
rhLower = \relative c' {
\voiceTwo
\Key
e1 e e
}
lhUpper = \relative c' {
\voiceOne
\Key
g1 g g
}
lhLower = \relative c {
\voiceTwo
\Key
c1 c c
}
PianoRH = {
\clef treble
\global
\set Staff.midiInstrument = "acoustic grand"
\context Staff <<
\context Voice = one \rhUpper
\context Voice = two \rhLower
>>
}
PianoLH = {
\clef bass
\global
\set Staff.midiInstrument = "acoustic grand"
\context Staff <<
\context Voice = one \lhUpper
\context Voice = two \lhLower
>>
}
piano = {
\context PianoStaff <<
\set PianoStaff.instrument = #"Piano"
\context Staff = upper \PianoRH
\context Staff = lower \PianoLH
>>
}
% ------ Bass Guitar ------
Bass = \relative c {
\Key
c1 c c
}
bass = {
\global
\set Staff.instrument = #"Bass"
\clef bass
\context Staff <<
\Bass
>>
}
% ------ Drums ------
up = \drummode {
hh4 <hh sn>4 hh <hh sn> hh <hh sn>4
hh4 <hh sn>4
hh4 <hh sn>4
hh4 <hh sn>4
}
down = \drummode {
bd4 s bd s bd s bd s bd s bd s
}
drumContents = {
\global
<<
\set DrumStaff.instrument = #"Drums"
\new DrumVoice { \voiceOne \up }
\new DrumVoice { \voiceTwo \down }
>>
}
%%%%%%%%% It All Goes Together Here %%%%%%%%%%%%%%%%%%%%%%
\score {
<<
\context StaffGroup = horns <<
\context Staff = trumpet \trumpet
\context Staff = altosax \altosax
\context ChordNames = barichords \bariharmony
\context Staff = barisax \barisax
\context Staff = trombone \trombone
>>
\context StaffGroup = rhythm <<
\context ChordNames = chords \gtrharmony
\context Staff = guitar \guitar
\context PianoStaff = piano \piano
\context Staff = bass \bass
\new DrumStaff { \drumContents }
>>
>>
\layout {
\context { \RemoveEmptyStaffContext }
\context {
\Score
\override BarNumber #'padding = #3
\override RehearsalMark #'padding = #2
skipBars = ##t
}
}
\midi { \tempo 4 = 75 }
}
This template displays all available headers. Some of them are only used in the Mutopia project; they don't affect the printed output at all. They are used if you want the piece to be listed with different information in the Mutopia database than you wish to have printed on the music. For example, Mutopia lists the composer of the famous D major violin concerto as TchaikovskyPI, whereas perhaps you wish to print "Petr Tchaikowski" on your music.
The `linewidth' is for \header.
\version "2.3.22"
\header {
dedication = "dedication"
title = "Title"
subtitle = "Subtitle"
subsubtitle = "Subsubtitle"
composer = "Composer (xxxx-yyyy)"
opus = "Opus 0"
piece = "Piece I"
instrument = "Instrument"
arranger = "Arranger"
poet = "Poet"
texttranslator = "Translator"
copyright = "public domain"
% These are headers used by the Mutopia Project
% http://www.mutopiaproject.org/
mutopiatitle = ""
mutopiacomposer = ""
mutopiapoet = ""
mutopiainstrument = ""
date = "composer's dates"
source = "urtext "
maintainer = "your name here"
maintainerEmail = "your email here"
maintainerWeb = "your home page"
lastupdated = "2004/Aug/26"
}
\score {
\header {
piece = "piece1"
op