lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: showLastLength as a command-line option?


From: Jonathan Kulp
Subject: Re: showLastLength as a command-line option?
Date: Sat, 27 Sep 2008 13:00:55 -0500
User-agent: Thunderbird 2.0.0.17 (X11/20080925)

Well, I didn't get enough info from this posting to do what I originally wanted to do (i.e. hack Lilypond itself to add this option--it would have been enough if I knew anything about programming, I guess), but I've come up with a way to specify showLastLength at the command line using the script that I normally use to invoke lilypond. This works equally well on Mac and Linux. I guess it would take something completely different to work on Windows, though. Don't really know about that.

So I've added some code that allows use of an argument that is captured and passed to a temporary file so it can be used by a lilypond source file. To make use of this function, add the following line near the top of your source file:

\include "showlast.ly"

You don't actually have to *have* the showlast.ly file anywhere on your system, as it's created on the fly by the script, so that it's present when lilypond is called, and then when the script is done, the showlast.ly file is deleted. Specify the duration of the last length the same way you would if you were putting it in your source file. R1*8 is eight whole-rest bars. R2.*8 would be 8 bars of dotted-half-rests. Here's an example of how to run it:

lily -l=R1*12 filename.ly

The R1*12 value is passed to the temporary file, and when lilypond is called, it only renders the last 12 bars.

If you just do "lily filename.ly", then the script creates an empty showlast.ly file so that no "showLastLength" variable is set and the source file is run normally.

Now, I've specified acrobat reader for previewing the file in Linux so if you prefer another viewer you can say "xdg-open" or "evince" in its place. On Mac I use the default Preview app.

Give it a try!

Jon

Jonathan Kulp wrote:
Thanks for replying, Han-Wen. I can't find showLastLength anywhere in that file, though. Searches for showlast and show-last came up empty. It looks like the file is inside the SCM directory but I can't tell where. Here's the search I did:

address@hidden:/usr/local/share/lilypond/2.11.59/scm$ cat *.scm | grep -i showlast
     LENGTHOF(\\showLastLength)
      ((show-last  (ly:parser-lookup parser 'showLastLength)))

So it shows that showLastLength is there, but it doesn't say which file it's in (my skills at the shell are such that I don't know how to make it tell me this. Sigh...). Can you tell from this output where it is?

Jon

Han-Wen Nienhuys wrote:
Can anyone point me in the right direction to accomplish this great idea?!
;)


Would it be possible technically to specify the showLastLength value
when
invoking lilypond instead of putting it in the .ly file? Something like


look at lily.scm to see where the -d options are defined.  At some
point showLastLength is initialized; that's where you should do

  (ly:get-option 'show-last-length)




--
Jonathan Kulp
http://www.jonathankulp.com

Attachment: lily
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]