Dear community, the following code is very old, written by Rune Zedeler, but it is very useful. It allows You define a motive like: \motiv #'Stefan {c'8 d' c' d' e2} and later it can be used like this: \Stefan {e f g } and You will get {e8 f e f g2 } it can save a lot of typing. Unfortunately it doesn't seem to work with lilypond 2.20.0 Has someone an idea, how I can get it working with lilypond 2.20.0? Thanks in advance for any hint! Here is the definition, that works with 2.18.2.: motiv = #(define-music-function (name pattern) (symbol? ly:music?) (letrec ((trans-rec (lambda (pitches) (lambda (music) (let* ((es (ly:music-property music 'elements)) (e (ly:music-property music 'element)) (p (ly:music-property music 'pitch)))
(if (pair? es) (ly:music-set-property! music 'elements (map (trans-rec pitches) es))) (if (ly:music? e) (ly:music-set-property! music 'element ((trans-rec pitches) e))) (if (ly:pitch? p) (let* ((o (ly:pitch-octave p)) (n (ly:pitch-notename p)) (i (+ (* 7 o) n)) (pes (ly:music-property (list-ref pitches i) 'elements)) (pnew (ly:music-property (car pes) 'pitch)) ) (ly:music-set-property! music 'pitch pnew) )) music))))) (primitive-eval `(define ,name (define-music-function (parserb locationb pitchseq) (ly:music?) (let* ((pitches (ly:music-property pitchseq 'elements)) (n (ly:music-property pitchseq 'name))) (if (not (equal? n 'SequentialMusic)) (ly:warning "2nd arg of transform must be SequentialMusic, got ~a" n) ((,trans-rec (map event-chord-wrap! pitches)) (ly:music-deep-copy ,pattern))))))) (make-music 'SequentialMusic 'void #t)))