Hi Urs,

this is a problem, I also had to deal with once in a while.
As it is no daily problem, I hacked it as needed, but did build a generic solution yet. But it might be doable, *if* the music is "complete" and has a \partial command in it, which is
#(make-music 'PartialSet 'duration (ly:make-duration 2))
so one can fetch that music-expression and build a rest with that duration.
In my hacks, I usually used a command which receives pre- and post-music expressions (e.g. the needed rests) and decreased the duration for the multi-measure-rest accordingly.

If there is a \partial, you will need a function, that translates an arbitrary duration to a reasonable sequence of rests. \partial 4 is easy, but \partial 2.. or whatever needs special handling also regarding timesig.

A command \multimeasureRest <pre> <music> <post> should be doable.

HTH
Best
Jan-Peter


Am 12.12.2016 um 09:24 schrieb Urs Liska:
Hi all,

I have a set-up where pausing sections in a part can be handled by
automatically inserting multimeasure rests whose length is determined by
a meta variable for the sections.

As a MWE this looks like this:

\version "2.19.52"

sectionOne = {
  c,1 |
  c,1
}

{
  #(mmrest-of-length sectionOne)
}

which nicely prints a staff with two measures of rest.

However, when the referenced variable starts with (or actually contains)
a partial measure, LilyPond gets confused:

sectionTwo = {
  \partial 8
  c'8 |
  c'1 |
  c'1
}

{
  #(mmrest-of-length sectionTwo)
}

Of course the multi-measure rest now is 17/8 long but doesn't know about
the partial and consequently gives me barcheck errors and wrong output.

The same is true when the referenced variable contains music in other
than 4/4 time signature because mmrest-of-length by default seems to
produce 4/4 rests.
I can't simply add a \time command in front of the mmrest because this
is actually a complex set-up where the variables are retrieved from
previously parsed music expressions.

So my question is: is there a reliable and more or less convenient way
to produce a "rest" part/section from a referenced section, regardless
of what's in there. I think basically there are two approaches:
a)
analyse the music expression for partials and time changes
b)
copying the music but replace everything with rests.

Any pointers would be appreciated

Best
Urs


_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user



_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to