]> git.donarmstrong.com Git - lilypond.git/blobdiff - input/test/polymetric-differing-notes.ly
* input/test/chords-below-volta-bracket.ly,
[lilypond.git] / input / test / polymetric-differing-notes.ly
index 9b1a77df4a29bce6958d9b7d4034038805196007..0b8a37986af6e9f2ce7bbf9b1bac422c1daaeead 100644 (file)
@@ -1,4 +1,4 @@
-\version "2.1.22"
+\version "2.3.4"
 
 \header{ texidoc="
 
@@ -6,61 +6,45 @@
 
 @cindex scaling durations
 
-You can have multiple time signatures occuring at the same time, with
-different durations aligned.  This is done by 1. compressing one of
-the lines, analogous to \times, but without the bracket, and
-2. manually setting timeSignatureFraction to the desired fraction.
+It is possible to have multiple time signatures, each one in an own staffs, 
+at the same time, and have even a proper vertical alignment of the different 
+durations.  This is done, firstly, by setting a common time signature for
+each staff but replacing it manually using @code{timeSignatureFraction} to 
+the desired fraction, and secondly, by scaling the printed durations to
+the actual, polymetric durations.
 
-This example puts 3/4, 9/8 and 10/8 in parallel. The last staff shows
-what happens on the inside: a 3/4 time signature is combined with a
-3/5 tuplet yielding the equivalent of a 10/8.
+In this example, music with the time signatures of 3/4, 9/8 and 10/8 are
+used in parallel. In the second staff, shown durations are multiplied by 
+2/3, so that 2/3 * 9/8 = 3/4, and in the third staff, shown durations are 
+multiplied by 3/5, so that 3/5 * 10/8 = 3/4.
 
 "
 
 }
 
+#(define ((scale-music-function fraction) x)
+  (ly:music-compress x (ly:make-moment (car fraction) (cdr fraction))))
 
-#(define (scale-one-music m fraction)
-  "Maybe we should just export Music::compress to Scheme?"
-  (let*
-   ((dur (ly:get-mus-property m 'duration)))
-   
-   (if (ly:duration? dur)
-    (let*
-     ((l (ly:duration-log dur))
-      (d (ly:duration-dot-count dur))
-      (factor (ly:duration-factor dur)))
-
-      (ly:set-mus-property! m 'duration
-                            (ly:make-duration l d
-                            (* (car fraction) (car factor))
-                            (* (cdr fraction) (cdr factor))))))
-   
-   m))
-
-#(define (scale-music-function fraction)
-  (lambda (x) 
-   (music-map (lambda (y) (scale-one-music y fraction)) x)))
 
 
 
 \score {
-    \notes \relative c'  <<
+     \relative c'  <<
        \new Staff {
            \time 3/4
            c4 c c | c c c |
        }
        \new Staff {
            \time 3/4
-           \set Staff.timeSignatureFraction =  #'(9 . 8)
-           \apply #display-music \apply #(scale-music-function '(2 . 3))
+           \set Staff.timeSignatureFraction = #'(9 . 8)
+           \applymusic #(scale-music-function '(2 . 3))
              \repeat unfold 6 { c8[ c c] }
        }
        
        \new Staff {
            \time 3/4
-           \set Staff.timeSignatureFraction =  #'(10 . 8)
-           \apply #display-music \apply #(scale-music-function '(3 . 5))
+           \set Staff.timeSignatureFraction = #'(10 . 8)
+           \applymusic #(scale-music-function '(3 . 5))
              { \repeat unfold 2 { c8[ c c] }
                \repeat unfold 2 { c8[  c] }
                |  c4. c4. \times 2/3 { c8 c c } c4  }