lilypond-user
[Top][All Lists]
Advanced

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

Re: Extract notes within music function


From: Gilles
Subject: Re: Extract notes within music function
Date: Thu, 08 Nov 2012 10:24:26 +0100
User-agent: Opera Mail/12.02 (Win32)


Is it possible to do something just with the first and last notes of
music within? Can they be extracted from music as from a list? (Hence
my reference in the original post to car and cdr)?

In music-functions.scm, you have some useful functions. Here an
extract-music is used.

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

music  = \relative { c2->\f d e <e g c>2-> }

#(let ((mylist
      (extract-music music
         ;(lambda (evt)(eq? (ly:music-property evt 'name) 'NoteEvent)))))
        (lambda (evt)(memq (ly:music-property evt 'name)
                            '(NoteEvent EventChord))))))
    (display-scheme-music (car mylist))
    (display "  ----\n")
    (display-scheme-music (last mylist)))

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

NB
Aleksandr, sorry for the double messages.

--
Gilles



reply via email to

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