4

Here is the desired engraving:

enter image description here

See how the tied D continues in the bass clef while the left-hand staff switches to the treble clef. Is it possible to engrave with LilyPond?

Here is a MWE I tried:

\version "2.24.2"
\language "italiano"

\score {
    \new Staff {
        \key re \minor
        \numericTimeSignature
        \time 3/4
        \clef bass
        \relative do' {
            <<
                {
                    s2. r4 r8. \clef treble
                    \tuplet 3/2 16 { sol'32 (la sib }
                    do8.) do16--
                    do16-- sib sol la
                    sol8. 
                    \omit TupletBracket
                    \tuplet 3/2 16 { fa32 (sol la }
                    sib8.) sib16
                } \\
                {
                    \stemUp re,,,8.-- re16-- re2--~ 2.~
                    \stemNeutral
                    2.~ 2.
                }
            >>
        }
    }
}

This is what it produces:

enter image description here

I also tried removing Clef_engraver from the staff context and adding it to the voice context. It didn't help.

2 Answers 2

3

You could try something like

\version "2.24.2"
\language "italiano"

\layout {
  \context {
    \Staff
    \accepts "PseudoStaff"
  }
  \context {
    \name "PseudoStaff"
    \type Engraver_group
    \alias "Staff"
    \consists "Clef_engraver"
    \clef "GG" % Anything odd, just to mask clef changes in superior staff
    \override Clef.font-size = #-3
  }
}
    

\score {
    \new Staff {
        \key re \minor
        \numericTimeSignature
        \time 3/4
        \clef bass
        \relative do' {
            <<
                {
                    s2. r4 r8. \clef treble
                    \tuplet 3/2 16 { sol'32 (la sib }
                    do8.) do16--
                    do16-- sib sol la
                    sol8. 
                    \omit TupletBracket
                    \tuplet 3/2 16 { fa32 (sol la }
                    sib8.) sib16
          } \\
        << \new PseudoStaff = "ps" { \once \omit Clef \skip 2.*4 }
                {
          \stemUp re,,,8.-- re16-- re2--~ 2.~
          \change Staff = "ps"
          \once \override Staff.Clef.Y-offset = #-3
          \clef "bass"
          \stemNeutral
          2.~ 2.
                }
         >>
            >>
        }
    }
}

with the respective context definition for \midi left as an exercise to the reader (since pitches are already entered at-pitch, you won't need much more than just the definitions for the \layout context hierarchy while using Performer_group instead of Engraver_group).

2
  • Thank you! I don't understand the code, and, thus, I don't understand how to fix the warnings when \midi is present. Your instructions on how to do it sound to me like Chinese.
    – facetus
    Oct 26, 2023 at 22:55
  • This solution doesn't work if there is a line break. A second clef appears at the beginning of the line.
    – facetus
    Oct 27, 2023 at 0:36
4

A look into the LilyPond Snippet Repository (LSR) usually helps – if you search for 'clef', the second hit is Combining pedal notes with clef changes, which might give an alternative solution:

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.