On Sat, Mar 30, 2013 at 10:48:59PM +0100, Mathieu Huiban wrote: > Dear all, > > I was looking how to easily remove some notes at the beginning or at the > end of music. > Thanks to the wonderful \extractMusic script (thank you Gilles !), it can > be done with a few lines. > > HTH, > > Mathieu
Thank you very much for posting this. I had not given it much attention at the time, but last night I encountered a situation where I realized that 'removeStart' was exactly what I needed. If no one objects, your functions are sufficiently concise that I would suggest folding them directly into the extractMusic.ly file which is linked from the snippet URL, if the original author agrees. Jim > %%% > > \version "2.16.1" > \include "extractMusic.ly" %% See http://lsr.dsi.unimi.it/LSR/Item?id=542 > > removeStart = #(define-music-function (parser location music remove) > (ly:music? ly:music?) > "Remove, at the start of `music, a length equal to the one of `remove." > #{ \extractMusic $music $remove \mmR #} ) > > removeEnd = #(define-music-function (parser location music remove) > (ly:music? ly:music?) > "Remove, at the end of `music, a length equal to the one of `remove." > > (let* > ((new-length (ly:moment-sub (ly:music-length music) (ly:music-length > remove))) > (newskip (make-music 'SkipEvent 'duration (make-duration-of-length > new-length)))) > #{ \extractMusic $music <> $newskip #} )) > > > music = \relative { c4 c g' g a a g2 } > > << > \music > \removeStart \music s2 > \removeEnd \music s2 > >> > > %%% _______________________________________________ lilypond-user mailing list [email protected] https://lists.gnu.org/mailman/listinfo/lilypond-user
