[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: "Alla breve" music function
From: |
Arvid Grøtting |
Subject: |
Re: "Alla breve" music function |
Date: |
Tue, 26 Sep 2006 14:48:25 +0000 (UTC) |
User-agent: |
Loom/3.14 (http://gmane.org/) |
Markus Schneider <mschneider <at> hotmail.com> writes:
>
> Hello list,
>
> I'm looking for a function that doubles every duration.
>
> Here's a short example:
>
> Turn { c1 c2 c4 c16 c16 c16 c16 }
> into { c1 ~ c1 c1 c2 c8 c8 c8 c8 }
>
> I digged around, but I think this is still beyond my limited scheme
> understanding.
> If someone did somthing like this already or can give me a hint, I'd be
> happy!
This sounded like a nice excercise, so I dug around a bit and came up with
the following:
allaBreve = #(define-music-function (parser location music)
(ly:music?)
(let ((new-music (ly:music-deep-copy music)))
(shift-duration-log new-music -1 0)
new-music))
\allaBreve { c1 c2 c4 c16 c16 c16 c16 }
This doesn't give c1 ~ c1, unless you do something like this (in which case
you'll only get ties at bar lines, anyway):
\new Voice \with {
\remove "Note_heads_engraver"
\consists "Completion_heads_engraver"
}{
\allaBreve { c1 c2 c4 c16 c16 c16 c16 }
shift-duration-log isn't documented beyond what's in the source code,
nor is it prefixed with ly:, but it's exported. It's probably subject to
change without any notice at all, so use at your own risk ;-)
--
Arvid