Hi Paolo,
this compiles in 2.14.2 on my machine:
--snip--
\version "2.14.2"
myFunction = #(define-music-function (parser location foobar) (ly:duration?)
(make-music 'SequentialMusic 'elements (list
(make-music 'EventChord 'elements (list
(make-music 'NoteEvent 'duration foobar 'pitch (ly:make-pitch 1 0 0))
))
))
)
{
\myFunction #(ly:make-duration 2 0 1 1) r4
}
--snip--
In your first message you wrote something about one note, that is repeated 3
times, while augmenting its length - if I did understand your question right.
I recommend the us of \displayMusic, to see, how notes are constructed in
scheme. Then you might have one argument (... foobar) (ly:music?), a function
that copies this note and changes its duration accordingly.
HTH
cheers, Jan-Peter
Am 08.12.2011 um 10:36 schrieb Paolo Prete:
> I searched in "extending" manual for 2.15, but I did not find a solution for
> my problem.
>
> Shortly, given this fragment of code:
>
> ----------------------------------------
>
>
> myFunction = #(define-music-function (parser location foobar) (ly:duration?)
> #{
> a ...how_can_I_use_$foobar_as_duration_??...
> #})
>
> \new Staff \myFunction ...how_can_I_pass_duration_??...
>
>
> -----------------------------------------
>
>
> ...which is the right syntax and which version of lilypond could I use?
>
>
> Thanks
>
>
>
>
> --- Gio 8/12/11, David Kastrup <[email protected]> ha scritto:
>
>> Da: David Kastrup <[email protected]>
>> Oggetto: Re: duration and pitch in a function
>> A: [email protected]
>> Data: Giovedì 8 dicembre 2011, 07:59
>> Paolo Prete <[email protected]>
>> writes:
>>
>>> I need to create a function that
>>>
>>> accepts some_pitch and some_duration as arguments and
>> prints the
>>> following three notes:
>>>
>>> 1) some_pitch with some_duration
>>> 2) some_pitch with some_duration*2
>>> 3) some_pitch with some_duration*3
>>>
>>>
>>> Should I use ly:duration as type of the argument two?
>>
>> ly:duration? would be the predicate. And yes,
>> definitely.
>>
>>> I can't find documentation for that.
>>>
>>> I use LilyPond 2.12.3 but I can upgrade it if
>> necessary...
>>
>> If you upgrade, you will find both the functionality itself
>> as well as
>> the documentation.
>>
>> I don't quite remember the version; it might be necessary
>> to take one of
>> the 2.15.x releases.
>>
>> --
>> David Kastrup
>>
>>
>> _______________________________________________
>> lilypond-user mailing list
>> [email protected]
>> https://lists.gnu.org/mailman/listinfo/lilypond-user
>>
>
> _______________________________________________
> lilypond-user mailing list
> [email protected]
> https://lists.gnu.org/mailman/listinfo/lilypond-user
_______________________________________________
lilypond-user mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-user