From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/31193 Path: news.gmane.org!not-for-mail From: Henning Hraban Ramm Newsgroups: gmane.comp.tex.context Subject: Re: LilyPond module for LilyPond 2.9.x Date: Wed, 4 Oct 2006 02:18:07 +0200 Message-ID: <0A36AB5D-B304-457F-84E5-4A4A103215A8@fiee.net> References: <670FE057-FCF8-45F7-AADC-B1B7C947DFF3@fiee.net> <45198C5C.90703@wxs.nl> <6A5E87EB-EBA4-4590-9E46-20812EB3EB36@fiee.net> <451A2E76.8040409@wxs.nl> <46A8585E-FD51-407F-BF80-542AC670FC23@fiee.net> <2A33D7FE-54BC-4FBC-92E3-C0DD94FF0FE3@fiee.net> <6faad9f00610031459u632f7ccaq48281b340750d0ce@mail.gmail.com> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 (Apple Message framework v752.2) Content-Type: multipart/mixed; boundary=Apple-Mail-5--922222911 X-Trace: sea.gmane.org 1159921125 25577 80.91.229.2 (4 Oct 2006 00:18:45 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 4 Oct 2006 00:18:45 +0000 (UTC) Original-X-From: ntg-context-bounces@ntg.nl Wed Oct 04 02:18:38 2006 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from ronja.vet.uu.nl ([131.211.172.88] helo=ronja.ntg.nl) by ciao.gmane.org with esmtp (Exim 4.43) id 1GUuT2-0002m4-5A for gctc-ntg-context-518@m.gmane.org; Wed, 04 Oct 2006 02:18:32 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id CB4F31FE80; Wed, 4 Oct 2006 02:18:31 +0200 (CEST) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (smtp.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 05804-01-3; Wed, 4 Oct 2006 02:18:24 +0200 (CEST) Original-Received: from ronja.vet.uu.nl (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id B4B3E1FE74; Wed, 4 Oct 2006 02:18:23 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id CA6691FE74 for ; Wed, 4 Oct 2006 02:18:18 +0200 (CEST) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (smtp.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 05804-01-2 for ; Wed, 4 Oct 2006 02:18:11 +0200 (CEST) Original-Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.171]) by ronja.ntg.nl (Postfix) with SMTP id BC2091FE6F for ; Wed, 4 Oct 2006 02:18:09 +0200 (CEST) Original-Received: from [83.77.63.106] (helo=[10.128.9.3]) by mrelayeu.kundenserver.de (node=mrelayeu3) with ESMTP (Nemesis), id 0MKxQS-1GUuSe2w8I-0005hX; Wed, 04 Oct 2006 02:18:09 +0200 In-Reply-To: <6faad9f00610031459u632f7ccaq48281b340750d0ce@mail.gmail.com> Original-To: mailing list for ConTeXt users X-Mailer: Apple Mail (2.752.2) X-Provags-ID: kundenserver.de abuse@kundenserver.de login:71ece21a21b2fa6ef1812787a4eaee0e X-Virus-Scanned: amavisd-new at ntg.nl X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.7 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: ntg-context-bounces@ntg.nl Errors-To: ntg-context-bounces@ntg.nl X-Virus-Scanned: amavisd-new at ntg.nl Xref: news.gmane.org gmane.comp.tex.context:31193 Archived-At: --Apple-Mail-5--922222911 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Am 2006-10-03 um 23:59 schrieb Mojca Miklavec: > I cannot test since lilypond is not working properly on my computer, > but I get the proper numbers. > > Here's an excerpt from the log file (I changed lilypond to echo): > > systems : begin file test1 at line 2 > > system(echo test1-lilypond-1.tmp)...executed. > > system(epstopdf test1-lilypond-1.eps)...executed. > > (C:\Programi\MikTeX\tex\context\base\pdfr-ec.tex) > figures : figure test1-lilypond-1 can not be found > color : mpcmyk color space is supported > color : mpspot color space is supported > color : system rgb is local activated > > system(echo test1-lilypond-2.tmp)...executed. > > system(epstopdf test1-lilypond-2.eps)...executed. I just updated my whole installation, but it's still the same: structure : begin of sectionblock bodymatter systems : begin file c_weihgeist at line 32 (./c_weihgeist.tex Titel : - Kom|m| nun|,| weihnachtlicher Geis|t.| figures : figure prd_winternacht-lilypond-1.pdf can not be found figures : figure prd_winternacht-lilypond-2.pdf can not be found ) systems : end file c_weihgeist at line 32 systems : begin file c_ansingen at line 33 (./c_ansingen.tex [3.1] Titel : - Winteransingen figures : figure prd_winternacht-lilypond-3.pdf can not be found ) ... TeXUtil | running texmfstart --ifchanged=prd_winternacht- lilypond-1.tmp --exec bin:lilypond -b eps -dno-gs-load-fonts - dinclude-eps-fonts prd_winternacht-lilypond-1.tmp GNU LilyPond 2.9.18 Processing `prd_winternacht-lilypond-1.tmp' Parsing... Interpreting music... [8][13] Preprocessing graphical objects... Writing prd_winternacht-lilypond-1-systems.tex... Writing prd_winternacht-lilypond-1-systems.texi... Layout output to `prd_winternacht-lilypond-1-1.eps'... Converting to `prd_winternacht-lilypond-1-1.pdf'... Layout output to `prd_winternacht-lilypond-1.eps'... Converting to `prd_winternacht-lilypond-1.pdf'... TeXUtil | running texmfstart --ifchanged=prd_winternacht- lilypond-1.tmp --exec bin:lilypond -b eps -dno-gs-load-fonts - dinclude-eps-fonts prd_winternacht-lilypond-1.tmp TeXUtil | running texmfstart --ifchanged=prd_winternacht- lilypond-1.tmp --exec bin:lilypond -b eps -dno-gs-load-fonts - dinclude-eps-fonts prd_winternacht-lilypond-1.tmp ... My songbook has 24 songs at the moment, but the counter stays at 1 for the lilypond run (works with the tmp, as you can see). Greetlings from Lake Constance! Hraban --- http://www.fiee.net/texnique/ http://contextgarden.net http://www.cacert.org (I'm an assurer) --Apple-Mail-5--922222911 Content-Transfer-Encoding: 7bit Content-Type: application/octet-stream; x-mac-type=54455854; x-unix-mode=0600; x-mac-creator=54655873; name=t-lilypond.tex Content-Disposition: attachment; filename=t-lilypond.tex %D \module %D [ file=t-lilypond, %D version=2006.10.03, %D title=\CONTEXT\ User Modules, %D subtitle=Lilypond Connections (Music Typesetting), %D author=Christopher Creutzig \& Henning Hraban Ramm, %D date=\currentdate, %D copyright=Christopher Creutzig] %M \usemodule[lilypond] %D This module serves to include LilyPond music directly in the %D \CONTEXT\ source, just as \METAPOST\ code can be. %D It should work from LilyPond version 2.8. %D Before starting with the implementation, one or two examples are in order. %D %D \startbuffer[sample] %D \startlilypond %D % Telemann, TWV 40:11 %D \version "2.9.18" %D %D \relative c' { %D \set Staff.instrumentName = flute %D \key fis \minor %D \time 3/4 %D \partial 4 %D %D r8 fis'8 | fis4. cis8 a cis | fis, a cis fis a fis | %D b, d fis b d b | eis,, gis cis eis gis b, | %D a fis' gis, fis' cis eis | fis,4 r8 %D a' gis fis | e gis, a e' fis cis | %D d fis, gis b e d | cis4 \trill r8 %D cis b a | b dis e gis cis, b | %D a e' dis fis b, a | gis4 \trill r8 %D } %D \stoplilypond %D \stopbuffer %D %D The input %D %D \typebuffer[sample] %D %D is typeset as %D %D \getbuffer[sample] %D %D \type{\startlilypond} accepts options, as in\crlf %D \type{\startlilypond[staffsize=24, linewidth=14cm, indent=5cm, time=no]}: %D %D \nobreak %D \startlilypond[staffsize=24,linewidth=14cm,indent=5cm,time=no] %D \version "2.9.18" %D \relative c' { %D \set Staff.instrumentName = flute %D \key fis \minor %D \time 3/4 %D \partial 4 %D r8 fis'8 | fis4. cis8 a cis | fis, a cis fis a fis | %D b, d fis b d b | eis,, gis cis eis gis b, | %D a fis' gis, fis' cis eis | fis,4 r8 %D a' gis fis | e gis, a e' fis cis | %D d fis, gis b e d | cis4 \trill r8 %D cis b a | b dis e gis cis, b | %D a e' dis fis b, a | gis4 \trill r8 %D } %D \stoplilypond %D %D It is also possible to mix text and music: %D \lower 8.2pt\hbox{\lilypond[fragment=true,staffsize=16,time=no]{g'}} is a g. %D %D TODO: Complete list of options. %D %D \startlines %D staffsize=20, %D indent=0pt, %D time=yes, %D align=?, % default depends on fragment=... %D fragment=no, %D barnumbers=no, %D \stoplines %D %D TODO: The \type{\lower} in the example above should not be necessary. %D %D TODO: Switches to turn off the clef etc. %D %D TODO: Proper support for multipage results. %D %D TODO: lilypond -> \CONTEXT. %D %D TODO: enable LilyPond variables (Scheme code) %D %D \page %D Now for the implementation. As usual, we use a prefix for buffers, %D \type{\getparameters} etc.: \unprotect \def\??lily{lilypond-} %D Define the text snippets to be placed around fragments. %D Since lilypond uses similar syntax to \TeX, we must do some catcode fiddling. \bgroup \catcode`\/=\@@escape /catcode`/\=/@@other /catcode`/#=/@@other /catcode`/<=/@@begingroup /catcode`/>=/@@endgroup /catcode`/{=/@@other /catcode`/}=/@@other /catcode`/%=/@@other /gdef/lily!fragmentprefix< /string^^J /string^^J {/string^^J % ly snippet contents follows:/string^^J > /gdef/lily!fragmentsuffix /gdef/lily!prefix /gdef/lily!hash<#> /egroup \newdimen\lily!linewidth \newdimen\lily!vsize \newdimen\lily!indent \newif\iflily!align \newif\iflily!time \newif\iflily!barnumbers \newcount\lily!figures %D Again, as usual, there is a \type{\setuplilypond} command %D that accepts the same parameters as \type{\lilypond} and %D \type{\startlilypond} do in their optional argument: \def\setuplilypond{\dosingleempty\dosetuplilypond} \def\dosetuplilypond[#1]{% \getparameters[\??lily][#1]% } %D We set the following defaults: \setuplilypond [staffsize=20, indent=0pt, time=\v!yes, align=?,% default depends on fragment=... fragment=\v!no, barnumbers=\v!no, ] %D \type{\startlilypond} is a multistage implementation, because %D end-of-line characters must be treated specially in the %D \type{\startlilypond}\textellipsis\type{\stoplilypond} range. \def\startlilypond{\dosingleempty\dostartlilypond} \def\dostartlilypond[#1]{% \bgroup \obeylines \dodostartlilypond[{#1}]% } \long\def\dodostartlilypond[#1]#2\stoplilypond{% \egroup% from \dostartlilypond \bgroup% %D The default of the \type{linewidth} parameter is the local %D \type{\hsize}. \setlocalhsize \getparameters[\??lily][linewidth=\the\localhsize,height=\the\textheight,#1]% \lily!linewidth\dimexpr\getvalue{\??lily linewidth}\relax \lily!vsize\dimexpr\getvalue{\??lily height}\relax \lily!indent\dimexpr\getvalue{\??lily indent}\relax %D The default of \type{align} depends on whether we typeset a fragment: \@EAEAEA\doifelse\getvalue{\??lily align}{\v!yes}% \lily!aligntrue\lily!alignfalse \@EAEAEA\doif\getvalue{\??lily fragment}{\v!no}{% \@EAEAEA\doif\getvalue{\??lily align}? \lily!aligntrue }% \@EAEAEA\doifelse\getvalue{\??lily time}\v!yes \lily!timetrue\lily!timefalse %D We are using a counter to keep the different lilypond pieces %D separate. This allows to typeset them only once, during the %D first run. %D %D TODO: This won't work any longer once we pass the remaining %D vertical space to lilypond. \global\advance\lily!figures\plusone \edef\lily!filename{\bufferprefix lilypond-\the\lily!figures} %\startmode[*\v!first]% \def\obeyedlines{\string^^J}% \convertargument#2\to\ascii \expanded{% \setbuffer[lilypond-\the\lily!figures]% \lily!prefix \lily!hash(set-global-staff-size \getvalue{\??lily staffsize})\string^^J% \ifundefined{\??lily fragment}\else\lily!fragmentprefix\fi %% TODO: Option "packed" \ascii% \ifundefined{\??lily fragment}\else\lily!fragmentsuffix\fi }% expanded \endbuffer% %D Generating a pdf directly always creates a whole page, so we generate eps first. %D If \type{\ifeof18} creates an error for you, your pdfetex is too old. %D just change it to \iftrue then. (\type{\ifeof18} checks whether \type{\write18} %D is disabled.) %\def\LP{echo LILYPOND \lily!filename.tmp} %\def\PDF{echo PStoPDF \lily!filename.eps} \def\LP{texmfstart --ifchanged=\lily!filename.tmp --exec bin:lilypond -b eps -dno-gs-load-fonts -dinclude-eps-fonts \lily!filename.tmp} \def\PDF{texmfstart --ifchanged=\lily!filename.eps pstopdf \lily!filename.eps} \ifeof18 \installprogram{\LP}% \doif\jobsuffix{pdf}{% \installprogram{\PDF}% }% \else \executesystemcommand{\LP}% \doif\jobsuffix{pdf}{% \executesystemcommand{\PDF}% }% \fi %\stopmode% only first run \doifelse\jobsuffix{pdf} {\edef\lily!img{\lily!filename.pdf}}% {\edef\lily!img{\lily!filename.eps}}% %D %D TODO: Get the relevant dimension directly from lilypond, %D to place the instrument name into the left margin for %D short snippets as well. %D If we are not in the middle of some text, we have to check %D whether lilypond created an image that is wider than requested: %D It places the instrument names in the left margin. %D \ifvmode \getfiguredimensions[\lily!filename.pdf]% \leavevmode% \newdimen\FigWidth \FigWidth=\figurewidth \ifdim\FigWidth>\localhsize \!!dimena=\localhsize \advance\!!dimena by-\FigWidth \noindent\hskip\!!dimena \fi \fi \externalfigure[\lily!img]% \egroup% }% %D For short snippets, we define an inline alternative to %D our start/stop pair: \def\lilypond{\dosingleempty\dolilypond} \def\dolilypond[#1]#2{\startlilypond[#1]#2\stoplilypond} \protect %D End of file --Apple-Mail-5--922222911 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; format=flowed --Apple-Mail-5--922222911 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ ntg-context mailing list ntg-context@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-context --Apple-Mail-5--922222911--