lilypond-user
[Top][All Lists]
Advanced

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

Re: concatenating notes with a music expression


From: Gianmaria Lari
Subject: Re: concatenating notes with a music expression
Date: Tue, 15 May 2018 10:27:03 +0200



On 15 May 2018 at 00:40, Gilles Thibault <address@hidden> wrote:
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

Thank you Gilles!!!! I have yet a problem, how can engrave the foo generated list in a score?

reply via email to

[Prev in Thread] Current Thread [Next in Thread]