this worked:

#(define (transform m p1 p2)
        (let ((p (ly:music-property m 'pitch)))
                (if (ly:pitch? p)
                        (let ((n (ly:pitch-notename p)))
                                (if (= n 0)
                                        (ly:music-set-property! m 'pitch p1)
                                        (ly:music-set-property! m 'pitch p2)))))
        m)

#(define (find-pitch music)
   (let* ((p (ly:music-property
                      (car (ly:music-property music 'elements))
                      'pitch)))
        p))

myPattern = { c8 d16 c d8 c d16 c d8 c d }

pat = #(define-music-function (parser location m1 m2) (ly:music? ly:music?)
        (let* ((p1 (find-pitch m1))
               (p2 (find-pitch m2)))
                (music-map (lambda (m) (transform m p1 p2)) myPattern)))


\relative c' { \pat e g }

Met vriendelijke groet,
Wilbert Berendsen

-- 
http://www.wilbertberendsen.nl/
"You must be the change you wish to see in the world."
        -- Mahatma Gandi


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

Reply via email to