|
From: | Alexander Kobel |
Subject: | Re: function variable question |
Date: | Fri, 18 Dec 2009 23:49:36 +0100 |
User-agent: | Thunderbird 2.0.0.23 (X11/20090817) |
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
[Prev in Thread] | Current Thread | [Next in Thread] |