2018-02-27 19:12 GMT+01:00 Sirius Barras <turbole...@gmail.com>: > I would like to transpose a motif (using \modalTranspose) to a _set_ of > different pitches. At the moment this is what I do: > > scale = {c d e f g a b} > motif = {c' e' g' c'} > { > \modalTranspose c e \scale \motif > \modalTranspose c g \scale \motif > \modalTranspose c a \scale \motif > } > > How can I do something similar to this: > > toPitchSet = {e g a} > scale = {c d e f g a b} > motif = {c' e' g' c'} > { > \modalTranspose c \toPitchSet \scale \motif > } > > Many thanks, S.
How about: \version "2.19.65" %% Based on a function by David K multipleModalTransposes = #(define-music-function (parser location m scale music) (ly:music? ly:music? ly:music?) ;; If `music' is simple `SequentialMusic', we need to go for 'elements instead ;; of 'element. In this case we also need to "unfold" the resulting ;; `possible-elts' one level (let* ((seq-mus? (music-is-of-type? music 'sequential-music)) (possible-elts (map (lambda (pitch) (ly:music-property #{ \modalTranspose c $pitch $scale $music #} (if seq-mus? 'elements 'element))) (event-chord-pitches m)))) (music-clone m 'elements (if seq-mus? (apply append '() possible-elts) possible-elts)))) toPitchSet = { e g a e b } scale = { c d e f g a b } motif = %\absolute { c' e' g' c' } %\relative { c' e g c, } %\relative c' { c e g c, } %\fixed c' { c e g c } %\context Voice { c'4 e' g' c' } { c'4 e' g' c' } \multipleModalTransposes \toPitchSet \scale \motif Cheers, Harm _______________________________________________ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user