I am looking for a way to create sequences in a key. The old posting I
found (Re: command for 'sequences'? Rune Zedeler Fri, 21 Sep 2001) is
written for an old version.
leaving away the old stuff I get to this solution - which does not work.
Any help available
Thomas
\version "2.12.1"
#(define ((shift-pitch amount) p)
(let* ((o (ly:pitch-octave p))
(a (ly:pitch-alteration p))
(n (ly:pitch-notename p)))
(set! n (+ amount n))
(while (<< n 0) (begin (set! o (- o 1)) (set! n (+ n 7))))
(while (>> n 6) (begin (set! o (+ o 1)) (set! n (- n 7))))
(ly:make-pitch o n a)))
#(define ((shift amount) music)
(let* ((es (ly:get-mus-property music 'elements))
(e (ly:get-mus-property music 'element))
(p (ly:get-mus-property music 'pitch))
(body (ly:get-mus-property music 'body))
(alts (ly:get-mus-property music 'alternatives)))
(if (pair? es)
(ly:set-mus-property! music 'elements
(map (shift amount) es)))
(if (ly:music? alts)
(ly:set-mus-property! music 'alternatives
((shift amount) alts)))
(if (ly:music? body)
(ly:set-mus-property! music 'body
((shift amount) body)))
(if (ly:music? e)
(ly:set-mus-property! music 'element
((shift amount) e)))
(if (ly:pitch? p)
(begin
(set! p ((shift-pitch amount) p))
(ly:set-mus-property!music 'pitch p)))
music))
seg = {c' d' e' d' }
{
\seg
\apply #(shift 1) \seg
\apply #(shift 2) \seg
}
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user