[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Extract notes within music function
From: |
David Kastrup |
Subject: |
Re: Extract notes within music function |
Date: |
Thu, 08 Nov 2012 10:51:14 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.2.50 (gnu/linux) |
Gilles <address@hidden> writes:
>> 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))))))
(let ((mylist (extract-named-music music '(EventChord NoteEvent))))
is shorter here...
> (display-scheme-music (car mylist))
> (display " ----\n")
> (display-scheme-music (last mylist)))
>
> %%%%%%%%%%%%%%%%
>
> NB
> Aleksandr, sorry for the double messages.
--
David Kastrup