Jump to content

Creating custom key signatures: Difference between revisions

From LilyPond wiki
mNo edit summary
mNo edit summary
Line 29: Line 29:
</lilypond>
</lilypond>


[[Category:Tweaks and overrides]]
[[Category:Contexts and engravers]]
[[Category:Pitches]]
[[Category:Pitches]]
[[Category:Staff notation]]
[[Category:Staff notation]]
[[Category:Contexts and engravers]]
[[Category:Tweaks and overrides]]
[[Category:Included in the official documentation]]
[[Category:Included in the official documentation]]
[[Category:Snippet]]
[[Category:Snippet]]

Revision as of 11:57, 5 December 2025

LilyPond supports custom key signatures. In this example, print for D minor with an extended range of shown flats.

\version "2.24"

\new Staff \with {
  \override StaffSymbol.line-count = #8
  \override KeySignature.flat-positions = #'((-7 . 6))
  \override KeyCancellation.flat-positions = #'((-7 . 6))
  % presumably sharps are also printed in both octaves
  \override KeySignature.sharp-positions = #'((-6 . 7))
  \override KeyCancellation.sharp-positions = #'((-6 . 7))

  \override Clef.stencil =
    #(lambda (grob)
        (grob-interpret-markup grob
           #{ \markup\combine
                \musicglyph "clefs.C"
                \translate #'(-3 . -2)
                  \musicglyph "clefs.F"
           #}))
    clefPosition = #3
    middleCPosition = #3
    middleCClefPosition = #3
}

{
  \key d\minor
  f bes, f bes,
}