[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Full bar rests in multi-voiced piano scores -- question and a sugges
From: |
Arvid Grøtting |
Subject: |
Re: Full bar rests in multi-voiced piano scores -- question and a suggestion |
Date: |
Mon, 25 Feb 2008 12:16:19 +0100 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux) |
Mats Bengtsson <address@hidden> writes:
> So far, there's no automatic support in LilyPond to avoid collisions
> between multi-measure rests and other objects. Their vertical
> position is determined by the staff-position property, which by
> default is set to zero. The \voiceOne macro sets staff-position to
> +4 and \voiceTwo sets it to -4. So, to merge the rests from two
> separate voices, just set the staff-position to the same value so
> that they will be printed on top of each other. What I proposed in
> the cited solution was to use \revert MultiMeasureRest
> #'staff-position after \voiceOne and \voiceTwo, which reverts the
> value of the property to the default 0. Of course, you probably
> still want to keep the raised and lowered positions of full bar
> rests in measures where the other voice has some music and
> unfortunately, I don't know any nice automatic solution for that,
> except for using the \partcombine function, which is known to have
> several other limitations and bugs.
You could also do the following:
% either this:
mmOneVoice = { \override MultiMeasureRest #'staff-position = 2 }
% or this, which also works with collapsed rests:
mmOneVoice = { \override MultiMeasureRest #'staff-position =
#(lambda (grob)
(let ((elts (ly:grob-object grob 'elements)))
(if elts
(if (ly:grob-array? elts)
(let* ((mmrest (ly:grob-object
(ly:grob-array-ref elts 0)
'multi-measure-rest))
(mcount (ly:grob-property mmrest 'measure-count)))
(if (= measure-count 1) 2 0)))
;; it doesn't matter what I return otherwise, but still...
9)))
}
mmVoiceOne = { \override MultiMeasureRest #'staff-position = #4 }
mmVoiceTwo = { \override MultiMeasureRest #'staff-position = #-4 }
...and then you use \mmOneVoice when you know all the voices in the
staff will have the same rests, and \mmVoiceOne or \mmVoiceTwo when
they won't.
-- Arvid