Home
Random
Log in
Settings
About LilyPond wiki
LilyPond wiki
Search
Editing
Clef change at the beginning of a piece
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
When changing the clef at the beginning of the first measure, Lilypond just changes the clef for the staff. This is how to keep the staff clef and add an extra clef after the time signature and before the first note. <lilypond version="2.24.0"> %% http://lsr.di.unimi.it/LSR/Item?id=792 %% see also http://lilypond.org/doc/stable/Documentation/notation/displaying-pitches % 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))) } bassToTreble = { \clef treble % Fake staff clef appearance \once \override Staff.Clef.glyph-name = #"clefs.F" \once \override Staff.Clef.Y-offset = #1 % Make sure any key signatures will printed with respect to % correct middle c position expected for bass clef \once \set Staff.middleCClefPosition = 6 % Append change clef to the time signature \once \override Staff.TimeSignature.text = \markup { \hspace #1.2 \lower #1 \musicglyph "clefs.G_change" } \once \override Staff.TimeSignature.stencil = #(lambda (grob) (append-markup grob (ly:time-signature::print grob))) } \relative c { \trebleToBass \key f \major c4 d e f % This should not be visible \clef bass g a b c % This should be visible \clef treble d e f g } </lilypond> [[Category:Staff notation]] [[Category:Staff notation]] [[Category:Pitches]] [[Category:Tweaks and overrides]]
Summary:
Please note that all contributions to LilyPond wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Meta:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)