Jump to content

Time signature with alternate in parentheses: Difference between revisions

From LilyPond wiki
m New category
Tags: Mobile edit Mobile web edit
Improved
Line 1: Line 1:
In polymetric music, a composer may indicate beat structure by following one time signature with another in parenthesis, for example: 3/4 (6/8) indicating a 6/8 beat in a 3/4 measure, or 6/4 (6/8) indicating a 6/8 beat in a 6/4 measure. This snippet is derived from the parenthesize-time snippet, adding an unparenthesized fraction in front of the parenthesized one.
In polymetric music, a composer may indicate beat structure by following one time signature with another in parenthesis, for example: 3/4 (6/8) indicating a 6/8 beat in a 3/4 measure, or 6/4 (6/8) indicating a 6/8 beat in a 6/4 measure.
 
This snippet uses a small Scheme function that overrides the <code>TimeSignature</code> stencil once to display both the regular and the alternate time signature.


<lilypond version="2.24">
<lilypond version="2.24">
%% http://lsr.di.unimi.it/LSR/Item?id=782
#(define ((time-parenthesized-time up down upp downp) grob)
#(define ((time-parenthesized-time up down upp downp) grob)
   (grob-interpret-markup grob
   (let ((m1 (grob-interpret-markup
    (markup #:override '(baseline-skip . 0) #:number
              grob
      (#:line (
              (markup #:override '(baseline-skip . 0)
          (#:center-column (up down))
                      #:number (#:center-column
          #:vcenter "("
                                ((number->string up)
          (#:center-column (upp downp))
                                (number->string down))))))
          #:vcenter ")" )))))
        (m2 (grob-interpret-markup
              grob
              (markup #:override '(baseline-skip . 0)
                      #:number (#:center-column
                                ((number->string upp)
                                (number->string downp)))))))
    (ly:stencil-combine-at-edge
      m1 X RIGHT
      (parenthesize-stencil m2 0.1 0.4 0.4 0.1)
      0.3)))


\relative c' {
\relative c' {
  \override Staff.TimeSignature.stencil = #(time-parenthesized-time "3" "4" "6" "8")    
  \once \override Staff.TimeSignature.stencil =
  \time 3/4
    #(time-parenthesized-time 3 4 6 8)
  b8 b8 gis8 gis4 gis8
  \time 3/4 b8 b8 gis8 gis4 gis8 |
  \time 4/4 b4 b b b
}
}
</lilypond>
</lilypond>

Revision as of 20:42, 14 April 2026

In polymetric music, a composer may indicate beat structure by following one time signature with another in parenthesis, for example: 3/4 (6/8) indicating a 6/8 beat in a 3/4 measure, or 6/4 (6/8) indicating a 6/8 beat in a 6/4 measure.

This snippet uses a small Scheme function that overrides the TimeSignature stencil once to display both the regular and the alternate time signature.

\version "2.24"

#(define ((time-parenthesized-time up down upp downp) grob)
   (let ((m1 (grob-interpret-markup
              grob
              (markup #:override '(baseline-skip . 0)
                      #:number (#:center-column
                                ((number->string up)
                                 (number->string down))))))
         (m2 (grob-interpret-markup
              grob
              (markup #:override '(baseline-skip . 0)
                      #:number (#:center-column
                                ((number->string upp)
                                 (number->string downp)))))))
     (ly:stencil-combine-at-edge
      m1 X RIGHT
      (parenthesize-stencil m2 0.1 0.4 0.4 0.1)
      0.3)))

\relative c' {
  \once \override Staff.TimeSignature.stencil =
    #(time-parenthesized-time 3 4 6 8)
  \time 3/4 b8 b8 gis8 gis4 gis8 |
  \time 4/4 b4 b b b
}