lilypond-user
[Top][All Lists]
Advanced

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

Removing the start or the end of some music


From: Mathieu Huiban
Subject: Removing the start or the end of some music
Date: Sat, 30 Mar 2013 22:48:59 +0100


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

%%%

\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
>>

%%%



reply via email to

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