In piano music, you may occasionally come across a staff in which a held (pedal) note is followed by a clef change and further polyphonic notation.
With a little bit of work involving clef settings, you can overcome this problematic situation.
In the first figure, we can see that a clef change in one voice messes with the pedal note in a lower voice; the tie appears to have changed voices.
You can create a
fake treble clef which has the properties of a bass clef by overriding the following properties:
\set Staff.clefGlyph = #"clefs.G" - show a G clef
\set Staff.clefPosition = #-2 - set the staff position two half spaces below centre line (i.e. on G)
\set Staff.middleCPosition = #6 - set middle C to the same position as a bass clef
The second figure shows the solution as applied to the final bar of a Wolf lied. The pedal note E flat is followed by a treble clef and a high octave E flat. Since we are effectively still in the bass clef, we have to input the octave E flat as an octave G to produce the required output. Using
\tag splits the musical layout and MIDI so you can use
\keepWithTag #'midi in a MIDI
The third figure shows a more extended example from Debussy's L'Isle joyeuse in which the bass clef is faked.
Finally, the fourth figure shows the same Debussy excerpt with an additional feature you may encounter: the pedal note is preceded by a small cautionary clef printed after the barline.