[Top][All Lists]

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

Re: Music function extension...

From: Valentin Villenave
Subject: Re: Music function extension...
Date: Fri, 29 Oct 2010 14:07:51 +0200

On Fri, Oct 29, 2010 at 12:46 PM, David Kastrup <address@hidden> wrote:
> Are there good reasons left for not allowing music functions to take
> pitches as arguments?  That would allow implementing something like
> \transpose as a music function.  The alternative, letting it take a
> music event and not checking its duration and hoping that it is a single
> note, seems quite less elegant.

Music functions *can* take a ly:pitch as argument:

toto =
#(define-music-function (parser location pitch) (ly:pitch?)
   (make-music 'NoteEvent
     'duration (ly:make-duration 2 0 1 1)
     'pitch pitch))

{ a \toto #(ly:make-pitch 0 0 0) b }

However, having to type #(ly:make-pitch x x x) is hardly convenient
from a user point of view.

> Since argument signatures of music functions and markup functions are by
> now processed as lists instead of fixed combinations, adding new
> argument types does not seem to have significant drawbacks.

I may be totally wrong, but it seems to me that what you're suggesting
amounts to actually create a new type, that would be a one-note
ly:music type whose duration is disregarded. (I'm not saying it would
be a bad idea, though.)


reply via email to

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