Hi Urs,

just a note: Time-signatures aren't a problem. It just have to be made sure, that start and end of the multi-measure-rest are placed on measure borders (measure position 0).

Example:
%%%
sectionI = { \time 4/4 s1*2 | \time 3/4 s2.*2 }
\new Staff <<
  { \sectionI }
  $(mmrest-of-length sectionI)
>>
%%%

So if you check for PartialSet in the music and assure an ending on the last moment, at least you don't have to care about time-sigs.

HTH
Jan-Peter


Am 12.12.2016 um 10:09 schrieb Urs Liska:
Hi Jan-Peter,


Am 12.12.2016 um 09:47 schrieb Jan-Peter Voigt:
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.

Thank you for this, which is basically a confirmation of what I was
afraid of ;-)

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.

Unfortunately this won't be sufficient as it wouldn't allow for time
changes within the music.
So it seems I'll have to go the way to parse the actual music expression
for time and partial elements and construct the rest from that. I assume
I'd have to split the original music expression in a list of expressions
and create one mmrest for each.

However, I think this would actually warrant a proper solution, i.e. a
command like e.g. mmrest-of-section that can be applied to arbitrary
music expressions and should be added to LilyPond.
The question is: should this actually be an additional function or
should I update mmrest-of-length itself? (of course within such a new
function one could make good use of the existing mmrest-of-length
functionality for the individual sections).

Urs


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

Reply via email to