lilypond-devel
[Top][All Lists]
Advanced

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

Issue 3917: Add \alternatingTimeSignatures (issue 97110045)


From: lilyliska
Subject: Issue 3917: Add \alternatingTimeSignatures (issue 97110045)
Date: Thu, 08 May 2014 20:20:50 +0000

Reviewers: ,

Description:
Issue 3916: Add \alternatingTimeSignatures

A function to print a group of time signatures indicating a section
of music with (irregularly) changing meters.
Takes a list of lists, each sublist representing one time signature.
The first of the time signatures will be used to set the new effective
time signature, apart from that the function doesn't affect timing at
all.

Please review this at https://codereview.appspot.com/97110045/

Affected files (+63, -1 lines):
  M Documentation/notation/rhythms.itely
  M ly/music-functions-init.ly


Index: Documentation/notation/rhythms.itely
diff --git a/Documentation/notation/rhythms.itely b/Documentation/notation/rhythms.itely index 72c963cdb7d84b3e3c2baea0968984a27ce2cbbf..907723d6004c9274914d38ed966c006d68e5472d 100644
--- a/Documentation/notation/rhythms.itely
+++ b/Documentation/notation/rhythms.itely
@@ -1744,6 +1744,44 @@ automatic beaming settings will be adjusted depending on the values.
 }
 @end lilypond

address@hidden \alternatingTimeSignatures
address@hidden alternating time signatures
address@hidden time signature, alternating
+
address@hidden Alternating time signatures
+
+These indicate music with (irregularly) changing meters that
+aren't printed individually.  They are printed using the
address@hidden function.  The syntax for
+this is:
+
address@hidden
+\alternatingTimeSignatures #'@code{(list of lists)}
address@hidden example
+
+Each sublist represents one time signature to be printed.
+Usually you will want to suppress consecutive time signatures
+using @code{\omit Score.TimeSignature} and return to normal
+behaviour using @code{\undo \omit Score.TimeSignature}.
+
address@hidden,verbatim]
+\relative c' {
+  \alternatingTimeSignatures #'((6 8)(5 8))
+  c8 c c c c c
+  \omit Score.TimeSignature
+  \time 5/8
+  c8 c c c c
+  \undo \omit Score.TimeSignature
+  \time 3/4
+  c2.
address@hidden lilypond
+
+Different from compound time signatures
address@hidden does not affect the
+musical structure because the different meters are
+used individually.  The first given time signature
+will be used as the effective @code{\time}.
+
 @seealso
 Music Glossary:
 @rglos{polymetric},
Index: ly/music-functions-init.ly
diff --git a/ly/music-functions-init.ly b/ly/music-functions-init.ly
index e1f9cfd25d30798a403090cc1b1b83d627aa983a..8456abb90f05c2bb77f432ad98fc052c080a75c5 100644
--- a/ly/music-functions-init.ly
+++ b/ly/music-functions-init.ly
@@ -127,6 +127,30 @@ form of a spanner event, @var{property} may also have the form (ly:input-warning location (_ "not a spanner name, `~a'") name)
               (make-music 'Music))))))

+alternatingTimeSignatures =
+#(define-music-function (parser location timesigs)(list?)
+   (_i "Print alternating time signatures. The argument is a Scheme list
+of lists. Each list describes one fraction to be printed.
+When the function has executed the first of the given time signatures
+will be the effective @code{\\time}, while the following are simply graphical.
+When using it you will want to use @code{\\omit Score.TimeSignature}
+before the next use of @code{\\time}. Please note that this does not
+perform any checks regarding the used time signatures, so you're
+responsible yourself to write consistent music. To return to normal
+use of time signatures use @code{\\undo \\omit Score.TimeSignature}.")
+   (let ((first-effective-timesig (cons
+                    (caar timesigs)
+                    (cadar timesigs))))
+     #{ \once\override Staff.TimeSignature.stencil =
+        #(lambda (grob)
+           (grob-interpret-markup grob
+             #{ \markup \override #'(baseline-skip . 0)
+                \number
+ #(map (lambda (x) #{ \markup \center-column #(map number->string x) #})
+                   timesigs)
+             #}))
+        \time #first-effective-timesig #}))
+
 appendToTag =
 #(define-music-function (parser location tag more music)
    (symbol? ly:music? ly:music?)
@@ -754,7 +778,7 @@ appropriate tweak applied.")
               \override #prop-path = #(offsetter (third prop-path) offsets)
             #}
             (make-music 'Music)))))
-
+
 omit =
 #(define-music-function (parser location item) (symbol-list-or-music?)
    (_i "Set @var{item}'s @samp{stencil} property to @code{#f},





reply via email to

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