lilypond-user
[Top][All Lists]
Advanced

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

Re: Including only definitions from a Lilypond file


From: Hans Aikema
Subject: Re: Including only definitions from a Lilypond file
Date: Thu, 13 Aug 2020 20:40:10 +0200

> On 13 Aug 2020, at 20:19, Jérôme Plût <plut.jerome@gmail.com> wrote:
> 
> Hello everybody,
> 
> I have some lilypond files that contain both music variables and
> typesetting instructions, like this:
> 
> soprano = \relative {
>  % music here...
> }
> 
> \bookpart {
>  % typesetting here...
> }
> 
> I would like to include this file while importing the definitions and
> ignoring the typesetting. (The long-term goal is to display some
> statistics (range, etc.) about the various voices in the piece. So the
> including file will want to know what \soprano contains, but to
> replace all typesetting instructions by its own).
> 
> I *could* do this by writing a separate (e.g. Perl) parser that looks
> only for music definitions, but it would be cleaner (and also more
> robust) if there existed a way to do this from inside Lilypond or
> Scheme. Ideally I would need the parser to obtain both the list of
> variables defined in the file and the contents of those variables.
> 
> Before I start hacking something: does there already exist a simpler
> way to do this?
> 
> Thanks,
> 
> -- 
>        Jérôme
> 

Hi Jérôme,

Another way you might approach it would be splitting the file in two files and 
including the file that holds the soprano definition in both your 'layout' file 
(the other half of your current file) and the new 'statistics computation' file.

It's in general similar to the way that I currently setup my choral music 
scores - one file for each voice, a series of includes for various standard 
layouts and a 'linking them all' file that \include s both the various voice 
definition files (holding standard named variables for a voice's music and the 
associated lyrics) and the applicable standard layout file(s).

kind regards,
Hans




reply via email to

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