lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Constructive Criticism and a Question


From: Erik Sandberg
Subject: Re: Constructive Criticism and a Question
Date: Thu, 21 Dec 2006 19:05:34 +0100
User-agent: KMail/1.9.5

On Wednesday 20 December 2006 10:58, Mats Bengtsson wrote:
> I agree that the scores that take most time to type in are those that have
> repeated rhythms like
> \times 2/3 {c c c } c4 \times 2/3 {c c c } c4
> or
> c8 c16 c c4 c8 c16 c c4
> especially if these are combined with slurs. It is certainly possible to
> implement your
> own music function that applies a specific rhyhtmic pattern to a set of
> pitches.
> However, this if fairly clumsy to do for the moment. I'm sure that some
> clever
> Scheme hacker can come up with some solution like
> mypattern = #(make-rhythmization #{ c8 c16 c16 c4 #})
> so that
> \mypattern {c d e f }
> results in
> c8 d16 e16 f4
>
> Of course, it would be even better if the function also could produce
> the \pat
> function in input/test/music-box.ly, i.e. where some of the pitches are
> repeated
> in the rhythmic pattern.

You can try this one:

#(define (make-rhythmization pattern)
 (define-music-function (parser location music) (ly:music?)
        ((trans (ly:music-property music 'elements)) pattern)))

It depends on the 'trans' function definition in music-box.ly.

If you think it's a useful tool, then perhaps it could be added to the lily 
distribution. I'd prefer some other name though, e.g. make-pattern-function. 
It's difficult to spell rhythmization, and the word could mean different 
things.

BTW: IWBN to have high-order functions in lily, so we could use a nice syntax 
like:
pat = \makePatternFunction { ... }
This would require static typing of music function return values, which 
probably would be doable if we implement a proper typing system (e.g., let 
the car of the music function signature denote the return type; if that's a 
list, it returns a function of the given type). 

Ah, another good thing with typed return values, is that we could make the 
distinction between post-events and music cleaner. Hrm, that would also 
require that the \tweak function is polymorphic in some sense.. perhaps this 
is what you meant in your previous mail, Han-Wen?

-- 
Erik




reply via email to

[Prev in Thread] Current Thread [Next in Thread]