[prev in list] [next in list] [prev in thread] [next in thread]
List: lilypond-user
Subject: Re: "Alla breve" music function
From: Arvid =?utf-8?b?R3LDuHR0aW5n?= <arvidgr () gmail ! com>
Date: 2006-09-26 14:48:25
Message-ID: loom.20060926T164024-844 () post ! gmane ! org
[Download RAW message or body]
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
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic