lilypond-user
[Top][All Lists]
Advanced

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

scheme manipulating patterns and \relative


From: Wilbert Berendsen
Subject: scheme manipulating patterns and \relative
Date: Sat, 13 Oct 2007 22:58:59 +0200
User-agent: KMail/1.9.7

I now wrote this:

#(define (transform chord m1 m2)
        (let* ((note (car (ly:music-property chord 'elements)))
               (dur (ly:music-property note 'duration))
               (pitch (ly:pitch-notename (ly:music-property note 'pitch)))
               (new (ly:music-deep-copy (if (= pitch 0) m1 m2))))
         (make-music 'EventChord 'elements
           (map (lambda (m) (ly:music-set-property! m 'duration dur) m) 
(ly:music-property new 'elements)))))

pat = #(define-music-function (parser location m1 m2) (ly:music? ly:music?)
        (make-music 'SequentialMusic 'elements
          (map (lambda (m) (transform m m1 m2)) (ly:music-property 
thePattern 'elements))))

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

so \pat <d e> <f g> also works.

But when in relative mode larger intervals are used, e.g.:
         \relative c' { \pat c c' }
each c is put one octave higher. How can I get this to work so that every c 
just stays in the same octave?

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]