lilypond-user
[Top][All Lists]
Advanced

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

Re: Scheme function to affect a compound music expression?


From: Peter Crighton
Subject: Re: Scheme function to affect a compound music expression?
Date: Sat, 25 Oct 2014 18:01:47 +0200

2014-10-25 17:51 GMT+02:00 David Nalesnik <address@hidden>:
Hi Peter,

On Sat, Oct 25, 2014 at 10:41 AM, Peter Crighton <address@hidden> wrote:
I now wanted to improve the function to also skip MultiMeasureRests and first tried replacing 'rest-event with 'multi-measure-rest-event to see if that would work, which it doesn’t.


Yes, this was a stumbling block for me too recently.  It doesn't seem that you can use 'multi-measure-rest-event with music-is-of-type?  This approach will work, though:

 \version "2.19.15"

bgr = #(define-music-function (parser location music) (ly:music?)
  (music-map (lambda (mus)
    (if (or (music-is-of-type? mus 'rest-event)
            (eq? (ly:music-property mus 'name) 'MultiMeasureRestMusic))
      (make-music 'SkipEvent mus)
      #{
        \tweak NoteHead.font-size #-2
        \tweak Accidental.font-size #-2
        #mus
      #}))
    music ))

\new Voice <<
  \relative c' {
    c4 d r f
    R1
    c4 d r f
  }

  \relative c' \bgr {
    e4 f r a
    R1
    e4 f r a
  }
>>

Thanks, David, that indeed does the trick!

--
Peter Crighton | Musician & Music Engraver based in Mainz, Germany
http://www.petercrighton.de

reply via email to

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