]> git.donarmstrong.com Git - lilypond.git/commitdiff
* input/test/polymetric-differing-notes.ly: add example with
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Sat, 26 Jul 2003 14:03:49 +0000 (14:03 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Sat, 26 Jul 2003 14:03:49 +0000 (14:03 +0000)
disparate note values.

* input/test/polymetric.ly: rename from poly-metric

ChangeLog
input/test/polymetric-differing-notes.ly [new file with mode: 0644]
input/test/polymetric.ly

index f74710ec71bb6cee464c392f2912464b00cd654a..e03ebbaeba5d729887a33a7248235a22a7e40cd3 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,9 @@
 2003-07-26  Han-Wen Nienhuys  <hanwen@cs.uu.nl>
 
+       * input/test/polymetric-differing-notes.ly: add example with
+       disparate note values.
+
        * input/test/polymetric.ly: rename from poly-metric
-       add example with disparate note value.
 
        * scripts/ly2dvi.py (include_path): bugfix: use outbase
        iso. outname.
diff --git a/input/test/polymetric-differing-notes.ly b/input/test/polymetric-differing-notes.ly
new file mode 100644 (file)
index 0000000..e519f36
--- /dev/null
@@ -0,0 +1,70 @@
+\version "1.7.18"
+
+\header{ texidoc="
+
+@cindex polymetric music
+
+@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.
+
+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.
+
+"
+
+}
+
+
+#(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'  <
+       \context Staff= AS {
+           \time 3/4
+           c4 c c | c c c |
+       }
+       \context Staff= BS {
+           \time 3/4
+           \property Staff.timeSignatureFraction= #'(9 . 8)
+           \apply #display-music \apply #(scale-music-function '(2 . 3))
+             \repeat unfold 6 { c8-[ c c-] }
+       }
+       
+       \context Staff= DS {
+           \time 3/4
+           \property Staff.timeSignatureFraction= #'(10 . 8)
+           \apply #display-music \apply #(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  }
+       }
+       } >
+       \paper { raggedright = ##t }
+}
index e3b17665a58331e02e8caa5798693f86ff30926e..3bf0888ef897efc6852e8fed9bf82221bcb4a090 100644 (file)
@@ -10,10 +10,6 @@ This is done by moving the timing engraver to staff context. Also,
 Staff should be given the alias @code{Timing} to make @code{\time}
 command work correctly. Barlines distort the regular spacing, though.
 
-If the note durations do not line up, \times can be used to scale up a
-staff. The second staff has a 3/4 signature with a 3/5 tuplet over all
-of the notes. Switching off the tuplet bracket, and manually printing
-a 10/8 sign gives the desired effect.
 
 " }
 
@@ -23,12 +19,7 @@ a 10/8 sign gives the desired effect.
            \time 3/4
            c4 c c | c c c |
        }
-       \context Staff= DS {
-           \time 3/4
-           \property Staff.timeSignatureFraction= #'(10 . 8)
-           \property Staff.tupletInvisible = ##t
-           \times 3/5 { c4. c4. c4 c4 |  c4. c4. c4 c4  }
-       }
+
        \context Staff=BS {
            \time 2/4
            c4 c | c c | c c