lilypond-user
[Top][All Lists]
Advanced

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

Compound time signatures


From: Henrik Frisk
Subject: Compound time signatures
Date: Thu, 25 Aug 2005 15:04:27 +0200

Here's an expanded version of the compound-time.ly example in the Tips and 
Tricks section. It allows for different combinations of divisions such as 3/16 
+ 3/8 (provided that smaller divisions than 16ths are not used) and adjusts the 
spacing accordingly. A second version of the macro allows for compound time 
signatures such as 3+5/8.

Here's an example and a PS:

%%%%%%%%%%%%% BEGIN SNIPPET %%%%%%%%%

\version "2.7.7"

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

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


\score {
   \new Staff <<
     {
  \time 13/16
  \override Staff.TimeSignature #'print-function
  = #(lambda (grob) (compound-time grob "3" "5" "16" "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" "8" "16" "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 |
      }
   >>
}

%%%%%%%%%%%%%% END SNIPPET %%%%%%%%%





reply via email to

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