]> git.donarmstrong.com Git - lilypond.git/commitdiff
Issue 2530: Use fractions rather than Scheme pairs for \scaleDuration, timeSignatureF...
authorDavid Kastrup <dak@gnu.org>
Sat, 12 May 2012 23:23:31 +0000 (01:23 +0200)
committerDavid Kastrup <dak@gnu.org>
Wed, 16 May 2012 07:50:25 +0000 (09:50 +0200)
Documentation/ly-examples/aucun-snippet.ly
Documentation/notation/rhythms.itely
Documentation/snippets/new/changing-time-signatures-inside-a-polymetric-section-using--scaledurations.ly [new file with mode: 0644]
input/regression/chord-tremolo-scaled-durations.ly
input/regression/time-signature-settings-by-staff.ly
lily/lexer.ll
lily/parser.yy
ly/engraver-init.ly
ly/performer-init.ly

index 9fb71c8c085b7326f221a36583d0d4e04effcdde..bcfc2f1dceaa5b6fc0a929fc7e1e748e185944a0 100644 (file)
@@ -1,4 +1,4 @@
-\version "2.15.18"
+\version "2.15.39"
 \include "example-header.ily"
 
 \paper {
@@ -187,9 +187,9 @@ triplumNotes = \relative c' {
   f8 f4 e8 d c f f f | % 1
        % the \scaleDurations command below makes 5 notes last the
        % duration of a dotted quarter
-       e8 c4 \scaleDurations #'(3 . 2) {       \times 4/5{e16[ d e d e]} } e8 f4 | % 2
+       e8 c4 \scaleDurations 3/2 {     \times 4/5{e16[ d e d e]} } e8 f4 | % 2
   g2. ~ g4. | % 3
-       f8 d4 f4. \scaleDurations #'(3 . 2) { \times 4/6{ g16[ f e f e f]}} % 4
+       f8 d4 f4. \scaleDurations 3/2 { \times 4/6{ g16[ f e f e f]}} % 4
        g8 g4 g4. e4. | % 5
        fis8 d4 e8\startGroup g4\stopGroup f8[ e d] | % 6
        c2. r4. | % 7
@@ -222,10 +222,10 @@ tenorNotes = \relative c {
                  %\set Staff.instrumentName = "Triplum"
                  \set Staff.instrumentName = \incipitTriplum
                        \set Staff.shortInstrumentName = "Tr."
-      \set Staff.timeSignatureFraction = #'(9 . 8)
-      \scaleDurations #'(2 . 3)
+      \set Staff.timeSignatureFraction = 9/8
+      \scaleDurations 2/3
                  \context Voice = "triplum" { \global \triplumNotes }
-%      \scaleDurations #'(2 . 3)
+%      \scaleDurations 2/3
 %                      \context Voice = "slashes" { \triplumSkips }
            \new Lyrics { \lyricsto "triplum" { \triplumWords }}
                >>
@@ -233,8 +233,8 @@ tenorNotes = \relative c {
                  %\set Staff.instrumentName = "Motetus"
                  \set Staff.instrumentName = \incipitMotetus
                        \set Staff.shortInstrumentName = "M."
-      \set Staff.timeSignatureFraction = #'(9 . 8)
-      \scaleDurations #'(2 . 3)
+      \set Staff.timeSignatureFraction = 9/8
+      \scaleDurations 2/3
                        \context Voice = "motetus" { \global \motetusNotes }
            \new Lyrics { \lyricsto "motetus" { \motetusWords }}
          >>
index e223bab4124b6d54cedca6e31056b37e6c6a3521..872464c4eae7317674fb452cda20ac92e9fd4d4c 100644 (file)
@@ -7,7 +7,7 @@
     Guide, node Updating translation committishes..
 @end ignore
 
-@c \version "2.15.18"
+@c \version "2.15.39"
 
 @node Rhythms
 @section Rhythms
@@ -317,8 +317,10 @@ fraction @code{N/M} by appending @code{*N/M} (or @code{*N} if @code{M}
 is 1) to the duration.  This will not affect the appearance of the
 notes or rests produced, but the altered duration will be used in
 calculating the position within the measure and setting the duration
-in the MIDI output.  Multiplying factors may be combined such as
-@code{*L*M/N}.
+in the MIDI output.  Multiplying factors may be combined like
+@code{*L*M/N}.  Factors are part of the duration: if
+you don't specify a duration for subsequent notes, the default
+duration taken from the preceding note includes any scaling factor.
 
 In the following example, the first three notes take up exactly
 two beats, but no triplet bracket is printed.
@@ -326,16 +328,16 @@ two beats, but no triplet bracket is printed.
 @lilypond[quote,relative=2,verbatim]
 \time 2/4
 % Alter durations to triplets
-a4*2/3 gis4*2/3 a4*2/3
+a4*2/3 gis a
 % Normal durations
-a4 a4
+a4 a
 % Double the duration of chord
 <a d>4*2
 % Duration of quarter, appears like sixteenth
 b16*4 c4
 @end lilypond
 
-The duration of spacing notes may also be modified by
+The duration of spacer rests may also be modified by
 a multiplier.  This is useful for skipping many measures, e.g.,
 @code{s1*23}.
 
@@ -349,20 +351,19 @@ Longer stretches of music may be compressed by a fraction in the
 same way, as if every note, chord or rest had the fraction as a
 multiplier.  This leaves the appearance of the music unchanged but
 the internal duration of the notes will be multiplied by the
-fraction @emph{num}/@emph{den}.  The spaces around the dot are
-required.  Here is an example showing how music can be compressed
-and expanded:
+fraction @emph{num}/@emph{den}.  Here is an example showing how music
+can be compressed and expanded:
 
 @lilypond[quote,relative=2,verbatim]
 \time 2/4
 % Normal durations
 <c a>4 c8 a
 % Scale music by *2/3
-\scaleDurations #'(2 . 3) {
+\scaleDurations 2/3 {
   <c a f>4. c8 a f
 }
 % Scale music by *2
-\scaleDurations #'(2 . 1) {
+\scaleDurations 2/1 {
   <c' a>4 c8 b
 }
 @end lilypond
@@ -1061,8 +1062,8 @@ be changed, or new default values can be added:
   \new Staff {
     \relative c' {
       \overrideTimeSignatureSettings
-        #'(4 . 4)  % timeSignatureFraction
-        #'(1 . 4)  % baseMomentFraction
+        4/4        % timeSignatureFraction
+        1/4        % baseMomentFraction
         #'(3 1)    % beatStructure
         #'()       % beamExceptions
       \time 4/4
@@ -1077,11 +1078,11 @@ be changed, or new default values can be added:
 @enumerate
 
 @item
-@code{@var{timeSignatureFraction}}, a Scheme pair describing the
+@code{@var{timeSignatureFraction}}, a fraction describing the
 time signature.
 
 @item
-@code{@var{baseMomentFraction}}, a Scheme pair containing the numerator
+@code{@var{baseMomentFraction}}, a fraction containing the numerator
 and denominator of the basic timing unit for the time signature.
 
 @item
@@ -1105,8 +1106,8 @@ instantiated or there must be music in the context before the
   \relative c' {
     % This call will fail because the context isn't yet instantiated
     \overrideTimeSignatureSettings
-      #'(4 . 4)  % timeSignatureFraction
-      #'(1 . 4)  % baseMomentFraction
+      4/4        % timeSignatureFraction
+      1/4        % baseMomentFraction
       #'(3 1)    % beatStructure
       #'()       % beamExceptions
     \time 4/4
@@ -1114,8 +1115,8 @@ instantiated or there must be music in the context before the
     \repeat unfold 7 { c8 } |
     % This call will succeed
     \overrideTimeSignatureSettings
-      #'(4 . 4)  % timeSignatureFraction
-      #'(1 . 4)  % baseMomentFraction
+      4/4        % timeSignatureFraction
+      1/4        % baseMomentFraction
       #'(3 1)    % beatStructure
       #'()       % beamExceptions
     \time 4/4
@@ -1138,13 +1139,13 @@ to the original values:
   \relative c' {
     \repeat unfold 8 { c8 } |
     \overrideTimeSignatureSettings
-      #'(4 . 4)  % timeSignatureFraction
-      #'(1 . 4)  % baseMomentFraction
+      4/4        % timeSignatureFraction
+      1/4        % baseMomentFraction
       #'(3 1)    % beatStructure
       #'()       % beamExceptions
     \time 4/4
     \repeat unfold 8 { c8 } |
-    \revertTimeSignatureSettings #'(4 . 4)
+    \revertTimeSignatureSettings 4/4
     \time 4/4
     \repeat unfold 8 { c8 } |
   }
@@ -1161,8 +1162,8 @@ for different staves by moving the @code{Timing_translator} and the
   \new StaffGroup <<
      \new Staff {
         \overrideTimeSignatureSettings
-          #'(4 . 4)  % timeSignatureFraction
-          #'(1 . 4)  % baseMomentFraction
+          4/4        % timeSignatureFraction
+          1/4        % baseMomentFraction
           #'(3 1)    % beatStructure
           #'()       % beamExceptions
         \time 4/4
@@ -1170,8 +1171,8 @@ for different staves by moving the @code{Timing_translator} and the
      }
      \new Staff {
         \overrideTimeSignatureSettings
-          #'(4 . 4)  % timeSignatureFraction
-          #'(1 . 4)  % baseMomentFraction
+          4/4        % timeSignatureFraction
+          1/4        % baseMomentFraction
           #'(1 3)    % beatStructure
           #'()       % beamExceptions
         \time 4/4
@@ -1585,14 +1586,14 @@ affect the autobeaming rules.
   }
   \new Staff {
     \time 3/4
-    \set Staff.timeSignatureFraction = #'(9 . 8)
-    \scaleDurations #'(2 . 3)
+    \set Staff.timeSignatureFraction = 9/8
+    \scaleDurations 2/3
       \repeat unfold 6 { c8[ c c] }
   }
   \new Staff {
     \time 3/4
-    \set Staff.timeSignatureFraction = #'(10 . 8)
-    \scaleDurations #'(3 . 5) {
+    \set Staff.timeSignatureFraction = 10/8
+    \scaleDurations 3/5 {
       \repeat unfold 2 { c8[ c c] }
       \repeat unfold 2 { c8[ c] } |
       c4. c \times 2/3 { c8[ c c] } c4
@@ -2291,8 +2292,8 @@ beaming settings for a time signature are described in
 <<
   \new Staff {
     \overrideTimeSignatureSettings
-      #'(3 . 4)         % timeSignatureFraction
-      #'(1 . 8)         % baseMomentFraction
+      3/4               % timeSignatureFraction
+      1/8               % baseMomentFraction
       #'(1 5)           % beatStructure
       #'()             % beamExceptions
     \time 3/4
@@ -3321,7 +3322,7 @@ becomes:
 Or explicitly change the musical duration:
 
 @example
-\acciaccatura @{ \scaleDurations #' (1 . 2) @{ c'8[ d' e' f' g'] @} @}
+\acciaccatura @{ \scaleDurations 1/2 @{ c'8[ d' e' f' g'] @} @}
 @end example
 
 See @ref{Scaling durations}.
diff --git a/Documentation/snippets/new/changing-time-signatures-inside-a-polymetric-section-using--scaledurations.ly b/Documentation/snippets/new/changing-time-signatures-inside-a-polymetric-section-using--scaledurations.ly
new file mode 100644 (file)
index 0000000..66013ce
--- /dev/null
@@ -0,0 +1,39 @@
+\version "2.15.17"
+
+\header {
+  lsrtags = "workaround, contexts-and-engravers, contemporary-notation, rhythms"
+
+  doctitle = "Changing time signatures inside a polymetric section using \\scaleDurations"
+}
+
+
+\layout {
+  \context {
+    \Score
+    \remove "Timing_translator"
+    \remove "Default_bar_line_engraver"
+  }
+  \context {
+    \Staff
+    \consists "Timing_translator"
+    \consists "Default_bar_line_engraver"
+  }
+}
+
+<<
+  \new Staff {
+    \scaleDurations 8/5 {
+      \time 6/8
+      \set Timing.measureLength = #(ly:make-moment 6 5)
+      b8 b b b b b
+      \time 2/4
+      \set Timing.measureLength = #(ly:make-moment 4 5)
+      b4 b
+    }
+  }
+  \new Staff {
+    \clef bass
+    \time 2/4
+    c2 d e f
+  }
+>>
index 0b8c6c8ad1589641dd79ce81129ee8df31de4167..6cf26b9589870ecc74a5f9322cc089573be0bc82 100644 (file)
@@ -1,4 +1,4 @@
-\version "2.14.0"
+\version "2.15.17"
 
 \header {
   texidoc = "Don't allow scaled durations to confuse the tremolo beaming.
@@ -8,7 +8,7 @@ The tremolos should each have 3 beams."
 {
   \time 3/4
   \repeat tremolo 12 {e'32 f'}
-  \scaleDurations #'(3 . 4) {
+  \scaleDurations 3/4 {
     \repeat tremolo 12 {e'32 f'} r4
   }
 }
index b5ddc6f81807ca0fe6d174a948e6588f27372547..c772b7b1a44f320121a353a9df2b28f92450b7ef 100644 (file)
@@ -1,4 +1,4 @@
-\version "2.14.0"
+\version "2.15.17"
 
 \header {
   texidoc = "
@@ -13,8 +13,8 @@ should be beamed 3/4, 1/4.  The lower staff should be beamed 1/4, 3/4.
   \new StaffGroup <<
      \new Staff {
         \overrideTimeSignatureSettings
-          #'(4 . 4)  % timeSignatureFraction
-          #'(1 . 4)  % baseMomentFraction
+          4/4        % timeSignatureFraction
+          1/4        % baseMomentFraction
           #'(3 1)    % beatStructure
           #'()       % beamExceptions
         \time 4/4
@@ -22,8 +22,8 @@ should be beamed 3/4, 1/4.  The lower staff should be beamed 1/4, 3/4.
      }
      \new Staff {
         \overrideTimeSignatureSettings
-          #'(4 . 4)  % timeSignatureFraction
-          #'(1 . 4)  % baseMomentFraction
+          4/4        % timeSignatureFraction
+          1/4        % baseMomentFraction
           #'(1 3)    % beatStructure
           #'()       % beamExceptions
         \time 4/4
index 78b647530335db8b81bae575d6bea71e3dadb4fe..bdbf1283141e643d28d2216b381cddd5184586a9 100644 (file)
@@ -711,6 +711,11 @@ BOM_UTF8   \357\273\277
        }
 }
 
+{FRACTION}     {
+       yylval.scm =  scan_fraction (YYText ());
+       return FRACTION;
+}
+
 -{UNSIGNED}    | // backup rule
 {REAL}         {
        yylval.scm = scm_c_read_string (YYText ());
@@ -721,6 +726,7 @@ BOM_UTF8    \357\273\277
        return REAL;
 }
 
+{UNSIGNED}/\/  | // backup rule
 {UNSIGNED}     {
        yylval.scm = scm_c_read_string (YYText ());
        return UNSIGNED;
index 601d63fc31e5586ad9016195f48d031644a8549b..49acd012d51ca0820db2b8cdf3a613aedbdcf901 100644 (file)
@@ -786,6 +786,9 @@ identifier_init:
        | number_expression {
                $$ = $1;
        }
+       | FRACTION {
+               $$ = $1;
+       }
        | string {
                $$ = $1;
        }
@@ -2060,12 +2063,14 @@ simple_string: STRING {
 scalar:
        embedded_scm_arg
        | bare_number
+       | FRACTION
        | lyric_element
        ;
 
 scalar_closed:
        embedded_scm_arg_closed
        | bare_number
+       | FRACTION
        | lyric_element
        ;
 
index 6e8210b9c183f788e5ab0bff425d6aaaf65d415d..7f9a2b9699812347a237e86ff3529cc20581aa48 100644 (file)
@@ -16,7 +16,7 @@
 %%%% You should have received a copy of the GNU General Public License
 %%%% along with LilyPond.  If not, see <http://www.gnu.org/licenses/>.
 
-\version "2.15.20"
+\version "2.15.39"
 
 \context {
   \name "Global"
@@ -614,7 +614,7 @@ automatically when an output definition (a @code{\score} or
   repeatCountVisibility = #all-repeat-counts-visible
 
   timeSignatureSettings = #default-time-signature-settings
-  timeSignatureFraction = #'(4 . 4)
+  timeSignatureFraction = 4/4
 
 %% These defaults should be the same as the rules established in
 %%   scm/time-signature-settings.scm for 4/4 time
index 1a36b7fd19ef8b13a326ac610b08007f3fad19e9..fdfa7add3c69ee58dc6c18b0a8ce47dfa447b5cf 100644 (file)
@@ -16,7 +16,7 @@
 %%%% You should have received a copy of the GNU General Public License
 %%%% along with LilyPond.  If not, see <http://www.gnu.org/licenses/>.
 
-\version "2.14.0"
+\version "2.15.39"
 
 %%
 %% setup for Request->Element conversion.
   %% Timing variables in layout definitions before any
   %% Timing_translator has been run.
 
-  timeSignatureFraction = #'(4 . 4)
+  timeSignatureFraction = 4/4
 
 %% These defaults should be the same as the rules established in
 %%   scm/time-signature-settings.scm for 4/4 time