lilypond-user
[Top][All Lists]
Advanced

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

RE: Counter in a repeat


From: John Schlomann
Subject: RE: Counter in a repeat
Date: Fri, 28 Jul 2017 16:17:04 -0500

David,
Your response doesn't give me hope for a simple solution. But then I didn't
start out with a lot of hope.

I'm not sure I completely understand your last comment. I'm wondering if
some sort of preprocessor would work for this. I keep the tunes in separate
files, and \include them into the main .ly file containing the lyrics and
some other stuff. Right now I manually make copies of the tune, one for each
stanza. Because I do a lot of these, automating the process would be
helpful.

I'm sure I could make a preprocessor, perhaps with Perl or something, that
could run before LilyPond runs, making multiple copies of the tune into a
temporary file. Ideally, though I would prefer to run it at the point where
I include the tune, because the main file computes the repeat count needed.
And there would be some things to be careful of, such as partials that
shouldn't be repeated, but these wouldn't be insurmountable.

I'm not a Schemer, so my knowledge there is limited, but I see Scheme has a
'system' procedure. It seems to work in the scheme-sandbox. Would this work
from within LilyPond I wonder? I may pursue that, or am I barking up the
wrong tree entirely, and there is some other, better way to do this? I'm not
ready to give up on this yet.

The reason for this, BTW, is to project hymns on a screen, where every
stanza is accompanied by its own melody line. When I have divisi lyrics
(different syllable counts in different verses), I'd rather not use the
dashed ties and slurs on the screen. That's more suited to the print
version.

John

> -----Original Message-----
> From: David Kastrup [mailto:address@hidden
> Sent: Friday, July 28, 2017 12:04 PM
> To: John Schlomann
> Cc: address@hidden
> Subject: Re: Counter in a repeat
> 
> "John Schlomann" <address@hidden> writes:
> 
> > Hello Everyone,
> > I'd like to maintain a counter that can track the current number of
> > passes through a repeat, something like this:
> >
> > \version "2.18.2"
> > rpt-number = 0  % Initialize the counter
> > {
> >   \repeat unfold 3 {
> >     #(set! rpt-number (1+ rpt-number))  % Increment the counter
> >     c'4 e'4 g'4 c''4
> >   }
> > }
> >
> > Is there any way to do such a thing? My purpose, which is not apparent
> > here, is to use the counter to build symbols used with tags, so that I
> > can select different tagged parts as the repeat unfolds. In my case,
> > the content of the repeat would essentially be an entire hymn stanza.
> 
> Tags are expanded at the level of music expressions but if you take a look
at
> the actual music code produced by \repeat unfold, you'll see that it only
> contains the respective music expression once.

That's what I suspected.

> > I'm always amazed at the power and elegance of LilyPond, but this may
> > be asking for something it wasn't designed for.
> 
> You want to use frontend tools on backend results.  That is not going to
work
> unless you try _simulating_ in the frontend what is supposed to be done in
> the backend.  However, that is likely to lead to subtly differing results.
> --
> David Kastrup




reply via email to

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