Using non-standard clef positions and adding customized clef definitions
LilyPond supports a number of pre-defined clefs, all of which show the clef symbol on some staff line. If you need the clef symbol between two lines, say, you can either manually set Staff.clefGlyph, Staff.clefPosition, and Staff.middleCPosition to the appropriate values, or you can add your own clef definition so that you can use \clef myCustomClef, for example. This can be achieved by using the add-new-clef function, which has the following form.
(add-new-clef clef-name clef-glyph clef-position octavation c0-position)
The parameters are as follows.
clef-name is a string naming the new clef, for example "myCustomClef".
clef-glyph is a string naming the clef glyph to display, for example "clefs.g" for the treble clef, "clefs.neomensural.c" for the neomensural c glyph, etc.
clef-position determines the position of the clef, counted from the center line of the staff. For example, a value of 1 means the clef is shown between the center line and the line above, 4 means the clef is shown on the top line, -2 means it is shown on the second line of the staff.
octavation describes the octave transposition, which is typically 0.
c0-position determines the position of middle C on the staff relative to clef-position. For example, a value of -2 means middle C will be two staff positions (lines or spaces) below clef-position.
\version "2.24"
myclef = {
\set Staff.clefGlyph = #"clefs.neomensural.c"
\set Staff.clefPosition = #1
\set Staff.middleCPosition = #1
}
#(add-new-clef "myCustomClef" "clefs.neomensural.c" 1 0 0)
<<
\context Staff = "Manual" \with {
instrumentName = "Manual settings"
} {
\myclef
\relative c' { c4 c c c }
}
\context Staff = "ClefDef" \with {
instrumentName = "Clef definition"
} {
\clef myCustomClef
\relative c' { c4 c c c }
}
>>