Display time signature as single number above the staff
Sometimes, when a piece of music has a frequently-changing time signature, the time signature is printed above the staff. In the following example, only the numerator is printed (the denominator is 4 throughout):
I know that this could be achieved in LilyPond by hiding the usual time signatures and manually displaying the numbers. Is it possible to do this by modifying the time signature engraver instead?
1 Comments
Sorted by latest first Latest Oldest Best
You can use a variation of this snippet and use a dynamics context to display the time signatures, like in the following example:
version "2.18.2"
score {
<<
new Dynamics {
time 2/4 s2
time 3/4 s2.
time 4/4 s1
}
new Staff relative c' {
key es major
clef treble
<< { g'8[-3^markup { italic "sempre legato" } a b] s }
{ es,[-3pp f g <b, d>] } >>
<< { es[-2 f-1 g a <g-1 b-4> <as-2 c-5>] }
{ c,[-4 d es f] s s } >>
<< { s es[-2 f g-1 a b c d]-5 }
{ <b,-5 d>[ c d es f g-3 a b] } >>
}
>>
layout {
context {
Score
override SpacingSpanner.base-shortest-duration = #(ly:make-moment 1/32)
}
context {
Dynamics
consists "Time_signature_engraver"
override TimeSignature.style = #'single-digit
override TimeSignature.break-align-symbol = ##f
override TimeSignature.X-offset = #ly :self-alignment-interface::x-aligned-on-self
override TimeSignature.self-alignment-X = #CENTER
override TimeSignature.after-line-breaking = #shift -right-at-line-begin
}
context {
Staff
remove "Time_signature_engraver"
}
}
}
The above should render as:
If you only want to change one single Dynamics context, you can also use
[...]
new Dynamics with {
consists "Time_signature_engraver"
override TimeSignature.style = #'single-digit
override TimeSignature.break-align-symbol = ##f
override TimeSignature.X-offset = #ly:self-alignment-interface::x-aligned-on-self
override TimeSignature.self-alignment-X = #CENTER
override TimeSignature.after-line-breaking = #shift-right-at-line-begin
} {
time 2/4 s2
time 3/4 s2.
time 4/4 s1
}
[...]
And delete the stuff from layout.
Terms of Use Privacy policy Contact About Cancellation policy © freshhoot.com2026 All Rights reserved.