lilypond-user
[Top][All Lists]
Advanced

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

help with music functions: change (not add) property to NoteEvent


From: Michael Meixner
Subject: help with music functions: change (not add) property to NoteEvent
Date: Sat, 10 Jun 2006 15:49:27 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

Hello,

here's a questions to the wise from a (half)newbie:

I'm just trying to write a music function which changes the 
duration of notes (this is for a project with proportional Canons). 
I'm using \displayMusic a lot and try to understand as much as 
I can from the docs. 

I made a simple example which works well so far:

%% example code

\version "2.9.8"

dottedHalf =
#(define-music-function (parser location note) 
                                                (ly:music?)

        (set! (ly:music-property 
             (first (ly:music-property note 'elements)) 'duration)
        (ly:make-duration 1 1 1 1))
        note)

{ c'4 \dottedHalf c'4 }

%% end of example code

Two questions:

1) Could this be simplified with " ly:music-set-property!" ?

2) In the case of a chord, e.g. "{ \dottedHalf <c' e'>4 }" in the above 
example, 
this doesn't work, because the function "catches" the first NoteEvent only, 
so I would need to "drill" (recursively?) into the EventChord.
Are there any examples showing this? (So far I only found examples of ADDING 
things to an EventChord, but not replacing).

[Additional question: "first" is a GUILE feature?]

Hope my questions are clear enough and thanks for some hints!
Michael 
(on a half sunny day in Vienna...)






reply via email to

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