lilypond-devel
[Top][All Lists]
Advanced

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

Re: Add \eval to Lilypond?


From: Alan Stern
Subject: Re: Add \eval to Lilypond?
Date: Wed, 8 Mar 2006 16:57:28 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

Erik Sandberg <Erik.Sandberg.9195 <at> student.uu.se> writes:

> Citerar Alan Stern <stern <at> rowland.harvard.edu>:
> 
> > The facility for generating Lilypond code from within Scheme is
> > fairly limited.  The #{ ... #} syntax only recognizes music
> > expressions, so it can't be used in a \layout block, for instance.
> > 
> > Is it possible to add a \eval primitive to Lilypond?  It could
> > take as an argument either a literal string or a Scheme expression
> > that returns a string, and then it would feed the contents of that
> > string directly into the parser.
> > 
> > As an example, we could put in a source file
> > 
> > \eval #(if OutputMidi "\\midi { \\tempo 4 = 120 } " "")
> 
> Sounds like what you're looking for is a preprocessor. There will never be a
> builtin preprocessor in lilypond, but you are free to use an external one if
> you like (e.g. m4, gpp).

You got me thinking.  A preprocessor is indeed what I was looking for, so I
wrote a simple one for Lilypond.  It's in Scheme, which means it's portable to
any machine that Lilypond can run on.  The preprocessor itself does almost no
work, since it can rely on Scheme to take care of all the hard stuff.

With this approach, I can generate both an orchestral conductor's score and
individual parts from a single source.  If anyone is interested, I will post the
source and explain how to use it.

Alan Stern





reply via email to

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