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



_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to