Difference between revisions of "LilyPond"
m (windows workaround for lilypond) |
(Updated page to reflect the existence of t-lilypond.tex) |
||
Line 1: | Line 1: | ||
− | < [[Graphics]] | [[Using Graphics]] > | + | < [[Graphics]] | [[Using Graphics]] > |
− | [http://www.lilypond.org LilyPond] is a great music engraver, and | + | [http://www.lilypond.org LilyPond] is a great music engraver, and you can include LilyPond in ConTeXt source using [http://modules.contextgarden.net/t-lilypond the lilypond module.] |
== Setup == | == Setup == | ||
* First you need a working [http://www.lilypond.org LilyPond] installation plus dependencies like GhostScript. | * First you need a working [http://www.lilypond.org LilyPond] installation plus dependencies like GhostScript. | ||
− | * | + | * Include the lilypond module |
+ | <texcode> | ||
+ | \usemodule[lilypond] | ||
+ | </texcode> | ||
+ | * If you want, you can change the default settings using <cmd>setuplilypond</cmd> | ||
== Snippets == | == Snippets == | ||
<texcode> | <texcode> | ||
− | There are some notes \ | + | There are some notes \lilypond{ \relative{bes a c b} } embedded in this line. |
</texcode> | </texcode> | ||
Line 21: | Line 25: | ||
\section{A Tune} | \section{A Tune} | ||
− | \ | + | \startlilypond |
\relative { | \relative { | ||
\repeat volta 2 { | \repeat volta 2 { | ||
Line 49: | Line 53: | ||
} | } | ||
} | } | ||
− | \ | + | \stoplilypond |
There's nothing to say about this tune yet; my friend heard it from Lúnasa. | There's nothing to say about this tune yet; my friend heard it from Lúnasa. | ||
Line 56: | Line 60: | ||
== Developer's Corner == | == Developer's Corner == | ||
− | + | For information how the integration works, please check the module code and its pdf version (both available from [http://modules.contextgarden.net/t-lilypond]). Unlike lilypond-book for LaTeX, the module does not use a precompiling step and thus can react to local width changes and the like, even if the lilypond code is stored in a buffer. | |
− | |||
− | + | Things that have not been implemented yet include: | |
* set the text font (default should be ConTeXt's bodyfont instead of LilyPond's) | * set the text font (default should be ConTeXt's bodyfont instead of LilyPond's) | ||
− | * | + | * make lilypond call back on ConTeXt for included TeX (cf. [http://lsr.dsi.unimi.it/LSR/Item?id=107]) |
− | * | + | * get information from lilypond about the baseline, for run-in music fragments |
− | * | + | * tell lilypond how much space is left on the first page |
+ | * check and probably work on proper multi-page music | ||
LilyPond uses fontconfig for font search. At least on MacOS X it's very restricted what kind of fonts it can use - only single-style TrueType (including dfont). I didn't manage yet to use fonts from the TeX tree. (That doesn't seem to be fontconfig's fault - it writes appropriate font cache files everywhere.) | LilyPond uses fontconfig for font search. At least on MacOS X it's very restricted what kind of fonts it can use - only single-style TrueType (including dfont). I didn't manage yet to use fonts from the TeX tree. (That doesn't seem to be fontconfig's fault - it writes appropriate font cache files everywhere.) | ||
Line 70: | Line 74: | ||
* see [http://lilypond.org/doc/v2.7/Documentation/out-www/ LilyPond Docs]! | * see [http://lilypond.org/doc/v2.7/Documentation/out-www/ LilyPond Docs]! | ||
* How do we handle version/syntax changes of LilyPond? | * How do we handle version/syntax changes of LilyPond? | ||
− | |||
− | --[[User:Hraban|Hraban]] 2005-08-20 | + | --[[User:Hraban|Hraban]] 2005-08-20, lots of changes by [[User:ChristopherCreutzig|Christopher Creutzig]] 2005-09-21 |
== Workarounds == | == Workarounds == | ||
− | Calling lilypond from command line in Windows fails. (Seems like a bug in lilypond.) You have | + | Calling lilypond from command line in Windows fails. (Seems like a bug in lilypond.) |
+ | |||
+ | You have two options: | ||
+ | * modify the module, so that lilypond is called with the whole path (<code>C:/prog/lilypond/usr/bin/lilypond</code> for example instead of <code>lilypond</code> alone). | ||
+ | * place a <code>lilypond.bat</code> somewhere in your search path, calling | ||
+ | c:/prog/lilypond/usr/bin/lilypond %1 %2 %3 %4 %5 %6 %7 %8 %9 | ||
[[Category:Modules]] | [[Category:Modules]] | ||
[[Category:Music]] | [[Category:Music]] | ||
[[Category:Requests]] | [[Category:Requests]] |
Revision as of 16:38, 21 September 2005
< Graphics | Using Graphics >
LilyPond is a great music engraver, and you can include LilyPond in ConTeXt source using the lilypond module.
Setup
- First you need a working LilyPond installation plus dependencies like GhostScript.
- Include the lilypond module
\usemodule[lilypond]
- If you want, you can change the default settings using \setuplilypond
Snippets
There are some notes \lilypond{ \relative{bes a c b} } embedded in this line.
Sections
E.g. for a songbook you want to place big chunks of LilyPond output (i.e. note staffs) in your text. It behaves like any other graphics, especially similar to embedded MetaPost code:
\section{A Tune} \startlilypond \relative { \repeat volta 2 { \partial 4 e4 | a2 c4 d | e2 f4 e | d2. c4 | b4. c8 d4 e | a,2 c4 d | e2 f4 e | g,2 a | \partial 2. b2. | } \repeat volta 2 { \partial 4 r4 | f' g f d | e f e c | a b c d | e2. e4 | f g f8 e d4 | e f e c | a c b8 a g4 | } \alternative { { \partial 2. g2. } { \partial 2. a2. } } } \stoplilypond There's nothing to say about this tune yet; my friend heard it from Lúnasa.
Developer's Corner
For information how the integration works, please check the module code and its pdf version (both available from [1]). Unlike lilypond-book for LaTeX, the module does not use a precompiling step and thus can react to local width changes and the like, even if the lilypond code is stored in a buffer.
Things that have not been implemented yet include:
- set the text font (default should be ConTeXt's bodyfont instead of LilyPond's)
- make lilypond call back on ConTeXt for included TeX (cf. [2])
- get information from lilypond about the baseline, for run-in music fragments
- tell lilypond how much space is left on the first page
- check and probably work on proper multi-page music
LilyPond uses fontconfig for font search. At least on MacOS X it's very restricted what kind of fonts it can use - only single-style TrueType (including dfont). I didn't manage yet to use fonts from the TeX tree. (That doesn't seem to be fontconfig's fault - it writes appropriate font cache files everywhere.)
To remember:
- see LilyPond Docs!
- How do we handle version/syntax changes of LilyPond?
--Hraban 2005-08-20, lots of changes by Christopher Creutzig 2005-09-21
Workarounds
Calling lilypond from command line in Windows fails. (Seems like a bug in lilypond.)
You have two options:
- modify the module, so that lilypond is called with the whole path (
C:/prog/lilypond/usr/bin/lilypond
for example instead oflilypond
alone). - place a
lilypond.bat
somewhere in your search path, calling
c:/prog/lilypond/usr/bin/lilypond %1 %2 %3 %4 %5 %6 %7 %8 %9