Le 2018-05-12 00:16, Sirius Barras a écrit :
I have a sequence of notes and a music expression.
How could be done a function concatenating each element of the sequence
with the music expression?

For instance, if the sequence is {c b a } and the music expression is { f g
}  I would like to obtain

c f g
b f g
a f g


Don't known what Lilypond version you have. This should work in 2.18 and 2.19

%%%%%%%%%%%%%%%%%%

#(define (foo seq1 seq2)
(map (lambda(note)
       ;(ly:music-deep-copy ;; if music is re-used
        (make-sequential-music
          (cons note (ly:music-property seq2 'elements))))
     (ly:music-property seq1 'elements)))

seqI = { c b a }
seqII = { f g }

#(for-each display-lily-music (list seqI seqII))
#(display "=>\n")
#(for-each display-lily-music (foo seqI seqII))

%%%%%%%%%%%%%%%%%%%

Output :

{ c4 b4 a4 }
{ f4 g4 }
=>
{ c4 f4 g4 }
{ b4 f4 g4 }
{ a4 f4 g4 }



Good week.

--
Gilles

_______________________________________________
lilypond-user mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to