lilypond-user
[Top][All Lists]
Advanced

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

Re: trying to learn scheme... (solved)


From: Wilbert Berendsen
Subject: Re: trying to learn scheme... (solved)
Date: Sat, 13 Oct 2007 17:11:42 +0200
User-agent: KMail/1.9.7

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




reply via email to

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