lilypond-user
[Top][All Lists]
Advanced

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

Re: Compound time signatures


From: Pedro Kröger
Subject: Re: Compound time signatures
Date: Thu, 01 Sep 2005 12:39:46 -0300
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

Han-Wen Nienhuys <address@hidden> writes:

> I think it would also be better if the code just used numbers, and does 
>  a (format "~a" NUMBER) or (number->string NUMBER) in  the end.

Here it is. I also made Graham's suggestion of switching the numbers,
like (compound-time grob 3 16 5 8). This is a very cool example (thanks
Henrik!). I think the ultimate would be to merge the 2 functions and or
detect the behavior automatically or have it passed as a keyword (like
compound-time :equal-div)

Pedro

------------------------------------------------------------------------
\version "2.7.7"

#(define (compound-time grob one divone two divtwo)
  (let ((hmoveDivOne
         (if (equal? divone 16)
              0.6
              0.0))
        (hmoveDivTwo
         (if (equal? divtwo 16)
             0.6
             0.0))
        (hmoveLastCol
         (if (equal? divtwo 16)
             -0.6
             -0.3))
        (one-string (number->string one))
        (two-string (number->string two))
        (divone-string (number->string divone))
        (divtwo-string (number->string divtwo)))
    (interpret-markup
     (ly:grob-layout grob)
     '(((baseline-skip . 2)
        (word-space . 1.5)
        (font-family . number)))
     (markup #:line (#:column
                     ((#:translate (cons hmoveDivOne 0) one-string) 
divone-string)
                     #:lower 1 (#:translate (cons hmoveDivOne 0) "+")
                     (#:translate (cons hmoveLastCol 0)
                                  #:column
                                  ((#:translate (cons hmoveDivTwo 0)
                                                two-string)
                                   divtwo-string)))))))

#(define (compound-time-equal-div grob one two divone)
  (let ((hmoveDiv
         (if (equal? divone 16)
             -0.8
             -0.1))
        (one-string (number->string one))
        (two-string (number->string two))
        (divone-string (number->string divone)))
    (interpret-markup
     (ly:grob-layout grob)
     '(((baseline-skip . 2)
        (word-space . 1.4)
        (font-family . number)))
     (markup (#:line (one-string
                      (#:column ("+" (#:translate
                                      (cons hmoveDiv 0.)
                                      divone-string)))
                      (#:translate (cons -0.2 0) two-string)))))))


\score {
   \new Staff <<
     {
  \time 13/16
  \override Staff.TimeSignature #'print-function
= #(lambda (grob) (compound-time grob 3 16 5 8))
  s16*13 |
  \time 13/16
  \override Staff.TimeSignature #'print-function
  = #(lambda (grob) (compound-time grob 5 8 8 16))
  s16*13 |
  \time 13/16
  \override Staff.TimeSignature #'print-function
  = #(lambda (grob) (compound-time grob 5 16 8 16))
  s16*13 |
  \time 13/16
  \override Staff.TimeSignature #'print-function
  = #(lambda (grob) (compound-time-equal-div grob 5 8 16))
  s16*13 |
  \time 13/8
  \override Staff.TimeSignature #'print-function
  = #(lambda (grob) (compound-time-equal-div grob 5 8 8))
  s8*13 |
      }
   >>
}
------------------------------------------------------------------------




reply via email to

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