[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: function variable question
From: |
Hugh Myers |
Subject: |
Re: function variable question |
Date: |
Fri, 18 Dec 2009 15:59:25 -0700 |
Thanks again Alexander--- thats the third time today you've bailed me
out! Hope I can return same someday.
--hgsm
On Fri, Dec 18, 2009 at 3:49 PM, Alexander Kobel <address@hidden> wrote:
> Hugh Myers wrote:
>>
>> Given:
>>
>> flashNote = #(define-music-function (parser location note)(ly:music?) #{
>> $note s2. \pageBreak
>> #}
>> )
>>
>> I'd like to modify it so that a fixed duration for the note can be
>> within the function rather than in the calling sequence. [...]
>> I've tried various versions of $note4, {$note}4 etc--- all producing
>> errors of course. Clues? Suggestions?
>
> Inside the music function, note is essentially an arbitrary music
> expression, so you can't just attach the length, as you recognized.
> Basically, you'd have to parse the whole music expression, and replace the
> chord durations by a quarter.
> Luckily, there's already a function called \makeRhythm in
> http://lsr.dsi.unimi.it/LSR/Item?id=390 , doing exactly this. With this
> included,
>
> flashNote = #(define-music-function (parser location note)(ly:music?) #{
> \makeRhythm $note "4" s2. \pageBreak
> #}
> )
>
> should do what you want.
>
>
> Cheers,
> Alexander
>