Changes

Jump to navigation Jump to search
1,318 bytes added ,  20:15, 22 February 2018
m
fix link of filter module
< [[Graphics]] | [[Using Graphics]] >
[http://lilypond.org LilyPond] is a great music engraver, and you can include LilyPond in ConTeXt source using [[moduleshttps://github.com/adityam/filter|the filter module]] with some setup.This is different from using the lilypond-book preprocessor with LaTeX. (For LaTeX there’s also a package that works similar to our ConTeXt setup here: [https://github.com/jperon/lyluatex lyluatex].)
== Simple Filter Setup ==
directory=lilytemp/, % directory for LilyPond's files
output={\externalfilterbasefile.pdf},
filtercommand={lilypond -dbackend=eps -dno-gs-load-fonts -dinclude-eps-fonts -ddelete-intermediate-files -o"lilytemp/\externalfilterbasefile" "\externalfilterinputfile"}]
</texcode>
directory=\LILYTEMP/,
output={\externalfilterbasefile.pdf},
filtercommand={lilypond -dbackend=eps -dinclude-eps-fonts -dno-gs-load-fonts -o"\LILYTEMP/\externalfilterbasefile" "\externalfilterinputfile"}]
</texcode>
You can avoid this \include line following [http://modules.contextgarden.net/dl/t-filter/doc/context/third/filter/filter.txt filter module documentation], section "Prepend and append text".
In short: you can inline your complete LilyPond settings or at least the include line:
 
<texcode>
\startbuffer[lilypond::settings]
\include "mysettings.ly"
\stopbuffer
 
\defineexternalfilter[lilypond][
...
bufferbefore={lilypond::settings},
...]
</texcode>
=== Sample Include File ===
<texcode>
\version "2.1618.02"
#(ly:set-option (quote no-point-and-click))
#(set-global-staff-size 14)
\override PaperColumn #'keep-inside-line = ##t
}
% some example settings
\context { \Staff
\override TimeSignature #'style = #'numbered
</texcode>
Please look up the meaning of settings in [http://lilypond.org/doc/v2.18/Documentation/web/manuals LilyPond’s great documentation]!
Unfortunately it’s not possible If you’d like to exchange measures like text width between ConTeXt and LilyPond , you could write those into the LilyPond buffer.To give LilyPond measures to ConTeXt, you would need to write them into a temp file (using Scheme) and read that in again (at least I’ve no idea howuseing Lua), so you must define sizes manually. And For the time being this is left as an exercise to the user. ;) Unfortunately you can’t define LilyPond’s text (lyrics) size with an absolute value, but only relative to staff size...
== Named Buffers ==
Normally, your LilyPond snippets just get a running number. If you re-order your scores, each one gets re-rendered.
You might want can avoid that if you name your LilyPond snippets: just add <tt>[name=myfunnyname]</tt> to add <cmd>startlilypond</cmd>. If you have just one LilyPond part per component (e.g. songs in a songbook), you could use <tt>[name=\currentcomponent]</tt> . == Automatical width adaption == If you want to set your note line width automatically to your current text width, try this:  -- this goes after "create temp folder" io.savedata(or name"\LILYTEMP/texsettings.ly", "\\paper { line-width =mymusic" .. string.gsub(number.todimen(tex.dimen.textwidth),"pt","\\pt") .. " } \n") to  and then adapt your snippets or preamble buffer:<cmdtexcode>startlilypond\include "../mysettings.ly"\include "texsettings.ly"</cmdtexcode> to avoid unnecessary re You must comment/delete the "line-renderingwidth" setting in mysettings.ly, otherwise it doesn’t work.
== Example ==
$ ulimit -n
256
$ ulimit -S -n 2048
== Deprecation ==

Navigation menu