Initial clef change: Difference between revisions

Import snippet from LSR
 
No edit summary
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
Implements initial clef changes using a custom engraves. This engraves will upon encountering a difference between initial clef (as given by <code>\with { \clef ... }</code> and the clef at first timestep. If any difference is encountered a now clef (spaced like a cue clef) is created, while the original clef and any key signatures are modified to look like the initial clef values.
Implements initial clef changes using a custom engraver. This engraves will upon encountering a difference between initial clef (as given by <code>\with { \clef ... }</code> and the clef at first timestep. If any difference is encountered a now clef (spaced like a cue clef) is created, while the original clef and any key signatures are modified to look like the initial clef values.


<lilypond version="2.24.0">
<lilypond version="2.24.0">
Line 181: Line 181:
     \clef bass
     \clef bass
     c'1
     c'1
  }
}
% Basic usage:
\score {
  <<
    % Just the treble clef
    \new Staff {
      \key bes \major
      c''1
    }
     
    % Just the bass clef
    \new Staff \with { \clef bass  } {
      \key bes \major
      c1
    }
   
    % Initial treble clef, then bass clef
    \new Staff {
      \key bes \major
      \clef bass
      c1
    }
   
    % Initial bass clef, then treble clef
    \new Staff \with { \clef bass  } {
      \key bes \major
      \clef treble
      c''1
    }
  >>
  \layout {
    \context {
      \Staff
      \consists #initial-clef-change-engraver
    }
   }
   }
}
}
</lilypond>
</lilypond>