This page is just a quick reference. If you want to know more detail, please refer to LilyPond User Manual.
Memo by the name of Learning LilyPond
Frequent errors
Reference: LilyPond User Manual
Note: I am afraid of that there are some funny descriptions in this page because I do not know a bit of music (and English). If you have any questions and/or suggestions, please let me know.
Acknowledgement: I would like to thank Watanabe-san and Kaya-san who have helped me create this page.
Memo by the name of Learning LilyPond
LilyPond is a drawing software under GPL for musical score exclusive use. LilyPond can draw musical notes on staff notation finely and output to PDF file and/or PNG file. It also outputs MIDI file. I can't compare it with other softwares because I have never user others, but I think it has enough functions. It supports Microsoft Windows, Linux, FreeBSD, etc.
Install all items of Cygwin, and you will use LilyPond on Microsoft Windows. Of course, you don't have to install all items, but that does it.
If you have no thought of using Japanese, you need no the next procedures. If you want to display title and/or lyrics in Japanese, you need to install pLaTeX and dvipsk. Simple installer of Web2C-7.5.2 (I updated this link to texinst755.zip but I have never check of operations with new version.) is useful to install them.
How to install pLaTeX and dvipsk
Y:\cygwin\usr\share\lilypond\2.0.1\fonts\afm\* -> X:\platex\share\texmf\fonts\afm\lilypond
Y:\cygwin\usr\share\lilypond\2.0.1\fonts\source\* -> X:\platex\share\texmf\fonts\source\lilypond
Y:\cygwin\usr\share\lilypond\2.0.1\fonts\tfm\* -> X:\platex\share\texmf\fonts\tfm\lilypond
Y:\cygwin\usr\share\lilypond\2.0.1\fonts\type1\* -> X:\platex\share\texmf\fonts\type1\lilypond
Y:\cygwin\usr\share\lilypond\2.0.1\dvips\lilypond.map -> X:\platex\share\texmf\dvips\config
Y:\cygwin\usr\share\lilypond\2.0.1\ps\* -> X:\platex\share\texmf\dvips\lilypond
Y:\cygwin\usr\share\lilypond\2.0.1\tex\* -> X:\platex\share\texmf\tex\latex\lilypond
Y:\cygwin\usr\share\texmf\fonts\source\jknappen\sauter\* -> X:\platex\share\texmf\fonts\source\sauter
Y:\cygwin\usr\share\texmf\tex\latex\misc\geometry.sty -> X:\platex\share\texmf\tex\latex\misc
Y:\cygwin\usr\share\texmf\tex\latex\graphics\keyval.sty -> X:\platex\share\texmf\tex\latex\graphics
If you try to create a musical score in Japanese, nothing but a musical score of PostScript file is created. So in most cases, you will convert the PostScript file to EPS, PDF, JPEG, etc. by Ghostscript and/or GSview. To run installer, double click icon of Ghostscript and GSview. After installation, copy msmincho.ttc and msgothic.ttc from %WinDir%\Fonts to X:\gs\fonts and add the next descriptions in X:\gs\gs8.14\lib\cidfmap.
/Ryumin-Light << /FileType /TrueType /Path (msmincho.ttc) /SubfontID 0 /CSI [(Japan1) 3] >> ;
/GothicBBB-Medium << /FileType /TrueType /Path (msgothic.ttc) /SubfontID 0 /CSI [(Japan1) 3] >> ;
If you open %WinDir%\Fonts by Explorer, you can not find foo.ttc. But if you use "Search" -> "For Files of Folders..." in Start menu, you will find it. To use Ghostscript with Japanese patch, you can assign absolute path and do not have to copy fonts.
cf. W32TeX, LilyPond Language ver2.4.2
For the time being, this is the program (isn't it?!) to draw sol-fa. The detail is omitted. After that, we modify and extend this source code.
--- foo.ly ---
\score {
\notes {
\time 3/4
\key c \major
\clef treble
c'4 d'4 e'4 |
\bar "|."
}
\paper { }
}
---
You execute LilyPond on bash...,
bash-2.05b$ ls foo.ly bash-2.05b$ lilypond foo.ly lilypond (GNU LilyPond) 2.0.1 Running usr... Now processing: `foo.ly' Parsing... Interpreting music...[2] Preprocessing graphical objects... Calculating line breaks... [2] paper output to `foo.tex'... Analyzing foo.tex... Running latex... Running dvips... Running ps2pdf... DVI output to `foo.dvi'... PDF output to `foo.pdf'... PS output to `foo.ps'... bash-2.05b$ ls foo.dvi foo.ly foo.pdf foo.ps bash-2.05b$
A beautiful PDF file is created like this.
To display Japanese, you need to execute not only
$ lilypond foo.lybut also
$ platex foo.latex
$ dvipsk foo.dvi
--- foo.ly ---
\header {
title = "曲名"
subtitle = "副題"
poet = "作詞"
composer = "作曲"
tagline = "タグ"
}
\score {
\notes {
\addlyrics
\new Staff {
\time 3/4
\key c \major
\clef treble
c'4 d'4 e'4 |
\bar "|."
}
\new Lyrics \lyrics { ド レ ミ }
}
\paper { }
}
---
Run lilypond for this file, and the following effect will be given.
bash-2.05b$ ls foo.ly bash-2.05b$ lilypond foo.ly lilypond (GNU LilyPond) 2.0.1 Running usr... Now processing: `foo.ly' Parsing... Interpreting music...warning: can't find ascii character: 131 [2] Preprocessing graphical objects... Calculating line breaks... warning: can't find ascii character: 131 warning: can't find ascii character: 131 warning: can't find ascii character: 140 [2] paper output to `foo.tex'... writing header field `title' to `foo.title'... writing header field `subtitle' to `foo.subtitle'... writing header field `composer' to `foo.composer'... writing header field `poet' to `foo.poet'... Analyzing foo.tex... Running latex... lilypond: error: LaTeX failed on the output file. lilypond: error: The error log is as follows: ! Package inputenc Error: Keyboard character used is undefined (inputenc) in inputencoding `latin1'. See the inputenc package documentation for explanation. Type H <return> for imme LATEX output to `foo.latex'... TEX output to `foo.tex'... bash-2.05b$ ls foo.latex foo.ly foo.tex bash-2.05b$ platex foo.latex This is pTeX, Version 3.141592-p3.1.3 (sjis) (Web2C 7.5.2) (./foo.latex pLaTeX2e <2001/09/04>+0 (based on LaTeX2e <2003/12/01> patch level 0) (c:/platex/share/texmf/tex/latex/base/article.cls Document Class: article 2004/02/16 v1.4f Standard LaTeX document class (c:/platex/share/texmf/tex/latex/base/size10.clo)) (c:/platex/share/texmf/tex/latex/misc/geometry.sty (c:/platex/share/texmf/tex/latex/graphics/keyval.sty)) (c:/platex/share/texmf/tex/latex/base/inputenc.sty (c:/platex/share/texmf/tex/latex/base/latin1.def)) (c:/platex/share/texmf/tex/latex/lilypond/titledefs.tex (c:/platex/share/texmf/tex/latex/lilypond/feta20.tex)) LaTeX Warning: Unused global option(s): [compat2]. No file foo.aux. (./foo.tex (c:/platex/share/texmf/tex/latex/lilypond/lilyponddefs.tex (c:/platex/share/texmf/tex/latex/lilypond/feta20.tex) (c:/platex/share/texmf/tex/latex/lilypond/lily-ps-defs.tex)) LaTeX Font Warning: Font shape `JY1/mc/m/sc' undefined (Font) using `JY1/mc/m/n' instead on input line 41. LaTeX Font Warning: Font shape `JT1/mc/m/sc' undefined (Font) using `JT1/mc/m/n' instead on input line 41. ) Overfull \vbox (0.7539pt too high) has occurred while \output is active [1] (./foo.aux) LaTeX Font Warning: Some font shapes were not available, defaults substituted. ) (see the transcript file for additional information) Output written on foo.dvi (1 page, 1344 bytes). Transcript written on foo.log. bash-2.05b$ ls foo.aux foo.dvi foo.latex foo.log foo.ly foo.tex bash-2.05b$ dvipsk foo.dvi This is dvips(k) 5.94a p1.6 Copyright 2003 ASCII Corp.(www-ptex@ascii.co.jp) based on dvips(k) 5.94a Copyright 2003 Radical Eye Software (www.radicaleye.com) ' TeX output 2004.05.02:1543' -> foo.ps <texc.pro><music-drawing-routines.ps><texps.pro><special.pro>. [1] bash-2.05b$ ls foo.aux foo.dvi foo.latex foo.log foo.ly foo.ps foo.tex bash-2.05b$
Open foo.ps by GSview, and the next picture will appear
You can save as EPS file by "Save As..." of "File"
menu. You can also convert JPEG or PNG by "Convert..." of "File"
menu.
You can draw in Japanese by above procedure, but this is not supported officially. Actually, there are some warnings and errors in above log. If you need to use Japanese, you should consider to use other software.
If you change "\clef treble" "\clef bass" in foo.ly, treble clef (G clef) become bass clef (F clef). There are other clefs like as "alto clef" or "tenor clef", but I never have a opportunity to use them.
Picture | Name | Syntax |
![]() |
Treble Clef | \clef treble |
![]() |
Bass Clef | \clef bass |
cf. Clef (LilyPond User Manual), Clef - Wikipedia
A key signature is a series of 'b' or '#' placed on the staff. Each picture has two name. For example, "\key c \major" and "\key a \minor" draw same picture.
Picture | Major Scale | Minor Scale | Alias Name | Syntax |
![]() |
C major | A minor | \key c \major \key a \minor |
|
![]() |
G major | E minor | \key g \major \key e \minor |
|
![]() |
D major | B minor | \key d \major \key b \minor |
|
![]() |
A major | F# minor | \key a \major \key fis \minor |
|
![]() |
E major | C# minor | \key e \major \key cis \minor |
|
![]() |
B major | G# minor | Cb major, Ab minor | \key b \major \key gis \minor |
![]() |
F# major | D# minor | Gb major, Eb minor | \key fis \major \key dis \minor |
![]() |
C# major | A# minor | Db major, Bb minor | \key cis \major \key ais \minor |
![]() |
F major | D minor | \key f \major \key d \minor |
|
![]() |
Bb major | G minor | \key bes \major \key g \minor |
|
![]() |
Eb major | C minor | \key ees \major \key c \minor |
|
![]() |
Ab major | F minor | \key aes \major \key f \minor |
|
![]() |
Db major | Bb minor | C# major, A# minor | \key des \major \key bes \minor |
![]() |
Gb major | Eb minor | F# major, D# minor | \key ges \major \key ees \minor |
![]() |
Cb major | Ab minor | B# major, G# minor | \key ces \major \key aes \minor |
cf. Key signature (LilyPond User Manual), Key signature - Wikipedia
Change \time 3/4 in foo.ly, and a time signature is changed. Because I have a tough time to draw 'C', I devote space for too easy thing.
Picture | Time | Syntax |
![]() |
2/2 | \time 2/2 |
![]() |
2/4 | \time 2/4 |
![]() |
3/4 | \time 3/4 |
![]() |
4/4 | \time 4/4 |
![]() |
3/8 | \time 3/8 |
![]() |
6/8 | \time 6/8 |
![]() |
9/8 | \time 9/8 |
cf. Time signature (LilyPond User Manual)
A bar line does not be drawn automatically, so you have to spacify it. A bar line can be drawn by \bar "|.". You can draw other various bar. \repeat is recommended for the picture which means repeat.
\score {
\notes {
\time 3/4
\key c \major
\clef treble
c'4 d'4 e'4 | f'4 g'4 a'4 |
\bar "|."
}
\paper { }
}
cf. Bar lines (LilyPond User Manual)
If you separate per bar by '|', LilyPond helps detect errors in the durations.
\score {
\notes {
\time 3/4
\key c \major
\clef treble
c'4 d'4 e'4 | d'4 e'4 f'8 | a'4 b'4 c'4 |
\bar "|."
}
\paper { }
}
bash-2.05b$ lilypond foo.ly lilypond (GNU LilyPond) 2.0.1 Running usr... Now processing: `foo.ly' Parsing... Interpreting music... /cygdrive/e/data/m/foo/foo.ly:6:30: warning: barcheck failed at: 5/8: c'4 d'4 e'4 | d'4 e'4 f'8 | a'4 b'4 c'4 | [3] Preprocessing graphical objects... Calculating line breaks... paper output to `foo.tex'... Analyzing foo.tex... Running latex... Running dvips... Running ps2pdf... DVI output to `foo.dvi'... PDF output to `foo.pdf'... PS output to `foo.ps'... bash-2.05b$
cf. Bar check (LilyPond User Manual)
How to draw musical note. Modify c'4 d'4 e'4 in foo.ly, and notes line up suitably.
\score {
\notes {
\time 3/4
\key c \major
\clef treble
b4 c'4 d'4 | e'4 f'4 g'4 | a'4 b'4 c''4 |
\bar "|."
}
\paper { }
}
\score {
\notes {
\time 3/4
\key c \major
\clef bass
c,4 c4 c'4 |
\bar "|."
}
\paper { }
}
\score {
\notes {
\time 4/4
\key c \major
\clef treble
c'1 | c'2 c'4 c'8 c'16 c'16 | c'2. c'4 | c'4. c'8 c'8. c'16 c'4 |
\bar "|."
}
\paper { }
}
r1 | r2 r4 r8 r16 r16 | r2. r4 | r4. r8 r8. r16 r4 |
c'4 c'4 ~ c'4 c'4 | c'4 d'4 ( e'4 ) f'4 | g'4 ( f'4 e'4. d'8 ) |
\score {
\notes {
\time 4/4
\key g \major
\clef treble
cis'4 cis'4 c'4 c'4 |
c'4 ces'4 ces'4 c'4 |
fis'4 fis'4 f'4 f'4 |
cis'4 cis'4 cis'!4 cis'?4 |
\bar "|."
}
\paper { }
}
I say nothing. Be enlightened to the truth. :) By the way, I can draw but can not understand. It is just a picture for me.
For this reason, I am due to end the section without explication, but it
is not kind so I try to write just a bit.
CDEFGABC is cdefgabc. A rest is 'r'.
Each , which is at the right of alphabet raises the pitch by one octave.
Each ' which is at the right of alphabet lowers the pitch by an octave.
A number which is at right of alphabet specifies a duration.
Each . which is at right of alphabet draw . at right of a note.
~ draws tie.
( and ) draw slur. ( is written at right of first note.
# is "is", b is "es".
cf. Notes (LilyPond User Manual)
To draw chord, enclose alphabets by < and > and write number to specify length at the right of >.
\score {
\notes {
\time 4/4
\key c \major
\clef treble
<c' e' g'>4 <e' g' c''>4 ( <c' e' g'>4 <e' g' c''>4 ) |
\bar "|."
}
\paper { }
}
cf. Chords (LilyPond User Manual)
To draw chord names, you can use "\context ChordNames \chords". Write first charactor such as 'c' or 'f', specify the length, and add ":7" or ":m" if needed. If you write s1*2 or something at the front, the position of first charactor will slip.
\score {
<<
\context ChordNames \chords { c2.*2 f2.:7 }
\notes {
\time 3/4
\key c \major
\clef treble
b4 c'4 d'4 | e'4 f'4 g'4 | a'4 b'4 c''4 |
\bar "|."
}
>>
\paper { }
}
I'm afraid that these chord names are inconsistent with notes. But never mind. This is NOT a score. This is just a picture drawn by LilyPond!
cf. A lead sheet (LilyPond User Manual), Printing chord names (LilyPond User Manual)
Beams are written automatically. Write \autoBeamOff, and automatic beams writing will be disabled. Write \autoBeamOn, and automatic beams writing will be reenabled. Enclose notes by [], and you will draw beams freely. [ is written at the right of the first note.
\score {
\notes {
\time 2/4
\key c \major
\clef treble
c'8 c'8 c'8 c'8 | c'8 c'8 [ c'8 c'8 ] | \autoBeamOff c'8 c'8 c'8 c'8 | \break
\autoBeamOn c'8 c'8 c'8. c'16 | \autoBeamOff c'8 c'8 c'8. c'16 | c'8 [ c'8 ] c'8. [ c'16 ]
\bar "|."
}
\paper { }
}
cf. Beaming (LilyPond User Manual)
It seems that there are tuplets in the world. Aside from a mean of tuplets, you can draw by "\time 2/3 {}". 2/3 means that there are three notes in the "{}" and the length of them is 2 original notes, I think.
\score {
\notes {
\time 3/4
\key c \major
\clef treble
c'4 c'4 \times 2/3 { c'8 c' c' } | r4 r4 \times 2/3 { r8 r r } |
\bar "|."
}
\paper { }
}
cf. Tuplets (LilyPond User Manual)
How to draw parent-child notes. Please do not ask me about the meaning of them.
\score {
\notes {
\time 3/4
\key c \major
\clef treble
c'4 \acciaccatura a'8 d'4 \appoggiatura b'8 e'4 |
\bar "|."
}
\paper { }
}
cf. Grace notes (LilyPond User Manual)
Line breaks are normally computed automatically. Occasionally you might want to override the automatic breaks; you can do this by specifying \break.
\score {
\notes {
\time 3/4
\key c \major
\clef treble
c'4 d'4 e'4 | \break
f'4 g'4 a'4 |
\bar "|."
}
\paper { }
}
To break in the middle of bar, you have to write an invisible bar \bar "" before \break.
\score {
\notes {
\time 3/4
\key c \major
\clef treble
c'4 d'4 e'4 | f'4 g'4 \bar "" \break
a'4 |
\bar "|."
}
\paper { }
}
cf. Line breaking (LilyPond User Manual)
Do the next, and dual parts will be drawn side-by-side as chorus score.
\score {
\context ChoirStaff \notes
<< \new Staff {
\time 3/4
\key c \major
\clef treble
c'4 d'4 e'4 |
\bar "|."
}
\new Staff {
\clef bass
c4 d4 e4 |
}
>>
\paper { }
}
To add new part at the middle, write R at no notes area and add last \paper description. To also drop out at the middle, write R.
\score {
\context ChoirStaff \notes
<< \new Staff {
\time 3/4
\key c \major
\clef treble
c'4 d'4 e'4 | \break
a'4 b'4 c'4 |
\bar "|."
}
\new Staff {
\clef bass
R2. |
c4 d4 e4 |
}
>>
\paper {
\translator {
\RemoveEmptyStaffContext
}
}
}
cf. Combining music into compound expressions (LilyPond User Manual), Hiding staves (LilyPond User Manual)
Of course, you can draw two parts on the same on a stuff. The first part has up-stem, and the next part has down-stem. To draw a rest, write 'r' on the first part and write 's' on the next part. If you write 'r' on both parts, two rests is drawn on a stuff.
\score {
\notes {
\time 4/4
\key c \major
\clef treble
<<{ c''4 c'4 a'4 r4 | } \\ { c'4 c''4 a'4 s4 | }>>
\bar "|."
}
\paper { }
}
Polyphony (LilyPond User Manual)
For upsteps, use \partial and specify length of notes which in the first bar
\score {
\notes {
\time 3/4
\key c \major
\clef treble
\partial 4*2
c'4 d'4 | e'4 f'4 g'4 |
\bar "|."
}
\paper { }
}
\score {
\context ChoirStaff \notes
<< \new Staff {
\time 3/4
\key c \major
\clef treble
\partial 4
c'4 | d'4 e'4 f'4 |
\bar "|."
}
\new Staff {
\clef bass
c4 | d4 e4 f4 |
}
>>
\paper { }
}
cf. Partial measures (LilyPond User Manual)
Enclose repeat part by "\repeat volta n { }", and you will draw picture to feel tempted to repeat n times. To separate along the way, use \alternative. If you specify bar line \bar "|.", repeat sign is overwritten.
\score {
\notes {
\time 3/4
\key c \major
\clef treble
\repeat volta 2 { c'4 d'4 e'4 | }
}
\paper { }
}
\score {
\notes {
\time 3/4
\key c \major
\clef treble
c'4 d'4 e'4 | \repeat volta 2 { f'4 g'4 a'4 | }
}
\paper { }
}
\score {
\notes {
\time 3/4
\key c \major
\clef treble
c'4 d'4 e'4 | \repeat volta 3 { f'4 g'4 a'4 | } \alternative { { c'4 c'4 c'4 | } { a'4 a'4 a'4 | } }
\bar "|."
}
\paper { }
}
When you want to draw odd picture, you can write aggressively as below.
\score {
\notes {
\time 3/4
\key c \major
\clef treble
c'4 d'4 e'4 |
\property Score.repeatCommands = #'((volta "1 3")) f'4 g'4 a'4 \property Score.repeatCommands = #'((volta #f)) |
b'4 c''4 d''4 | \bar ":|" \break
\property Score.repeatCommands = #'((volta "2 4")) c'4 d'4 e'4 \property Score.repeatCommands = #'((volta #f)) |
f'4 g'4 a'4 |
\bar "|."
}
\paper { }
}
cf. Repeat syntax (LilyPond User Manual)
You can draw piano and forte by ^\p and ^\f. If you do not specify '^', it is drawn below.
\score {
\notes {
\time 3/4
\key c \major
\clef treble
s1*0^\p
c'4 d'4\f e'4^\mp |
\bar "|."
}
\paper { }
}
's' is skip sign. But if there is *0, s is ignored and piano is inserted at the 's'.
cf. Dynamics (LilyPond User Manual)
Crescendo starts from ^\< and stop at \!. Decrescendo starts from ^\>. If you do not specify '^', it is drawn below.
\score {
\notes {
\time 3/4
\key c \major
\clef treble
c'4 d'4^\< e'4 | f'4\! g'4\> a'4 | b'4 c''4\! r4 |
\bar "|."
}
\paper { }
}
cf. Dynamics (LilyPond User Manual)
Staccato, tenuto, accent and fermata are drawn as folloows. If you do not specify '^' of fermata, it is drawn below.
\score {
\notes {
\time 4/4
\key c \major
\clef treble
c'4-. d'4-- e'4-> f'4^\fermata |
\bar "|."
}
\paper { }
}
cf. Articulations (LilyPond User Manual)
Breath is inserted as follows.
\score {
\notes {
\time 3/4
\key c \major
\clef treble
c'4 \breathe d'4 e'4 \mark \markup { \musicglyph #"scripts-upedaltoe" } |
f'4 \mark \markup { \musicglyph #"scripts-upedaltoe" } g'4 a'4 |
\bar "|."
}
\paper { }
}
cf. Breath marks (LilyPond User Manual)
There are two way to write string in a score. One is easy way and another is difficult way. In the first case, you can write string enclosed by "". In the second case, \markup is used. In the second case, you can use \italic, \bold and \column. In both cases, they can be forced up or down using ^ and _, eg.
\score {
\notes {
\time 3/4
\key c \major
\clef treble
c'4^"foo" d'4_"bar" e'4^\markup{ \italic baz } | f'4_\markup { \bold aaa } g'4^\markup { \column < 1 2 " " 3 > } a'4 |
\bar "|."
}
\paper { }
}
cf. Text scripts (LilyPond User Manual), Text markup (LilyPond User Manual)
To display title, composer and/or something, you have to add header in foo.ly as follows.
\header {
title = "Title"
subtitle = "Subtitle"
poet = "Poet"
composer = "Composer"
tagline = "Tagline"
}
\score {
\notes {
\time 3/4
\key c \major
\clef treble
c'4 d'4 e'4 |
\bar "|."
}
\paper { }
}
Tagling is drawn at the end of each page.
cf. Titling layout (LilyPond User Manual)
To write lyrics, do as follows. Please refer to LilyPond User Manual for detail.
\score {
\notes {
\addlyrics
\new Staff {
\time 3/4
\key c \major
\clef treble
c'4 d'4 e'4 |
\bar "|."
}
\new Lyrics \lyrics { C D E }
}
\paper { }
}
\score {
\context ChoirStaff \notes
<< \new Lyrics \lyrics { C'' D'' E'' }
\new Staff {
\time 3/4
\key c \major
\clef treble
<<{ c''4 d''4 e''4 | } \\ { c'4 d'4 e'4 | }>>
\bar "|."
}
\new Lyrics \lyrics { C' D' E' }
\new Lyrics \lyrics { F G A }
\new Staff {
\clef bass
<<{ f4 g4 a4 } \\ { c4 d4 e4 | }>>
}
\new Lyrics \lyrics { C D E }
>>
\paper { }
}
cf. Printing lyrics (LilyPond User Manual), Entering lyrics (LilyPond User Manual)
Add --png option to execute LilyPond on bash, and PNG file will be created.
bash-2.05b$ ls foo.ly bash-2.05b$ lilypond --png foo.ly lilypond (GNU LilyPond) 2.0.1 Running usr... Now processing: `foo.ly' Parsing... Interpreting music...[2] Preprocessing graphical objects... Calculating line breaks... [2] paper output to `foo.tex'... Analyzing foo.tex... Running latex... Running dvips... Running ps2pdf... Running gs... DVI output to `foo.dvi'... PDF output to `foo.pdf'... PS output to `foo.ps'... PNG output to `foo-page1.png'... bash-2.05b$ ls foo-page1.png foo.dvi foo.ly foo.pdf foo.ps bash-2.05b$
cf. Invoking LilyPond (LilyPond User Manual)
Add \midi { } at the end of \score in foo.ly, and MIDI file will be created.
--- foo.ly ---
\score {
\notes {
\time 3/4
\key c \major
\clef treble
c'4 d'4 e'4 |
\bar "|."
}
\paper { }
\midi { }
}
---
Execute LilyPond on bash, and you will see created MIDI file.
bash-2.05b$ ls foo.ly bash-2.05b$ lilypond foo.ly lilypond (GNU LilyPond) 2.0.1 Running usr... Now processing: `foo.ly' Parsing... Interpreting music...[2] Preprocessing graphical objects... Calculating line breaks... [2] paper output to `foo.tex'... Interpreting music... MIDI output to `foo.midi'... Track ... Analyzing foo.tex... Running latex... Running dvips... Running ps2pdf... DVI output to `foo.dvi'... MIDI output to `foo.midi'... PDF output to `foo.pdf'... PS output to `foo.ps'... bash-2.05b$ ls foo.dvi foo.ly foo.midi foo.pdf foo.ps bash-2.05b$
cf. Percussion MIDI output (LilyPond User Manual)
Frequent errors
bash-2.05b$ lilypond foo.ly lilypond (GNU LilyPond) 2.0.1 Running usr... Now processing: `foo.ly' Parsing... Interpreting music...[2] Preprocessing graphical objects... Calculating line breaks... [2] paper output to `foo.tex'... Analyzing foo.tex... Running latex... Running dvips... Running ps2pdf... DVI output to `foo.dvi'... Traceback (most recent call last): File "/usr/bin/lilypond", line 975, in ? ly.cp_to_dir ('.*\.%s$' % ext, outdir) File "/usr/share/lilypond/2.0.1/python/lilylib.py", line 362, in cp_to_dir map (lambda x, d=dir: shutil.copy2 (x, os.path.join (d, x)), files) File "/usr/share/lilypond/2.0.1/python/lilylib.py", line 362, in <lambda> map (lambda x, d=dir: shutil.copy2 (x, os.path.join (d, x)), files) File "/usr/lib/python2.3/shutil.py", line 82, in copy2 copyfile(src, dst) File "/usr/lib/python2.3/shutil.py", line 38, in copyfile fdst = open(dst, 'wb') IOError: [Errno 13] Permission denied: '/cygdrive/h/data/20040214/m/foo/foo.pdf' bash-2.05b$
How to solve the problem.
Once close PDF file and reexecute the next command.
$ lilypond foo.ly
bash-2.05b$ lilypond --png foo.ly lilypond (GNU LilyPond) 2.0.1 Running usr... Now processing: `foo.ly' Parsing... /cygdrive/e/data/m/jpg/foo.ly:30:5: error: syntax error, unexpected M OREMORE: > > /cygdrive/e/data/m/jpg/foo.ly:37:6: error: syntax error, unexpected M IDI: \mid i { \tempo 4=90 } /cygdrive/e/data/m/jpg/foo.ly:38:7: error: syntax error, unexpected P APER: \pape r {} /cygdrive/e/data/m/jpg/foo.ly:12:5: warning: Braces don't match: \scor e { lilypond: error: LilyPond failed on input file foo (exit status 1) lilypond: warning: Running LilyPond failed. Rerun with --verbose for a trace. Traceback (most recent call last): File "/usr/bin/lilypond", line 933, in ? resolution = preview_resolution File "/usr/share/lilypond/2.0.1/python/lilylib.py", line 455, in make_ps_image s header = open (ps_name).read (1024) IOError: [Errno 2] No such file or directory: 'foo.ps' bash-2.05b$
How to solve the problem.
Change { to |.
bash-2.05b$ lilypond foo.ly lilypond (GNU LilyPond) 2.0.1 Running usr... Now processing: `foo.ly' Parsing... /cygdrive/x/foo/foo.ly:3:40: error: Have to be in Lyric mode for lyrics: \context ChordNames \chords { C2.*2 f2.:7 } lilypond: error: LilyPond failed on input file foo (exit status 1) lilypond: warning: Running LilyPond failed. Rerun with --verbose for a trace. bash-2.05b$
How to solve the problem.
Typint chord names in a lower case letter.