Is it possible to extract individual notes from the music passed to a
music function, e.g.:
\myFunction { c d e f }
Within myFunction, can I do something like
car notes
cdr notes
Here is a kind of template, but i am not absolutely sure it's what you
want.
%%%%%%%%%%%%%%%%%%%%
myFunction = #(define-music-function (parser location music)(ly:music?)
(map-some-music
(lambda (evt)
(let ((name (ly:music-property evt 'name)))
(cond
((eq? name 'EventChord)
; to see the structure of a chord
(display-scheme-music evt); to comment
; do something with the chord
evt) ; return the modified chord - don't go deeper
((eq? name 'NoteEvent)
; to see the structure of a note
(display-scheme-music evt); to comment
; do something with note
evt) ; return the modified note - don't go deeper
(else #f)))) ; => #f = continue, go deeper
music))
music = \relative { c2->\f <e g c>2-> }
\myFunction \music
%%%%%%%%%%%%%%%%%%%%
--
Gilles
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user