lilypond-user
[Top][All Lists]
Advanced

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

Re: Rest is in the wrong place


From: Aaron Hill
Subject: Re: Rest is in the wrong place
Date: Tue, 13 Oct 2020 10:03:47 -0700
User-agent: Roundcube Webmail/1.4.9

On 2020-10-13 5:42 am, Knute Snortum wrote:
Although I was able to see the code working with the override in a
minimum example, I couldn't get the override to work in the whole
piece.  I may try to find a MWE of the problem, or I may just use the
g4*1/2 solution.

[...]

I tried putting the override in global, in rightHand, and right before
the measure with the rest too high.  The rest position did not change
in any of those.  Is there a better place to put the override?

I would do this in the \layout block--either at the top-level or within your \score:

%%%%
\layout {
  \context {
    \Staff
    \override RestCollision.minimum-distance = #0.4
  }
}
%%%%

Note that the value of 0.4 was found experimentally using the MWE. It is possible that your real score might need a smaller value.

----

If you do end up needing to use the g4*1/2 trick, here's a helper function that should make it cleaner to implement throughout your music:

%%%%
split =
#(define-music-function
  (fraction music)
  ((fraction? '(1 . 2)) ly:music?)
  (let* ((orig-len (ly:music-length music))
         (mom (ly:make-moment (car fraction) (cdr fraction)))
         (comp (ly:music-compress music mom))
         (comp-len (ly:music-length comp))
         (skip (make-music 'SkipEvent
                           'duration (ly:make-duration 0 0))))
    (make-sequential-music (list comp
      (ly:music-compress skip
        (ly:moment-sub orig-len comp-len))))))

%% { g4*1/2 s fis4 f }
%% becomes
%% { \split g4 fis f }
%%%%

The fraction defaults to half, but you can split at any other ratio if that is necessary. For instance:

%% { g4*1/3 s4*2/3 fis4 f }
%% becomes
%% { \split 1/3 g4 fis f }

The main advantages of using this function are:

1. It does not impact assumed note durations. In the examples above, fis properly inherits the quarter-note duration from g4 even though \split will modify the music. The manual option changes the most recently used duration which requires explicitly qualifying fis as "fis4".

2. Should it be determined that the RestCollision behavior seen is a bug and that bug is resolved at a future time, it is much easier to find and remove usage of \split or just make \split a dummy function that does not modify music.


-- Aaron Hill



reply via email to

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