From Fedora Project Wiki
Note.png
This Is out of Date
The most recent revisions of the Musicians' Guide are now available from the git repository.

!! Somewhere in here, I have to mention bar- and octave-check devices !!

Links to Files for This Tutorial

Introduction

What LilyPond Is

LilyPond is a notation engraving program, with a focus on creating a visually appealing product. LilyPond is text-based, and allows you to focus on the (semantic?) content of your musical scores, rather than on their visual appearance. Conventional commercial notation engraving programs allow users to edit the score visually. While this approach has its benefits, especially because it's very easy to see exactly what the printed score will look like, it also has disadvantages - chief among these is the fact that users of those programs are constantly worrying about what their score looks like.

This is where LilyPond comes in - users don't need to worry about how their score will work, because they know that the expertly-crafted methods of LilyPond will automatically configure the objects on the score so that they look good, and are easy to read. LilyPond's users focus on what needs to be displayed, rather than on how it is going to be displayed.

As with any particular approach, the LilyPond approach is not for everybody. However, once you have become accustomed to working with the software, and once you have learned methods to help deal with problems and organize your scores' source-files, you will probably realize that LilyPond is both much faster, and much more flexible, than traditional, commercially-available music engraving programs.

It is the goal of this guide to help users more quickly overcome the initial learning handicap incurred because of the text-based approach. Making use of tools such as the Frescobaldi text-editor will help to increase productivity, to make trouble-shooting easier, and to ease the memory burden associated with the text-based approach.

How LilyPond Works

LilyPond itself can be thought of as a highly-skilled automobile mechanic with a well-equipped toolbox. Regardless of the problem presented to the mechanic, they will automatically know which tools to use. Some of their tools are available elsewhere, and some are quite basic, but it is not the tools themselves that gives the mechanic their power, but rather the ways in which the mechanic uses the tools. Similarly, LilyPond is run as a single program (as you would consult a single mechanic), but it employs a multitude of tools - some available elsewhere, but others specialized, so that the resulting output is useful to us in some way.

In order to create meaningful output with LilyPond, we need to provide it meaningful instructions, and this we do in text files with the *.ly extension. These instructions will tell LilyPond which tools to use, when, and with what settings. Sometimes, we will need to change LilyPond's default settings; this is intimidating at first, but really we are just providing more specific instructions for what we want LilyPond to do. To return to the mechanic metaphor: not only would you be able to ask for repairs, but you will be able to ask for specific components or specific methods of installation; once you realize the power, flexibility, and easiness that is changing LilyPond settings, you will have truly unleashed its power.

Other Features

  • Put fragments of music into texts with without cutting and pasting pictures. Integrate music into LaTeX or HTML seamlessly, or add music to OpenOffice.org with ooolilypond.
  • Multi-platform
  • Flexibility (part-extraction, stuff)

The LilyPond Approach

For an extensive explanation of the following section, please see the official LilyPond documentation, from where this was sourced.

?? LilyPond works by separating the tasks of what to put, and where to put it. Each aspect of an object's positioning is controlled by a specific plug-in. Although software using "plug-ins" often results in messy and uncooperative plug-ins, such is not the case with LilyPond. You can think of the plug-ins as tools. LilyPond knows how and when to use each tool; if it doesn't know enough about a tool, then it isn't used, so there's no concern about half-baked plug-ins that work for one person in one situation, but for nothing else. ??

Before LilyPond places an object, it first considers many different possibilities for the specific alignment and layout of that object. Then it evaluates the possibilities according to aesthetic criteria set out to reflect those used in hand-engraved notation. After assigning each possibility a score representing how closely it resembles to the aesthetic ideal, LilyPond then chooses the least problematic possibility.

LilyPond Basics

At its heart, LilyPond's syntax is designed to offer the most flexibility through the most diverse musical conditions. Over time, you will realize that features which seem too complex at first are really a very powerful and simple way to solve complex problems that commercial programs can't attempt.

Letters Are Pitches

One letter is all that's required to create a note in LilyPond. There are additional symbols and letters that are added to indicate further details, like the register, and whether the note is "sharp" or "flat."

Although it can be changed, the default (and recommended) way to indicate "sharp" or "flat" is by using Dutch note-names: "-is" to indicate a sharp, and "-es" to indicate a flat. For example, the following command would create b-double-flat, b-flat, b, b-sharp, and b-double-sharp:

beses bes b bis bisis

Getting used to these names happens quickly, and they take less time to input than the English alternative. Furthermore, with these names, it becomes possible to sing note-names when you are ear training!

Pitch can be entered either absolutely, or relative to the preceding notes. Usually (for music without frequent large leaps) it is more convenient to use the "relative" mode. The symbols , and ' (comma and apostrophe) are used to indicate register.

When entering pitches absolutely, the register is indicated mostly as in the Helmholtz system: octaves begin on the pitch "C," and end eleven tones higher on the pitch "B." The octave below "middle C" (octave 3 in Scientific Pitch Notation) has no commas or apostrophes. The octave starting on "middle C" (octave 4) has one apostrophe; the octave above that (octave 5) has two apostrophes, and so on. Octave 2 (starting two octaves below "middle C") has one comma, the octave below that has two commas, and so on. It is usually not necessary to understand how to use this in LilyPond, or to be able to use it quickly, because most scores will use "relative mode."

When entering pitches relative to the previous one, the register is still indicated with commas or apostrophes, but usually none are needed. When using this input mode, the octave of each note is guessed based on the octave of the previous note. Think of it this way: the next note will always be placed so it produces the smaller interval. For example, after a C, an E could be placed as a major third, a minor sixth, a major tenth, a minor thirteenth, and so on. In relative mode, LilyPond will always choose the "major third" option. If you wanted LilyPond to notate the E so that it's a minor sixth, you would tell LilyPond with a comma appended: c e, so that LilyPond knows what you want. It's the same case if you were to input c aes (meaning "C then A-flat"): the A-flat will be notated so that it is a major third from the C; if you wanted LilyPond to notate it so that the A-flat is a minor sixth higher than the C, you would need to append an apostrophe: c aes'

The only possible ambiguity with this is with a tritone. LilyPond solves this by not recognizing "tritones," per se, and thinking of them as "augmented fourth" or "diminished fifth." Unless instructed otherwise (with a comma or apostrophe), LilyPond will always notate the interval as an augmented fourth.

You must always indicate a sharp or flat, even if it is already in a key signature. This ultimately helps to reduce the number of errors.

Letters used to indicate pitch are always in lower-case.

Numbers Are Durations

A number appended to a letter is understood by LilyPond to indicate that note's note-value. A whole note is indicated with a 1, and all other notes with a number representing the fraction of a whole note that they occupy: half notes are 2 (like "1/2 note"); quarter notes are 4 (like "1/4 note"); eighth notes are 8 (like "1/8 note") and so on.

To add a "dot" to a note (thereby increasing its length by one half), you simply include a period after the number. For example, e4. means "dotted quarter note on E."

To add a "tie" from one note to the next (thereby continuing its duration across a measure-line), add a tilde ( ~ ) after the pitch and duration.

After indicating a duration, it is assumed that all subsequent notes have the same duration, until indicated otherwise.

Articulations

Many different symbols are used to tell LilyPond to add articulation signs to a note. They are all appended after the pitch and (if included) duration, and many have a position indicator, too.

A full list of articulation markings is available in the LilyPond manual, and Frescobaldi remembers most of them for you (they are stored in the left-side panel).

These are some of the most common articulation marks, which use a position indicator unless specified otherwise:

  • ( to begin a slur (no position indicator)
  • ) to end a slur (no position indicator)
  • ~ to begin a tie (which needs no end; no position indicator)
  • . for a staccato mark
  • > for an accent
  • - for a tenuto mark
  • ^ for a marcato mark
  • _ for a portato mark (dot and line)

There are three position indicators:

  • - which means to put the articulation mark wherever LilyPond thinks it makes sense
  • _ which means to put the articulation mark below the note-head
  • ^ which means to put the articulation mark above the note-head

These position indicators will sometimes result in notes like: g4--, g4__, and g4^^, but although this may look incorrect, it is perfectly acceptable.

Simultaneity

Simply put, anything enclosed inside << and >> is considered by LilyPond to happen simultaneously. This can be used in any context (and any Context - see above/below). It is possible to tell LilyPond that you want two notes to happen at the same time in the same voice (yielding a chord), at the same time on the same staff (yielding polyphony), and so on. Moreover, any score with multiple staves will use << and >> to tell LilyPond that the parts should begin at the same time, and creative use of << and >> is one of the keys to advanced notation.

It is not important to understand simultaneity at first. By observing how Frescobaldi creates scores for you, and how examples on the internet take advantage of these symbols, you will eventually understand how to use them.

Chords

Making use of the << and >> idea to indicate simultaneity, if a note has multiple pitches indicated between < and > then LilyPond assumes that they are in a chord together. Notating a single chord with single < > brackets has two advantages: firstly, it is easier to see that they are a chord and not something more complex; secondly, it allows you to enter information more clearly.

Consider the following examples, which should produce equivalent output:

<<g'4->-5 b d>>
<g' b d>4->-5

With the first example, it is more difficult to see the chord notes, the duration, and what the "5" means. With the second example, it is easy to see that the chord notes are a G, a B, and a D, that they have quarter-note duration, and that the "5" is actually a fingering indication.

There is another advantage to using < and > for notation of simple chords: they preserve logical continuity in "relative" mode. The following note will always be notated as relative to the lowest note in the chord, regardless of how many octaves the chord covers. This is not true with << and >>, where where following notes will be notated as relative to the last note between the << and >> .

Commands

There are a wide variety of commands available in LilyPond, some of them quite simple, and other quite complex. They all begin with a backslash, followed by the name of the command, and subsequent "arguments" that give the command further information about what you want it to do. Just like using a letter to indicate a note, commands are simply another way for you to tell LilyPond how you want your score to be rendered.

For example, \time 2/4 and \clef bass are two commands that you are likely to use quite often. They happen to do precisely what it seems like they should: time changes the time signature and metre, and clef changes the clef. they belong to differen contexts (time applies for the whole Score, but clef for only one Staff).

It can take some time to remember even these basic commands and the way you should format their input, and this is where Frescobaldi's built-in documentation viewer can help out. All of the official LilyPond documentation is made available in Frescobaldi, which makes it easy for you to view the documentation and make changes to your score in the same window of the same application.

Customization

It is rarely necessary to customize LilyPond's output in a way that is very specific, and not allowed for in the standard LilyPond syntax. As a beginner, this can happen quite often when you are trying to exactly emulate the look of a pre-existing score. Remember that LilyPond provides a content-focussed way to express music, and that it will usually produce meaningful output without advanced interference. If in doubt about whether a customization is really necessary, ask yourself this: will it change the music that is played from the score?

If you really must customize some setting, then keep in mind these two points:

  1. Tinkering with LilyPond can become as complex as you want.
  2. Ultimately all tinkering takes the form of commands.

Searching the internet for LilyPond tips and tricks can be a life-saver, but it can also lead to needlessly complex solutions. Sometimes this is the result of poor solutions being posted on the internet, but more often it is the result of LilyPond's ongoing development, which makes better solutions available regularly. For this reason, it is recommended to search the official LilyPond documentation first, then the "LilyPond Snippet Repository" (LSR - link here), and then Google.

Contexts

Another aspect of LilyPond that often confuses beginners is the idea of "contexts." It is an essential concept for modifying default behaviour. Like everything in LilyPond, it makes perfect sense: "context" means "context." The three primary contexts are "Voice," "Staff," and "Score." Everything that happens in a score happens in a context - it's just that simple - everything happens in a context! Everything that happens in a score happens in Score context, everything that happens on a staff happens in a Staff context, and everything that happens in a voice happens in a Voice context.

To help clear things up a little, here are three examples:

  1. Where does the title of a composition belong?
    1. Does it belong on the score? Yes, so it belongs in the Score context.
    2. Does it belong on a staff? No, so it doesn't belong in a Staff context.
    3. Does it belong in a voice? No, since it would have to be on a staff to be in a voice.
    The composition's title doesn't belong on a staff or in a voice, but it does belong on the score, so we say that it happens in the Score context.
  2. Where does a clef belong?
    1. Does it belong on the score? Yes, because it is a part of notation.
    2. Does it belong on a staff? Yes, because it wouldn't make sense to have a clef off a staff.
    3. Does it belong in a voice? No, because it's not related to a specific "line" or voice.
    Clefs usually belong on the staff, at the beginning of every line, so we say that they happen in a Staff context.
  3. Where does a note-head belong?
    1. Does it belong on the score? Yes, because it is a part of notation.
    2. Does it belong on a staff? Yes - even if it's on a ledger line, note-heads are meaningless unless they're on a staff.
    3. Does it belong in a voice? Yes, because one particular musical line is indicated primarily with note-heads.
    Note-heads belong to a particular voice, so we say they happen in a Voice context.

To help further clarify, consider the following:

  • As in the real world, objects in LilyPond can potentially happen in any context...
    • (like a doorknob on a door)
    • (like a bus driver sitting in a bus' drivers' seat)
    • (like a person buying groceries at a supermarket)
    • (like a flat-sign next to a note-head)
  • ... some contexts are unusual, but make sense...
    • (like a doorknob on a wall, if the wall is designed to look like a door)
    • (like a bus driver sitting in a passenger seat, if they are going to the garage)
    • (like a person buying groceries from a corner store, if the supermarkets are closed)
    • (like a flat sign in a paragraph of text, if that paragraph describes what flat signs do)
  • ... and some contexts do not make sense, but can still happen...
    • (like a doorknob on a television)
    • (like a bus driver serving patrons at a restaurant)
    • (like a person buying groceries at a governmental office)
    • (like a flat sign in the top corner of a score, where the page number should be)

Because LilyPond's designers wisely decided that they could not conceive of all the possible uses for something, they allowed any plug-in/engraver/tool to be used in any context(?? I think ??). Furthermore, they decided that a Context should be allowed to happen within another Context, which makes sense - a Voice context only makes sense if it appears on a Staff, and a Staff only makes sense if it appears in a Score.

So, when trying to sort out the context in which something should apply, ask yourself exactly that: "In what context does this apply?" Beams and flags happen in one voice, accidentals apply to a whole staff, and tempo markings apply to the whole score. Although it may take some careful thought to get used to the idea, contexts ultimately make perfect sense.

Source Files and Their Formatting

Source files are the text files prepared with instructions telling LilyPond the content of the score you want it to create. They are so called because these files are the "source" of what you wish to create. As with programming languages, the text inside these files is often referred to as "source code." It sounds scary to think that you must edit code in order to use LilyPond, but "code" just means that it isn't normal English (or insert-language-here).

The particular formatting (the placement of tabs, spaces, and newlines) is not determined by LilyPond, but by individual users. This can be a headache when you encounter somebody else's formatting, but it is one of the keys to LilyPond's flexibility. This Guide uses a very specific style of formatting, but it should be understood that this is simply the style of one user, affected by their experiences, and the tasks they usually perform in LilyPond.

You will eventually develop your own style, better-suited to the kinds of tasks that you accomplish. When you do this, there is only one rule to keep in mind: be consistent within source files. When source files are programmed in a consistent way, it means that anybody who wants to use those files (like yourself, in the future) will easily be able to determine how they are organized.

Organizing Files, and Where to Put the Notes

LilyPond files are constructed as a series of commands. For better or worse, LilyPond's interpreter allows a great deal of flexibility when it comes to source file setup. This can lead to confusion about where things should be done, especially when using automated score-setup tools like Frescobaldi.

The generic structure of a LilyPond source file is this:

\version "whatever_version"

\header { things like title, composer, and so on }

\score
{
  \new Staff
  {
    notes can go here
  }
  
  \layout
  {
  }

  and so on
}

Confusion arises here: for maximum flexibility, LilyPond allows source files to create its own commands. On hearing this, you may think, "Okay that's it - I don't need advanced commands or any of this stuff, so I'm packing it in and just using Finale!" There's no need to do that just yet - commands are easy! Think of commands - whether you wrote them or they were included with LilyPond - as a means of text-substition.

It works like this:

  1. You "define" (create) a command with the form commandName = { lots of commands }
  2. You can then use the command anywhere below that, as many times as you want, by writing \commandName in your source file. When LilyPond processes that portion of text, it will instead see whatever you wrote in the definition.

It's as easy as 1-2!

Frescobaldi (along with most LilyPond users) take advantage of this functionality to provide well-organized, easy-to-use source files.

Here is a good template source file, that might be created for you by Frescobaldi:

\version "2.12.2"

\header
{
  title = "Example"
}

violin = \relative c''
{
  \key c \major
  \time 4/4
  % Music follows here.
}

\score
{
  \new Staff \with
    {
      instrumentName = "Violin"
    }
    \violin
  \layout { }
}

This source file makes use of many commands, and even defines "violin" for its own use. It may not be easy to see from this simple example, but keeping your notes separated from the formatting of a complex \score section will greatly improve the readability of both sections. Furthermore, you will easily be able to search through thousands of lines of source file to find the section that you want.

So where do the notes go? In this template, they should go in the "violin" section. Frescobaldi usually marks this off with a friendly comment, stating "% Music follows here." That's exactly what it means: most of your time will be spent working with what follows there.

As a final note, I would like to give a warning against removing the "layout" section of the "score" section. The "layout" section for a particular score may or may not be empty, but it must always be there. Removing it would cause LilyPond not to render a score as output.

Installation

  1. Run sudo -c 'yum install lilypond' or use PackageKit or KPackageKit to install the "lilypond" package.
  2. Review the dependencies; it will want to install a lot of things called lilypond-*-fonts
  3. LilyPond can be run from the command-line, as 'lilypond'

It is recommended that you use the "Frescobaldi" text editor, which is designed specifically for use with LilyPond. It has many features that help to enhance productivity when editing LilyPond files, and which greatly speed up the learning process. Please see this section of the Musicians' Guide for help installing Frescobaldi.


Working on a Counterpoint Exercise

Scenario: You're in Counterpoint class, and you've been asked to submit a very clean copy of your next assignment. Since you don't want to pay $450,000 for a commercially-available engraving solution and a fruity computer to use it, you decide that LilyPond is the solution for you.

Set Up the Score

  1. Open Frescobaldi into a blank document
  2. Use the 'LilyPond > Setup New Score' dialogue
  3. Set the title and composer (and any other field) on the 'Titles and Headers' tab
  4. You need a two staves, so you go to 'Parts' then 'Keyboard' then 'Piano'
  5. You need to label the intervals between the notes, so you choose 'Special' then 'Figured Bass' (we'll put it in the right spot later
  6. You go to the 'Score settings' tab
    1. since you've already played through this example, uncheck "Create MIDI output" and save processing time
    2. your example is in F Major
    3. You want only whole notes, with no barlines; choose a 4/4 time signature, since we'll change this later
  7. Press 'Try' to get a preview of the score setup - the notes are demonstrative and will not be there
  8. If the setup looks like you want it, then press 'OK' to generate the template

Inputting the Parts

  1. Look over the template. It's not important to understand what any of this means, but it's good if you can figure it out.
  2. The piano's upper staff will contain the notes between the { and } following the " right = \relative c " portion
  3. The piano's lower ... left
  4. The figured bass will say what you put in figBass
  5. start with the piano's upper part. Input "f1 g a f d e f c a f g f" (explain)
  6. Check that it's right. Preview by press the "LilyPond" button on the toolbar
  7. The exercise starts too high, and it ends too low. Change the starting pitch by " right = \relative c' "
  8. Preview again; of course, it still ends too low (these simple exercises usually start and end on the same pitch).
  9. Put a ' right after the c so that it goes to the upper C
  10. Preview again, and this time it's right.
  11. Now, enter the notes that you've written for the piano's lower staff: "f1 e d c bes c bes f d bes e f"
  12. Preview the output again, and see that it starts too high, but ends on the right pitch.
  13. Fix the start-too-high by changing to " left = \relative c { "
  14. Preview again, and decide where to fix the other change (NB: I end up with "f1 e d c bes c bes f' d bes e f"
  15. Enter the interval number between the top and bottom between the { and } preceded by " figBass = \figuremode "
  16. You have to put each interval between < > brackets. The note-length of the figure's duration goes after the >, so I end up with "<1>1 <3> <5> <4> <3> <3> <5> <5> <5> <5> <3> <1>"
  17. Now you realize that there are some signficant errors in your work. The top staff is the cantus, and cannot change. You have to correct the lower staff.
  18. I've ended up with a lower part that is "f1 e d a bes c d e f d c f", which gives figures that are "<1>1 <3> <5> <6> <3> <3> <3> <6> <3> <3> <5> <1>"

Formatting the Score

I do this last, so that my primary focus is the note-wise content, and formatting is only a secondary concern. LilyPond is particularly good at handling this sort of outlook.

Move the Figured Bass

Normally, figured bass parts are below the staves. This example is using the figured-bass feature of LilyPond to do something else, so we're going to move the figured bass so that it's where it needs to be.

  1. the \score{ } section contains everything in the score; notice that the figured bass has the identifier \bassFiguresPart; remove this
  2. scroll up to where it says "bassFiguresPart = ... " and comment it with %
  3. scroll up to where it says "pianoPart = ... " and enter the "\new FiguredBass \figBass" line that you just commented out, on a line between the "right" and "left" staves
  4. now erase the part that you commented in (2) (or leave it there)
  5. Preview the file, and see that the figures now appear between the piano staves

Take away the word "Piano" at the start of the staves

  1. Find the part that begins "pianoPart = ... " and erase the "instrumentName ... " line (or comment it)
  2. Preview the file, and see that it no longer says, "Piano"

Make Some Elements Transparent

This involves some more advanced tweaking. Explain this sort of command.

Every layout object has a "stencil" property. By default, this is set to whatever function draws the object. If you set that property to #f, which means "false", then the drawing function is not called, and the object will not appear on the score.

Every layout object also has a "transparent" property. By default, this is set to #f ("false"). Setting it to #t ("true") will make the object transparent.

You can use "\once \override ..." or \revert ..." too

  1. Find the "global" section
  2. After \key and \time, put " \override Score.BarLine #'stencil = ##f "
  3. Preview the file, and see that this doesn't work quite as intended.
  4. It so happens that, while measure lines within a staff are handled by Staff.BarLine, measure lines between staves are handled by Staff.SpanBar; so you'll need to set its 'transparent symbol to #t also
  5. But there's still no measure-line at the end! You want a barline at the end, so pick one of the staves (right, left, figBass - it doesn't matter in this case) and use the \revert command (don't know if I should put this in, but: "\revert Score.BarLine #'transparent and \revert Score.SpanBar #'transparent")
  6. But even this isn't quite right. You want a double-barline at the end. So, put the cursor after the \revert lines, and then from the menu, 'LilyPond > Bar Lines > Ending Bar Line' . It knows what you want, remembers the symbol for you, so you don't have to!
  • explain in there the difference between a Staff.* and Score.* override
  • Unlike with some other elements, if you simply remove the "\time 4/4" indicator, it will still print the default 4/4 time signature.
  • This example is musically simple, but it includes some advanced concepts, and importantly helps to get over a couple of common (and understandable) fears, especially for beginners, and especially for musically-simple things like this

Working on a Piano Score

!! These are the subtitles that I'd like to use for all the LY case studies, if I can !!

Scenario: At a used music store, you encounter a 60-year-old, hand-engraved copy of a Schubert Impromptu, but it's been badly damaged by a flood. The store's owner says that, if you can use the score, you can keep it for free. The score is barely legible, so you decide to prepare a copy with a computer notation program.

I'm using Schubert's Impromptu Op.90 (D.899) Nr.4, in A-flat major. Published by Edition Peters: 10463, ed. Walter Niemann. We'll be setting the A section (from the beginning to the Trio).

When following this tutorial, it is recommended that the reader follows along, creating their replica of this tutorial's PDF.

Starting the Score

  1. Open Frescobaldi with a new document.
  2. Start the "Setup New Score" tool, by clicking 'LilyPond > Setup New Score' in the menu.
  3. Fill in the following fields on the "Titles and Headers" tab:
    • Title: Impromptu
    • Compuser: Schubert, Franz
    • Opus: Opus 90/4
  4. Switch to the "Parts" tab:
    1. From the "Available parts" list, select "Keyboard instruments"
    2. Select "Piano"
    3. Click "Add"
    4. On the right-hand side of the window, it's possible to add multiple voices from the start. We won't be using this feature, because most of the score is not polyphonic. It is especially convenient in fugues.
  5. Switch to the "Score settings" tab, and adjust the following settings:
    • Key signature: As Major
    • Time signature: 3/4
    • Tempo indication: Allegretto
    • Remove default tagline: checked
    • Adjust other settings as desired - it is recommended to keep the default pitch name language.

Adjusting Frescobaldi's Output

These steps are useful in establishing a consistent input style for LilyPond. The things suggested here are also useful for getting used to working with large scores, which can be a challenge in any text editor. Thankfully, careful (and consistent!) code organization goes a long way in helping you to quickly find your way around your files. Setting up files the right way to begin with makes this much easier in the end.

When you first setup the score, Frescobaldi will have created many sections for you by default. The program avoids making too many stylistic choices for you, which allows you to create your own style. It also sets up the default sections in a logical way:

version
header
widely-used settings like tempoMark and "global"
individual parts
score formatting

The specific ordering will become more obvious to you as you get used to LilyPond.

Here are some of the things that I do before inputting notes:

  • Use section-dividers (like %%%%%%%% NOTES %%%%%%%% for individual parts) to demarcate sections.
  • Use different levels of dividers (like %%%% RIGHT HAND %%%% for the right hand) to show sub-sections
  • Add blank lines between large sections, to separate them more obviously
  • Begin braces on new lines (as
    \header
    {
      title = "Impromptu"
      ...
    }
    instead of on the same line (as
    \header {
    
     title = "Impromptu"
     ...
    
    }
    This is simply a matter of personal taste, resulting from prior experience with C and C-like programming languages.
  • Familiarize myself with the sections and commands created by Frescobaldi, getting a sense of what the section/command does (even if I don't understand what each specific command does). This makes it easier to sort out problems and customization down the road. Sometimes, when the setup is quite complex, I make comments about what seems to be going on.
  • At this point, I also added the "Dynamics Context" commands, as described below in the "Piano Dynamics" section

Inputting

Piano scores present some unique challenges with LilyPond, but they're easy to overcome with some careful thought. This tutorial will avoid step-by-step instructions on how to input particular notes, instead focussing on those unique piano challenges presented in this particular composition. The LilyPond "Notation Reference" provides a section dedicated to keyboard and piano music. Most of the situations described there are not present or discussed in this score, which gives this tutorial unique material.

Order of Inputting

Choosing the right order to input your scores can make things much easier to troubleshoot. Here are some suggestions:

  1. Input music in small sections at a time. Two, four, or eight measures is usually a good size, but it depends on the size of the composition, the size of its sections, and the form of the music. It doesn't make sense to input a passage of 9 whole-notes in stages of two measures, but two measures may be too long for passages composed primarily of 128th-notes.
  2. Input one staff at a time, then check its accuracy using Frescobaldi's preview function (press the "LilyPond" button on the toolbar)
    • Input the pitch and rhythms first, then slurs, articulations, ties, and fingerings. It's easier to correct errors with pitch and rhythm (and register!) before the extra markings are added.
    • To help make sixteenth-note passages easier to read, you can use double- or triple-spaces to separate beats. Such passages often feature repeated patterns; before copy-and-pasting, make sure that the pattern repetition is truly exact!
  3. When you progress to a new four-measure section (or two- or six-, etc.), input the less difficult staff first (if there is one). This way, you will have a better visual reference when verifying the more difficult part. It's easier to see differences if your score looks closer to the original.
  4. The same idea applies for multi-measure polyphonic passages in the same staff: input the easier part first, so you have a visual reference.
  5. To help ensure that you don't get lost, write measure numbers in the source file every five measures or so. See the example source file to see how this is done. Even if you don't want to have measure numbers in the final score, it can be helpful to include them during inputting and error-checking.
  6. Save the dynamics and pedal markings for last! Sometimes, they can help you to keep your place in the score while double-checking that it's correct, but I don't usually put them in with the rest of the notes, for reasons described below in the "Piano Dynamics" section.

Most importantly, remember that these are just suggestions! The order in which you do things should change depending on what suits you best. Different kinds of scores will require different strategies.

Chords

There are two ways to input chords, but one will be used much more often.

This style of chord notation is more common: <as ces>4-_ Notice how only the pitches are notated inside the < > brackets, and everything else attached to the end. There is one exception to this: fingering should be indicated on the pitch associated with that finger: <as-1 ces-3>4-_ Not only does this help you to sort out what was probably intended, but it allows LilyPond to stack the fingering in the right order. When using "relative" entry mode, it is the lowest note of the chord that is taken into consideration when placing the next note.

This style of chord notation is less common: <<as4-> ces>> Notice how everything must be notated inside the << >> brackets. This can make it more difficult to read the chord in the source file, but it also allows much greater flexibility: only some chord members can have ties; certain chord members can last for longer than others; certain chord members can "break out" into or out of polyphonic passages. This notation is rarely needed, but you may be inclined to over-use it if you are trying to exactly copy the look of a hand-engraved score. Like the "times" command for tuplets, this is one of LilyPond's deceptively powerful techniques. When using "relative" entry mode, it is the last note of the chord that is taken into consideration when placing the next note.

Fingering

LilyPond allows you to indicate fingering by attaching the digit number to a note as an articulation mark: a16-5 will show a "5" as a fingering mark. As with all other articulation marks indicated in this way, you can use ^ or _ to instruct LilyPond to put the mark above or below the note, respectively. It is usually better to let LilyPond decide for itself by using a -.

When entering chords, it is recommended that you enter the fingering with the note to which it is attached, like <as-1 ces-4>4-_. It is possible to enter this as <as ces>4-1-4->, but this not only looks confusing, it may confuse LilyPond as to which digit is intended for which note.

Because the extra digits look like they indicate note-lengths, it is recommended to mark them consistently. For this same reason, it is also recommended that fingering marks be added to source files only after the pitch and rhythm have been double-checked. The source file included with this tutorial puts fingering marks after any other articulation and length marking.

Cautionary Accidentals

Musical Definition:

This score makes some use of cautionary accidentals. These are accidentals which don't change the pitches to be played, but rather are used as a precaution against forgetting that they are there. This usually happens when an accidental in the written key signature is changed for a significant number of measures, and then suddenly changes back. The cautionary accidental would be applied when the standard key signature returns, to remind the musician of the key signature.

LilyPond Notation: These are notated in LilyPond with an exclamation mark placed before the note-value: ces!16

Changing the Style of Crescendo

Sometimes the composer or editor prefers to use the words "crescendo" or its abbreviation, "cresc.", instead of the angled-line < style of crescendo. In LilyPond these are handled by the same source-file notation (\< to start and \! to end explicitly). However, if you want to use text and a "spanner" (dotted or dashed line, for example) instead of the < sign, you need to tell LilyPond. This can be accomplished with the following command: \crescTextCresc.

After changing to this style of crescendo, you can revert to the standard < style with the following command: \crescHairpin.

The \dimTextDim and \dimHairpin commands do the same for a diminuendo.

Polyphonic Sections in Homophonic Music

Sometimes, especially in piano music, a passage of some measures will require polyphonic (multi-Voice) notation in LilyPond, even though most of the music does not. In this case, you would use the following format:

<<
  {
    % upper voice notes go here
  } \\
  {
    % lower voice notes go here
  }
>>

This is used a few times in both hands in the example score file.

When writing these sections in "relative" entry mode, it is a good idea to use the "octave-check" mechanism, at least at the beginning of the lower voice. This is because, when judging the relative starting pitch of the first note of the lower voice, LilyPond judges from the last note of the upper voice - not the last note before the polyphonic section began.

Octave-Change Spanners ("8ve" Signs, "Ottava Brackets")

Musical Definition:

In order to most conveniently notate over large ranges, composers and editors sometimes use text spanners to indicate that a passage should be played one or two octaves higher or lower than written. This allows the notes to stay mostly within the staff lines, thereby decreasing the number of ledger lines required.

LilyPond Notation:

The \ottava command is used to notate all five states of transposition:

  • 15va (play two octaves higher than written) is engaged with \ottava #2
  • 8va (play one octave higher than written) is engaged with \ottava #1
  • loco (play in the octave written) is engaged with \ottava #0, which also cancels another sign.
  • 8vb (play one octave lower than written) is engaged with \ottava #-1
  • 15vb (play two octaves lower than written) is engaged with \ottava #-2

Troubleshooting Errors

It can be difficult to troubleshoot inputting errors, especially when you find them days or weeks after originally inputting that section of a score. The best way to fix errors is to input scores in a way that doesn't allow them in the first place. As they say, "an ounce of prevention is worth a pound of cure," which means "if you input your LilyPond files carefully, then you will encounter fewer problems." Such practices as proper spacing, and regular use of the octave- and bar-check features will deal with many common problems.

However, when searching for an error in your score, Frescobaldi does offer some features to help you find it:

  • If you have written something in the text-input window that is obviously incorrect, then Frescobaldi will sometimes catch your mistake and underline and highlight the erroneous code in red. This is most useful for catching typographical errors ("typos").
  • If LilyPond encounters a processing error, it will show up in the "LilyPond Log" window below the text-input window. You can click on the blue, underlined text to move the text-selection caret to the error.
  • If you can see an error in the PDF preview, but you can't find it in the source file, you can click on the problematic note or object in the PDF preview, and Frescobaldi will automatically move the text-selection caret to that object.

Piano Dynamics

Keyboard instruments use a unique notation when it comes to dynamics. Most instruments use only one staff per player, so the dynamics are, by convention, notated underneath that staff. Keyboard instruments usually use two staves (organs and complex piano music may use three). Because the dynamics are usually meant to apply to both staves, they are usually notated between the two staves. This is similar to notation beneath the upper staff, but in truth, piano dynamics tend to be placed in the middle between the staves - entering the dynamics as belonging to the upper staff, in LilyPond, will not produce that effect.

There is a way to notate dynamics between two staves in LilyPond, and it involves a little bit of thought to get it right. It also requires the addition of a significant number of commands, and the creation of a new context.

This process looks difficult, and may seem daunting. It's not necessary to understand all of the commands in the "PianoDynamics" Context in order to use the context, so there is no need to worry!

Preparing the "PianoDynamics" Context

It is probably easier to add these commands before inputting most of the score, but there is no reason why this context cannot be added to any score at any time.

Follow these steps to create a "PianoDynamics" Context:

  1. Between the left and right staves of the PianoStaff, add "\new PianoDynamics = "dynamics" \dynamics". For the Schubert score, this looks like:
      \new PianoStaff \with
        {
          instrumentName = "Piano"
        }
      <<
        \new Staff = "right" \right
        \new PianoDynamics = "dynamics" \dynamics
        \new Staff = "left" { \clef bass \left }
      >>
  2. To the layout section, add the following:
    % Everything below here is for the piano dynamics.
        % Define "PianoDynamics" context.
        \context 
        {
          \type "Engraver_group"
          \name PianoDynamics
          \alias Voice
          \consists "Output_property_engraver"
          \consists "Script_engraver"
          \consists "New_dynamic_engraver"
          \consists "Dynamic_align_engraver"
          \consists "Text_engraver"
          \consists "Skip_event_swallow_translator"
          \consists "Axis_group_engraver"
          
          \override DynamicLineSpanner #'Y-offset = #0
          \override TextScript #'font-size = #2
          \override TextScript #'font-shape = #'italic
          \override VerticalAxisGroup #'minimum-Y-extent = #'(-1 . 1)
        }
        
        % Modify "PianoStaff" context to accept Dynamics context.
        \context
        {
          \PianoStaff
          \accepts PianoDynamics
        }
        % End of PianoDynamics code.
    This creates a "PianoDynamics" context, and modifies the "PianoStaff" context so that it will accept a "PianoDynamics" context.
  3. Before the "\score" section, add a section called "dynamics," like this:
    dynamics =
    {
      % Dynamics go here.
      
    }
    This is where you will input the dynamics.

Inputting the Dynamics

Now you can input the dynamic markings. These are inputted with a special note called a "spacer," that uses the letter "s" rather than a note name. You can also use rests (both partial- and multi-measure, r and R), but dynamic markings cannot be assigned to them.

For example, if you want a piano marking on the first beat, and a diminuendo from the third to the fourth beat, you could write this: s4\p r s\> s\!, or this: s2\p s4\> s\!

That's all there is to it! Think of the dynamics part as an invisible, pitch-free line between the two staves, for the sole purpose of dynamics (and other expression markings).


Working on an Large Ensemble Score

Part of: Joseph Haydn's "Sinfonia No. 92: Oxford," first movement.

!! For readers who want to input this while following the tutorial, I'll have to provide the resulting PDF output from LilyPond as their basis for input.

  • you shouldn't look at the source file until after inputting it yourself

Starting the Score

!! You added an additional staff for the 2nd oboe, which isn't in some of these instructions

  1. 'LilyPond > Setup New Score'
  2. "Titles and Headers" Tab:
    • Dedication: Comte d'Ogny and Prince Oettingen-Wallerstein
    • Title: Sinfonia No. 92
    • Subtitle: "Oxford"
    • Composer: Haydn, Joseph
    • all the rest are blank
  3. "Parts" Tab:
    • Flute, 2 of Oboe, Bassoon
    • Horn in F, Trumpet in C
    • Timpani
    • Violin, Violin, Viola, Cello, Contrabass
  4. "Score settings" Tab:
    • Key signature: G Major
    • Time signature: 3/4
    • Tempo indication: Adagio
    • other settings as desired; I recommend not remocing bar numbers, and removing the default tagline
  5. Click "Try" to see if it works.
    • It should, but the instrument names are not correct as per the score; we'll adjust this later.
  6. Click "OK" to generate the score.

Adjusting Frescobaldi's Output

These steps are useful in establishing a consistent input style for LilyPond. The things suggested here are also useful for getting used to working with large scores, which can be a challenge in any text editor. Thankfully, careful (and consistent!) code organization goes a long way in helping you to quickly find your way around your files. Setting up files the right way to begin with makes this much easier in the end.

When you first setup the score, Frescobaldi will have created many sections for you by default. The program avoids making too many stylistic choices for you, which allows you to create your own style. It also sets up the default sections in a logical way:

version
header
widely-used settings like tempoMark and "global"
individual parts
score formatting

The specific ordering will become more obvious to you as you get used to LilyPond.

Here are some of the things that I do before inputting notes:

  • Use section-dividers (like %%%%%%%% NOTES %%%%%%%% for individual parts) to demarcate sections.
  • Use different levels of dividers (like %%%% OBOE %%%% for the oboe) to show sub-sections
  • Add blank lines between large sections, to separate them more obviously
  • Begin braces on new lines, like
    \header
    {
      title = "Symphony"
      ...
    }
    
    instead of on the same line, like
    \header {
      title = "Symphony"
      ...
    }
    
    This is simply a matter of personal taste, resulting from prior experience with C and C-like programming languages.
  • Familiarize myself with the sections and commands created by Frescobaldi, getting a sense of what the section/command does (even if I don't understand what each specific command does). This makes it easier to sort out problems and customization down the road. Sometimes, when the setup is quite complex, I make comments about what seems to be going on.
  • Change the instrument names to replicate what my score indicates. You don't necessarily need to do this, so long as the people using your score will understand what the instruments are. Since my goal is to replicate this Dover edition score, I will change the names.
    1. In the "PARTS" section, each xPart section has an "instrumentName = "something"" field.
    2. We'll be changing those to the following Italian names:
      • Flute --> Flauto
      • Oboe I --> I Oboe
      • Oboe II --> II Oboe
      • Bassoon --> 2 Fagotti
      • Horn in F --> 2 Corni in Sol (NB: these would have been "natural horns")
      • Trumpet in C --> 2 Clarini in Do (NB: a clarino is a kind of trumpet)
      • Violin I --> Violino I
      • Violin II --> Violino II
      • Cello --> Violoncello obligato
      • Contrabass --> Basso
    3. Now we have to change the horns' transposition to match the name. This is because Frescobaldi added a "Horn in F" part, which is the most common horn transposition. However, Haydn's score uses horns in G (or "Sol" in Italian).
    4. Scroll up to the "hornF" section under the NOTES marker. Change the line \transposition f to \transposition g.
    5. As it turns out, transposition can be a little more complicated than that. We'll deal with that when we get there.

Inputting the Slow Introduction

Unlike the piano piece, this tutorial offers step-by-step instructions representing one way to input the score. Only the slow introduction (the part before "Allegretto") will be inputted. The rest is left to you.

Starting with the Easy Part

The best way to get started on large scores is to just start with something easy. Nothing can be easier than doing nothing, so let's first input the multi-measure rests in the wind sections and timpani.

  1. Count the number of measures of rests. In this case, all of the winds and the timpani have thirteen or more measures of rests before their first entrance.
  2. Let's put in those thirteen measures first.
    1. In the NOTES section, find the flute section, and put in R2.*13 |.
    2. Here is an explanation of R
    3. here is an explanation of |
    4. Copy and past that into the rest of the winds and the timpani.
  3. The timpani and trumpet/clarini parts have six further full measures of rest, before the measure with a fermata. The fermata can't be included in the multi-measure rest, so we'll treat it separately. Add R2.*6 | to the timpani and trumpets parts.
  4. The horns, bassoons, and second oboe have one further measure of rests, so add R2. | to those parts. We won't use r2. | because yadda.

Continuing with the Wind and Timpani Parts

  1. Now we need to start adding notes. We'll start with the parts that have only rests:
    1. The trumpets and timpani have no notes in the slow introduction, so all they need is the three-beat measure with a fermata on the third beat.
    2. Rests are notated as though they were a pitch called "r". That is to say, if you want to input a rest, then you input the pitch r. This three-quarter-rest measure will be notated as r4 r r |. Put this into the trumpets and timpani parts. Remember: it's always a good idea to indicate the duration at the beginning of a measure, but it's not necessary to indicate a repeated duration.
    3. Frescobaldi allows you to insert common musical signs with the "Quick Insert" tab on the left of the screen. It may be hidden; to show it, click "Quick Insert" on the left-most edge of the Frescobaldi window.
    4. We need a regular fermata on the third quarter rest of this measure. So, place the text-input caret just after the third quarter rest, and click the fermata symbol in the "Quick Insert" toolbar-thing.
    5. You should end up with r4 r r\fermata |.
    6. While the word for a fermata symbol is easy to remember, other symbols have less-obvious LilyPond notations, so the "Quick Insert" toolbar-thing is very handy.
    7. Copy this measure to the other part.
  2. The next easiest part is the bassoons:
    1. We've already input the bassoons' full-measure rests, so we can start with the first measure in which they play. It should be notated as r8 d g bes d bes |. Input this, and preview the score to see what happens.
    2. Success! When first starting an instrument, it's important to check that the notes begin in the right register. If they don't, it can be adjusted easily by changing the pitch indication that follows the \relative declaration. In this case, the bassoon happened to be in the right register for us by default.
    3. The next measure is g8 cis cis4 r |. Remember to indicate "cis" twice. Put it in and check that it's correct.
    4. It is, but we're still missing some formatting. Use the "Quick Insert" toolbar-thing to add staccato markings to the first measure. You can add a staccato to the eighth-rest, but this doesn't make sense, so you shouldn't.
    5. Slurs begin at ( and end at ). Add a slur from the g to c-sharp.
    6. Preview the score to make sure that you entered these articulations correctly. Your code should be:
      r8 d-. g-. bes-. d-. bes-. |
        g8( cis) cis4 r |
  3. Now to add the "forte" marking. You can add text (or any object, for that matter) onto a note (or rest, etc.) with one of these three symbols:
    • ^ meaning "put this above the object"
    • - meaning "put this above or below, as you think is best"
    • _ meaning "put this below the object"
    As you saw earlier, Frescobaldi attached our staccato markings with the "as you think best" symbol, which is almost always the right choice for articulations. By convention, dynamic markings always go below the staff to which they apply, so we won't want to give LilyPond so much freedom, this time.
  4. The easiest way to add (unformatted) text to a note is to simply attach it in quotation marks. For the "forte" marking, put this on the eighth-rest: r8_"f" etc.
  5. When you preview this, you'll notice that the result is thoroughly underwhelming. It looks quite unlike a "forte" marking, and people reading the score would probably be confused, if just momentarily.
  6. Thankfully, LilyPond provides a very easy and elegant way to input well-formatted dynamic markings. Change the eighth-rest to this: r8\f etc.
  7. When you preview this, you will see that it now looks exactly like a typical "forte" marking. Not all dynamic markings have these short-forms, but most do.
  8. The "a 2" marking, meaning "to be played by two players," does need the text-in-quotes format, however. Put that marking above the d following the eighth rest.
  9. Those two measures should now look like this:
    r8\f d-.^"a 2" g-. bes-. d-. bes-. |
    g8( cis) cis4 r |
    
    Note that d-.^"a 2" gives the same result as d^"a 2"-.

Oboe and Horn Parts

  1. You now know enough to complete the oboe parts, and the flute part. Give it a try. Here are some tips, in case you get stuck:
    • You will need to adjust the range of the flute and oboe, to read flute = \relative c and oboeI = \relative c
    • You may want to use [ and ] to control eighth-note beaming in the Oboe I and Flauto parts. You may not
    • The Flauto will need more multi-measure rests with R, after some of the notes are inputted.
    • All of the parts will end with the same three-quarter-note-rests-with-fermata measure.
  2. And now for the horns part. Transposing instruments pose a small problem for LilyPond, as with any human or computerized engraving tool. These steps first ensure that the transposition is set correctly.
  3. The "hornF" section should already have a \transposition g segment from earlier. This tells LilyPond that the following notes are not in concert pitch, but rather are "in G." A transposition statement tells LilyPond, in absolute pitch, which pitch actually sounds when the player plays a written c' . In this case, the sound pitch is a perfect fourth below c' . If we wanted it to be a perfect fifth higher, then we would need to write \transposition g', but that's not accurate for this case.
  4. Our next obstacle is not actually a problem with LilyPond, but with how Frescobaldi set up the score for us. The score that we wish to notate does not have a written key signature for the horn, but the "global" section (near the top of the file) includes one: G Major. If this score were particularly complicated, or if it contained a large number of transposing instruments, then it would be best to remove the \key ... declration from the "global" section (and including it in every instrument as necessary). However, since there is only one transposing instrument, we might be better off simply removing the global from the horn.
  5. do the rest of this stuff to get that done right
  6. make a note in the global section of which instruments don't use it
  7. While you're at it, do the same for the trumpets and timpani parts, which also do not use a printed key signature.
  8. The other issue with the horn part is that two pitches are to be played at once, and they are both notated in the same voice. This is solved in the piano example like this: <g g'>. You can copy-and-paste this as needed.
  9. You can now finish inputting the horn part.

Moving on to the Strings

After correctly finishing all of the wind and timpani parts, you can move on to the strings.

  • Input all of the pitches and note lengths first, then return to fill in the other markings.
  • If you get stuck, then put in some filler notes, and finish the rest of that part. Make a note for yourself, as a comment in the source file, so that you know to return later to finish the part.
  • If twenty measures at once is too many, then break it into smaller chunks and input those.
  • Here are some tips to help you through this passage. Use the LilyPond help files if you need further assistance.
    • Tuplets (Triplets):
      • To write any tuplet, use the formula \times x/y { notes in here }, where x is the number of notes actually space to use, and y is the number of notes to let you display.
      • For an eighth-note triplet that takes up one beat, you might use this: \times 2/3 { c8 d e }, because in the space of 2 eighth notes you want to fit three instead.
      • This is much more powerful than it seems at first. You might want to make it seem as though the measures have stopped being marked, and write something like \times 4/40 { ... }, which will allow you to fit forty of something into the number of beat usually occupied by four of them. This is especially useful with cadenzas, and cadenza-like passages.
    • Short-term Polyphonic Input (Divisi):
      • Anything between << and >> is interpreted by LilyPond as happening together. If you take a look at the "score" section at the bottom of the file, you will see that all of the parts are listed in that kind of bracket. This ensures that they all happen simultaneously.
      • For short-term polyphonic input, use the formula
        << { upper-voice notes } \\ { lower-voice notes } >>
        . Remember that the "upper voice" has upward-pointing stems, and the "lower voice" has downward-pointing stems.
    • Ties: These can be written by adding ~ to the end of the note beginning the tie:
      c4~ c8
    • Grace Notes: These take up no logical time, and are smaller than ordinary notes. Any notes appearing \grace { in here } would be considered grace notes.
    • Crescendo and Diminuendo Markings:
      • These are added like other dynamic markings, attached with a backslash to the note where they begin. A crescendo is triggered with \< and a diminuendo with \>.
      • The left-most point of the marking (its beginning) is indicated by where you put \< or \>
      • The right-most (or end-)point is indicated by either another dynamic marking of any sort, or the special cancellation character (\!).
    • Italic "staccato" Text: \markup { \italic { staccato } }
    • Source File Measure Numbers: One of the techniques that can be used when inputting larger scores is writing measure numbers into the source file as comments. I usually write measure numbers every five measures, but it depends on the speed of the music, and what seems like it's useful.

Moving into the Fast Section

If you want to finish inputting the first movement, as an exercise, then you will also need to know how to write a tempo-change in an orchestral score:

  1. In order to continue, we'll need to include a special measure-line (barline) and a change-of-tempo indicator. This would be easy, and would display correctly, if we simply inputted the change in one particular voice. However, if we did that, the change would only appear in one of the orchestral parts exported from the score.
  2. We're going to define a new whatever-thing, like the "global" section created for us by Frescobaldi, and include it in all of the parts.
  3. The code needed for this is a little bit complicated, but you don't need to write it yourself: just take it from the "tempoMark" section created by Frescobaldi. All you need to do is change "Adagio" to "Allegro spiritoso," and add the barline indicator. This is also easy because of Frescobaldi: 'LilyPond > Bar Lines > Repeat start'
  4. You end up with
    startExposition =
    {
      \once \override Score.RehearsalMark #'self-alignment-X = #LEFT
      \once \override Score.RehearsalMark #'break-align-symbols = #'(time-signature key-signature)
      \mark \markup \bold "Allegro spiritoso"
      \bar "|:"
    }
    
  5. Add the reference to this in all of your parts. Because of how I named it, this also serves as a handy way to find your way through the LilyPond markup file.
      r4 r r\fermata |
      
      \startExposition
      
      R2.*4 |
    
  6. The barline and tempo-change will not appear unless you write some music after them, so put in some or all of the rests that follow, just to test it.