lilypond-user
[Top][All Lists]
Advanced

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

Re: Petrucci-like spacing?


From: Carl D. Sorensen
Subject: Re: Petrucci-like spacing?
Date: Fri, 19 Jun 2009 11:24:49 -0600



On 6/18/09 8:45 AM, "Laura Conrad" <address@hidden> wrote:

>>>>>> "Carl" == Carl D Sorensen <address@hidden> writes:
> 
>     Carl> Does this seem at all promising?
>>> 
>>> Yes, but there's still the problem of extra space at the barline.  I
>>> tried Michael's solutions and doing nothing at all and there's still
>>> extra space after the 4th whole note.
> 
>     Carl> How about this?
> 
>     Carl> \relative c'' {
>     Carl>   \key f \major
>     Carl>     \cadenzaOn
>     Carl>     g1*1/4 bes1*1/4 a1*1/4 g1*1/4 g1.*1/6 c4 bes4 c1*1/4
>     Carl> }
> 
>     Carl> I think that gets rid of the extra space.
> 
> Yes, it does. 
> 

Here's the code defining petrucciSpacing:

petrucciSpacing = 
#(define-music-function (parser location music) (ly:music?)
    "Set effective spacing of all notes to 1/4"
    (music-map (lambda (m)
                (if (eq? (ly:music-property m 'name) 'NoteEvent)
                    (let*
                     ((current-duration (ly:music-property m 'duration))
                      (current-log (ly:duration-log current-duration))
                      (current-length (ly:duration-length current-duration))
                      (current-dotcount
                       (ly:duration-dot-count current-duration))
                      (new-factor (ly:moment-div
                                   (ly:make-moment 1 4)
                                   current-length))
                      (new-numerator (ly:moment-main-numerator new-factor))
                      (new-denominator
                       (ly:moment-main-denominator new-factor)))
                     (set! (ly:music-property m 'duration)
                      (ly:make-duration
                       current-log
                       current-dotcount
                       new-numerator
                       new-denominator))
                     m)
                    m))
                  music))

\relative c'' {
  \key f \major
    \cadenzaOn
    \petrucciSpacing {
      g1 bes 1 a1 g1 g1. c4 bes4 c1 \bar "||"
    }
}


HTH,

Carl





reply via email to

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