[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Music function extension...
From: |
David Kastrup |
Subject: |
Re: Music function extension... |
Date: |
Fri, 29 Oct 2010 15:58:00 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) |
Valentin Villenave <address@hidden> writes:
> 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.
That is taking a scheme expression, not a pitch as argument.
>> 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.)
That is exactly what I don't want. I could already have that. I want
something that takes a pitch as an argument and complains about getting
anything else with it: duration, accents, whatever.
Just like \transpose would complain about getting anything but a pitch
as its transposition pitch argument.
--
David Kastrup