[icon]

GNU LilyPond

Welcome to the home of the GNU Music Typesetter

What is LilyPond
General information
Simple examples
Complex examples
Download
GNU/Linux binaries
Windows
Source code
Documentation
Tutorial
Manual
Glossary
other ...

Support
Mailing lists
Search
WikiWiki
FAQs

External sites
lilypond.org/development
lilypond.org/stable
ftp.lilypond.org
Mutopia
Other music online

Node:More movements, Next:, Previous:Lyrics and chords, Up:Tutorial



More movements

[FIXME: merge here with, or move this to: Other ways to run LilyPond]

You probably ran ly2dvi on the last example, and ended up with a viewable .dvi file. However, between there are a few steps of which LilyPond is only one. To enhance your understanding of what's happening under the hood when you run ly2dvi, we explain what programs are run.

ly2dvi is a program that calls a number of programs in sequence. The first thing it does, is running LilyPond on the input file. After some calculations, a .tex is produced. The contents of this file are very low-level instructions.

For example, consider the following file (miniatures.ly)

\version "1.4.0"
\header {
  title = "Two miniatures"
  tagline = "small is beautiful"
}

#(set! point-and-click line-column-location)

\paper { linewidth = -1.0 }

\score {
    \notes { c'4 d'4 }
    \header {
        opus = "Opus 1."
        piece = "Up" }
}
\score {
    \notes { d'4 c'4 }
    \header {
        opus = "Opus 2."
        piece = "Down" }
}

The titling in this manual was not generated by ly2dvi, so we can't exactly show what it would look like, but the result should resemble this:

Two miniatures
Opus 1.
Up

[picture of music]

Opus 2.
Down

[picture of music]

This file is produced by ly2dvi in a few stages, with the help of text formatting tools. LilyPond produces two output files, miniatures.tex and miniatures-1.tex. Both files contain only graphical music notation. ly2dvi looks at what output LilyPond produces, and adds page layout and titling to those files. The result is a DVI file called miniatures.dvi.

Next, now we'll look at the example line by line to explain new things.

***


\version "1.4.0"
Lilypond and its language are still under development, and occasionally, details of the syntax are changed. This fragment indicates for which version the input file was written. When you compile this file, the version number will be checked, and you will get a warning when the file is too old.

This version number is also used by the convert-ly program (See convert-ly), which is used to update the file to the latest lily version.

***


  \header {
    title = "Two miniatures"  }
This sets the titling information for the entire file.

***


    tagline = "small is beautiful"
A signature line is printed at the bottom of the last page. This signature is produced from the tagline field of \header. Many people find the default "Lily was here, version number" too droll. If that is the case, assign something else to tagline, as shown above.

***


        #(set! point-and-click line-column-location)

This piece of Scheme code sets the Scheme variable point-and-click to the value line-column-location (which itself is a Scheme procedure).

Editing input files can be quite complicated if you're working with large files: if you're digitizing existing music, you have to synchronize the .ly file, the sheet music on your lap and the sheet music on the screen. The point-and-click mechanism makes it easy to find the origin of an error in the LY file: when you view the file with Xdvi and click on a note, your editor will jump to the spot where that note was entered. For more information, see Point and click.

***


  \paper {

The \score blocks that follow in the file don't have \paper sections, so the settings of this block are substituted: A paper block at top level, i.e. not in a \score block sets the default page layout.

***


  linewidth = -1.0 }

The variable linewidth normally sets the length of the systems on the page. However, a negative value has a special meaning. If linewidth is less than 0, no line breaks are inserted into the score, and the spacing is set to natural length: a short phrase takes up little space, a longer phrase more space.

***


  \score {
    \notes { c'4 d'4 }

In previous examples, notes were specified in relative octaves, i.e. each note was put in the octave that is closest to its predecessor. Besides relative, there is also absolute octave specification, which you get when you don't specify \relative. In this input mode, the central C is denoted by c'. Going down, you get c c, c,, etc. Going up, you get c'' c''' etc.

When you're copying music from existing sheet music, relative octaves are probably the easiest to use: it's less typing work and errors are easily spotted. However, if you write LilyPond input directly, either by hand (i.e. composing) or by computer, absolute octaves may be easier to use.

***


    \header {

The \header is normally at the top of the file, where it sets values for the rest of the file. If you want to typeset different pieces from one file (for example, if there are multiple movements, or if you're making an exercise book), you can put different \score blocks into the input file. ly2dvi will assemble all LilyPond output files into a big document. The contents of \header blocks specified within each score, are used for the titling of each movement.

***


        opus = "Opus 1."
        piece = "Up" }
For example, the Opus number is put at the right, and the piece string will be at the left.
Go back to index of LilyPond.

Please send GNU LilyPond questions and comments to lilypond-user@gnu.org.

Please send comments on these web pages to lilypond@packages.debian.org

Copyright (c) 1997--2001 Han-Wen Nienhuys and Jan Nieuwenhuizen.

Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved.


This page was built from LilyPond-1.4.12 (stable-branch) by

Anthony Fok <lilypond@packages.debian.org>, Tue Mar 12 01:35:39 2002 HKT.