lilypond-user
[Top][All Lists]
Advanced

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

Re: convert from absolute to relative


From: Gilles THIBAULT
Subject: Re: convert from absolute to relative
Date: Fri, 22 Aug 2008 23:55:53 +0200


notes = { a2-"hello"  b4 r b2 a-"bye"  < c e g c'>1-"oho"  }
{ \displayLilyMusic \skipMusic \notes }
results in
{ s2-"hello"  s4 s s2 s-"bye"  s s s s -"oho" }
note the 4 "s" where it should be s1!

You 're right.
So it's a bit longer that i thought :

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
skipMusic = #(define-music-function (parser location music) (ly:music? )
(let ((last-event-was-skipEvent #f))
   (music-filter
       (lambda (y)
(let* ((skipEvent? (eq? (ly:music-property y 'name)'SkipEvent))
                    (res (or (not last-event-was-skipEvent)
                                (not skipEvent?))))
               (set! last-event-was-skipEvent skipEvent?)
               res))
       (music-map
           (lambda (x)
               (let ((dur (ly:music-property x 'duration)))
                   (if (ly:duration? dur)
                       (make-music 'SkipEvent 'duration dur)
                       x)))
           music))))


notes = { a2-"hello"  b4 r b2 a-"bye"  < c e g c' e' g'>1-"oho ;-)"  }

\displayLilyMusic \skipMusic \notes
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Gilles

NB
If we go on with this discussion i think we have to open a new topic because we are far from the original one ...




reply via email to

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