TL;DR
How do I engrave an alternating time signature and an initial cue clef?

Scriabin has a prelude where he has written a time signature as alternating
5/8 and 4/8 time.  After the initial one, no other time signatures are
written. I have figured out a way to engrave this with help from a LSR
entry.

Also, the first notes in the right hand are in bass clef.  I want to
engrave the initial clef in the right hand as treble, then after the time
signature have a cue bass clef.  Lukas-Fabian Moser wrote a solution for
that (thanks!)

The problem is those two solutions don't work together. (Looking at them, I
can see why they wouldn't.)  I am not clever enough to merge the two
solutions or think of a third.  Can anyone help me?

I've attached a screenshot of what I'm trying to engrave.  Also attached is
my attempt to use the two solutions, but without success.

--
Knute Snortum
\version "2.24.2"

%%% Set queing bass clef after initial treble clef

% Append markup in the text property to the grob
#(define (append-markup grob old-stencil)
  (ly:stencil-combine-at-edge
    old-stencil X RIGHT (ly:text-interface::print grob)))

trebleToBass = {
  \clef bass
  % Fake staff clef appearance
  \once \override Staff.Clef.glyph-name = "clefs.G"
  \once \override Staff.Clef.Y-offset = -1
  % Make sure any key signatures will printed with respect to
  % correct middle c position expected for treble clef
  \once \set Staff.middleCClefPosition = -6
  % Append change clef to the time signature
  \once \override Staff.TimeSignature.text = \markup {
    \hspace #1.2
    \raise #1
    \musicglyph "clefs.F_change"
  }
  \once \override Staff.TimeSignature.stencil = #(lambda (grob)
    (append-markup grob (ly:time-signature::print grob)))
}

%%% Alternating time 
#(define ((time-alternate-time upa downa upb downb) grob)
   (grob-interpret-markup grob
     (markup #:override '(baseline-skip . 0) #:number
       (#:line (
           (#:center-column (upa downa))
           (#:center-column (upb downb)))))))

upper = \relative {
  \trebleToBass
  \key bes \minor
  \partial 8 c'8
  \repeat unfold 4 { c8 c c c c | c c c c | }
}

lower = \relative {
  \key bes \minor
  \clef bass
  \partial 8 c8
  \repeat unfold 4 { c8 c c c c | c c c c | }
}

timeSignatures = {
  \override Score.TimeSignature.stencil = #(time-alternate-time "5" "8" "4" "8")
  \time 5/8
  \partial 8 s8
  \override Score.TimeSignature.stencil = ##f
  \repeat unfold 4 { \time 5/8 s4. s4 | \time 4/8 s2 | }
}

\score {
  \new PianoStaff <<
    \new Staff \upper
    \new Staff \lower
    \new Devnull \timeSignatures
  >>
}

Reply via email to