Jump to content

Time signature with alternate in parentheses: Difference between revisions

From LilyPond wiki
m New category
Tags: Mobile edit Mobile web edit
Aaand another improvement.
 
(2 intermediate revisions by the same user not shown)
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 provides a music function <code>\timeP</code> that is a small Scheme wrapper around the <code>\compound-meter</code> markup function.  It overrides the <code>TimeSignature</code> stencil once to display both a regular and an alternate time signature.


<lilypond version="2.24">
<lilypond version="2.24">
%% http://lsr.di.unimi.it/LSR/Item?id=782
timeP =
 
#(define-music-function (t tp) (list? list?)
#(define ((time-parenthesized-time up down upp downp) grob)
  (define ((time-parenthesized-time t tp) grob)
  (grob-interpret-markup grob
    (let ((m1 (grob-interpret-markup
    (markup #:override '(baseline-skip . 0) #:number
                grob (markup #:compound-meter t)))
      (#:line (
          (m2 (grob-interpret-markup
          (#:center-column (up down))
                grob (markup #:compound-meter tp))))
          #:vcenter "("
      (ly:stencil-combine-at-edge
          (#:center-column (upp downp))
        m1 X RIGHT
          #:vcenter ")" )))))
        (parenthesize-stencil m2 0.1 0.4 0.4 0.1)
        0.3)))
  #{
    \once \override Timing.TimeSignature.stencil =
      #(time-parenthesized-time t tp)
  #})


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

Latest revision as of 04:35, 15 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 provides a music function \timeP that is a small Scheme wrapper around the \compound-meter markup function. It overrides the TimeSignature stencil once to display both a regular and an alternate time signature.

\version "2.24"

timeP =
#(define-music-function (t tp) (list? list?)
   (define ((time-parenthesized-time t tp) grob)
     (let ((m1 (grob-interpret-markup
                grob (markup #:compound-meter t)))
           (m2 (grob-interpret-markup
                grob (markup #:compound-meter tp))))
       (ly:stencil-combine-at-edge
        m1 X RIGHT
        (parenthesize-stencil m2 0.1 0.4 0.4 0.1)
        0.3)))
   #{
     \once \override Timing.TimeSignature.stencil =
       #(time-parenthesized-time t tp)
   #})

\relative c' {
  \timeP #'(3 4) #'(6 8) \time 3/4
    b8 b8 gis8 gis4 gis8 |
  \timeP #'(4 4) #'(3 2 3 8) \time 4/4
    b4. b4 b4.
}