Hi.

This is related to issues 1014 and 1145[1], was also discussed a couple of
times[2].

The point is that MultiMeasureRests should be whole rests for measures longer
than 4/2.

Now i am quite happy with a solution in attached file. I believe, sharing this
solution (not ideal, i guess) may be helpful. Of course, i will thank for any
help and/or suggestions.

It uses an idea which i've found in Alexander Kobel's (thanks!) snippet,
#651[3] --- let MultiMeasureRest be invisible and MultiMeasureRestNumber shows
something else than numbers (yes, i never use MultiMeasureRestNumbers, and
those --- mainly unmetered --- scores, which contain whole measure rests, are
much better with whole than breve rests).

MultiMeasureRestNumbers are placed where MultiMeasureRests (transparent) are,
glyph is "calculated" (depending on time signature for current measure and
MultiMeasureRest's 'staff-position). Breve rests may be drawn as whole, too.

So, i use this as a workaround for issues 1014 and 1145[1] (completely
"transparent" workaround --- voices should not be changed, i simply need
to add something[4] to \layout block).


If this attempt can be improved --- i'll be glad to get any feedback.

I am not a programmer, some things can be "strange" .)

Thank you.

_________________
 1. http://code.google.com/p/lilypond/issues/detail?id=1014
    http://code.google.com/p/lilypond/issues/detail?id=1145
 2. http://lists.gnu.org/archive/html/lilypond-user/2008-12/msg00004.html
    http://www.mail-archive.com/lilypond-de...@gnu.org/msg18832.html
 3. http://lsr.dsi.unimi.it/LSR/Item?id=651
 4. This is not a problem for my scores, since all my templates already have
    \include "layout-<context_name>-setup.lyi" in every \context block
    of \layout block.

-- 
  Dmytro O. Redchuk
  Bug Squad
%
% Thanks to Alexander Kobel for http://lsr.dsi.unimi.it/LSR/Item?id=651
%

% i want breve MMRs appear as whole ones always:
#(define mmr-breve-as-whole #t)

% i've never seen MMRs on the middle line,
% so, put them on fourth if 'staff-position=0 :
#(define mmr-escape-from-zero #t)

% this will return markup for MMRNubmer's 'text property:
#(define (normalize-mmrs-callback grob)
  (let* ((mmr (ly:grob-parent grob Y))
         (evt (ly:grob-property grob 'cause))
         (mus (ly:event-property evt 'music-cause))
         (len (ly:music-duration-length mus))
         (pos (ly:grob-property mmr 'staff-position))
         (restglyph
            (if (and (equal? len (ly:make-moment 2 1))
                     (eq? #f mmr-breve-as-whole))
                (if (> (abs pos) 4)
                    ;; stub. need to draw a ledger line?.. *DONT_KNOW*
                    "rests.M1"
                    "rests.M1")
                (if (> (abs pos) 4)
                    ;; this one already has ledger line:
                    "rests.0o"
                    "rests.0"))))
      ;; "adjust" 'staff-position if needed:
      (if (and (eq? #t mmr-escape-from-zero)
               (eq? 0 pos)
               (or (not (equal? len (ly:make-moment 2 1)))
                   (eq? #t mmr-breve-as-whole)))
          (ly:grob-set-property! mmr 'staff-position 2))
      ;; and return markup:
      (markup #:line (#:musicglyph restglyph))))


rests = \relative c'' {
  %
  \oneVoice
  \time 3/4
  R2. |
  \time 4/4
  R1 |
  \time 4/2
  R1*2 |
  \time 5/2
  \once \override MultiMeasureRest #'staff-position = #6
  R1*5/2 |
  %
  \voiceTwo
  \time 6/2
  R1*3 |
  \once \override MultiMeasureRest #'staff-position = #-6
  R1*3 |
}

normalizeMMRs = {
  % these overrides would go into \layout for \Score context,
  % if you need these changes globally:
  \override MultiMeasureRest #'transparent = ##t
  % place MultiMeasureRestNumber to MultiMeasureRest's position:
  \override MultiMeasureRestNumber #'Y-offset = #0
  \override MultiMeasureRestNumber #'text = #normalize-mmrs-callback
}

revertMMRs = {
  \revert MultiMeasureRest #'transparent
  \revert MultiMeasureRestNumber #'Y-offset
  \revert MultiMeasureRestNumber #'text
}


\score {
  \new Staff {
    \new Voice {
      \rests
      \break
      \normalizeMMRs
      \rests
      \break
      \revertMMRs
      \rests
    }
  }
}

%{
\layout {
  \context {
    \Score
      % to make this by default:
      \override MultiMeasureRest #'transparent = ##t
      \override MultiMeasureRestNumber #'Y-offset = #0
      \override MultiMeasureRestNumber #'text = #normalize-mmrs-callback
  }
}
%}

\paper {
  indent = 0
}

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

Reply via email to