GNU Lilypond

Table of Contents

It was originally part of the TeX

1. Control

1.1. Notes

Notes are surrounded by curly braces { NOTES }. Curly braces create an object containing a sequence of notes.

\relative { NOTES } means the raising and lowering an octave is relative to the previous note.

  • Pitch:
    • a to g. with c being the middle C. Notes must be in lowercase.
    • Accidental: is, es after the name. (e.g. ais)
    • r rest
    • n' to raise an octave
    • n, to lower an octave.
  • Length: 1 - 16 for Nth notes. . to add the dot.
  • Articulation: -^, ->, -., --, -_ after the name.
  • Beaming: [ <notes> ] after a note
  • Slur: ( <notes> )
  • Tie: ~, only the length needs to be specified.
  • Chord: surround the notes with angle brackets < NOTES >
  • Simultaneous Expression: << SEQUENCES >>. Multiple sequences are stacked.
  • Tuplet: \tuplet FRACTION { NOTES }
    • e.g. \tuplet 3/2 { b4 4 4 }

1.2. Measures

  • \clef treble|alto|tenor|bass|...
  • \key A \major|\minor
  • \time N/N
  • \tempo "DESC" N = NNN
  • \repeat volta|segno|unfold|... N { NOTES }
  • \bar "FORMAT"
  • | is used for the compiler to check the bar length mismatch

1.3. Macros

Variables can be defined in normal way VAR = EXPR

Expression can be a staff, note sequences

% starts a comment

1.4. Structure

\book {
  \score {
    \new Staff {
      \new Voice {
        \relative {
          c''4 a b c
        }
      }
    }
    \header {
      title = "TITLE"
      composer = "COMPOSER"
    }
    \layout { }
    \midi { }
  }
}

Any missing structure is implicitly created.

1.4.1. Staff

Staff can be manually generated by \new Staff [\with { CONFIG }] { SUBSTRUCTURE } commands. Otherwise the default staff is used.

  • \numericTimeSignature
  • \omit SYMBOL Clef
  • \override StaffSymbol.line-count = #N
  • \clef treble|alto|tenor|bass|...
  • \time FRACTION
  • \tempo "DESC" N = NNN
  • OBJECT.stencil = ##f remove the symbol
  • instrumentName = "NAME" set the instrument name of the staff
  • \break: new line

Multiple staffs can be combined with << STAFFS >>.

\new here creates new notation context in which all environments are reset.

1.5. Options

  • #(ly:set-option 'SYM #t) sets the -dSYM flag

1.6. Paper

1.6.1. Notation Font

  • Copy the font files into /usr/share/lilypond/current/fonts/otf
  • #(define fonts (set-global-fonts #:music "FONTNAME" #:brace "FONTNAME")
  • The default font is Feta from the Emmentaler set

2. CLI

2.1. lilypond

  • .ly file
  • --format=FORMAT change the main output format
  • --svg, --png additionally generate image files
  • -dSYM --define-defaults[SYM[=VAL]|no-SYM]=
    • preview to compile the first line, or in musical term, the first system.
    • crop to crop the image to the content
    • resolution
    • paper-size
    • backend: Either 'ps or 'svg
    • help

2.2. lilypond-book

  • .lytex file
  • Compile a ./tex.html file containing lilypond environment.

3. References

Author: Jeemin Kim

Created: 2026-07-12 Sun 14:28