Kieren MacMillan wrote:
Hi Alexander,
I just took your question as a motivation to finally add the
functionality for *num/den suffixes in the following rhythm snippet.
This is fabulous… and *way* more than I was expecting. ;)
Well, that's not my fault... :-) Really, everything but the
string->duration is taken from the LSR.
@ all:
The string->duration routine certainly is not production-stage or well
tested
Wouldn't the whole implementation be a lot easier as something like
applyRhythm = #(define-music-function (parser location rhythm music)
(ly:music? ly:music? ly:music?)
…
inegale = #(define-music-function (parser location music)
(ly:music?)
#{ \applyRhythm s8. s16 $music #})
i.e., use music(s) instead of strings to define the "rhythm pair", so
you don't have to deal with duration parsing/transformation?
Yes and no. It's certainly easier for this special case, but the
applyRhythm as is gives far more freedom than your example.
If you have a rhythm like "4 4 8 8 4" in several voices, you can just say
rhythmA = "4 4 8 8 4"
sop = \applyRhythm #rhythmA { c d e f g | g f e d c }
alt = \applyRhythm #rhythmA { g f e d c | c d e f g }
and don't have to care at all about the rhythm while entering the notes.
This makes it perfect for homophonic songs, especially when the same
rhythmic pattern appears repeated throughout the whole piece, and the
string argument is more simple and tidy to write than { s4 s4 s8 s8 s4 }.
Anyway, I actually thought about extending the snippet to take a music
input, to allow something like { s4 s4-> s8( s8) s4-> } as input, where
not only the rhythm, but everything attached to the skips in the first
argument gets copied - or better - merged into the second argument. (In
fact, this does not sound too hard to do. I think I'll try this soon...)
Or add a filter, s. t. only the duration of those notes gets changed for
which no explicit duration is given, which allows for short intermezzi
of a different rhythms. This latter one is harder, however, since you
have to "merge" the timings of the different music arguments.
But in the end, all this would actually be _harder_ to implement - since
I'd have to write it myself, and could not just copy it from
$RANDOM_STRANGER putting code in the LSR...
Now I also remember what the rhythm parsing function should already be
available for: the \note markup takes quite the same as an argument, but
of course does not need the *num/den as well, right?
Cheers (and thanks),
Kieren.
You're welcome.
Cheers,
Alexander
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user