Thank you very much for your help, Yoshi. I think I have achieved what I wanted, or at least some 95% of it. I'm annexing the file just cause; it is not a MWE but it is an example at least. [image: SplitAndConvergeStaffs.png]
Em seg., 30 de dez. de 2024 às 12:07, Yoshiaki Onishi <i...@yoshionishi.com> escreveu: > Dear Lucas, > > Glad I could help you! > > However, when I insert a bass clef on the lower bifurcated staff the notes >> are incorrectly assigned and the clef is off. > > > This happens because every time you set the clef in this circumstance, > because the new positioning of the staff line has been defined by the > following line: > > \override Staff.StaffSymbol.line-positions = #'(-9 -7 -5 -3 -1) > > > You have to configure the new placement of the clef as well as where the > middle C is located accordingly. > > Taking hints from the section: Selected Snippets - Tweaking clef > properties in the Documentation > https://lilypond.org/doc/v2.25/Documentation/notation/clef, you can > modify the code as follows (I am replying with the only the excerpt you > sent, with my modification): > > %% > \set Staff.middleCPosition = -11 > \once \override Staff.Clef.stencil = ##f > \startStaff > << > { > \clef bass % inserted bass clef for left hand/bass comping. > \set Staff.clefPosition = -3 > \set Staff.middleCPosition = 1 > \set Staff.middleCClefPosition = 1 > {\repeat unfold 4 {c1 d e f} } > } > \new Staff \with { > %% > > However, as you may well agree, if a clef changes in the middleway through > a system, you would need to have the new clef shown. You can make the clef > change appear by commenting or deleting the line: \once \override > Staff.Clef.stencil = ##f ...But merely doing so with this particular code > will place the clef **behind** the barline, turning the music with some > unsightly situation. In order to fix that, i.e. have the clef appear > **after** the barline, you need to override \override > Score.BreakAlignment.break-align-orders. See below: > > %% > \set Staff.middleCPosition = -11 > % \once \override Staff.Clef.stencil = ##f > \startStaff > << > \override Score.BreakAlignment.break-align-orders = > #(make-vector 3 '( > staff-bar > clef > )) > \clef bass > \set Staff.clefPosition = -3 > \set Staff.middleCPosition = 1 > \set Staff.middleCClefPosition = 1 > { \repeat unfold 4 {c1 d e f} } > > \new Staff \with { > %% > > For more discussion on "clef after barline", see the following thread: > https://lists.gnu.org/archive/html/lilypond-user/2012-02/msg00872.html > > All the best, > Yoshi > > > On Mon, Dec 30, 2024 at 7:40 AM Lucas Cavalcanti <lucaspi...@gmail.com> > wrote: > >> Thank you, Yoshi. I've managed to achieve what I sought (two staff >> bifurcated). However, when I insert a bass clef on the lower bifurcated >> staff the notes are incorrectly assigned and the clef is off. I've tried >> fixing this issue to the best of my ability (that is not much lmao) but to >> no avail. Do you know how to fix this? >> >> %% >> \set Staff.middleCPosition = -11 >> \once \override Staff.Clef.stencil = ##f >> \startStaff >> << >> { >> \clef bass % inserted bass clef for left hand/bass comping. >> {\repeat unfold 4 {c1 d e f} } >> } >> \new Staff \with { >> %% >> >> >> Em seg., 30 de dez. de 2024 às 01:40, Yoshiaki Onishi < >> i...@yoshionishi.com> escreveu: >> >>> P.S. After hitting “send,” it occurred to me that the code I sent would >>> not account music after a new system starts. The clef would appear >>> incorrectly placed. I amended the code as below, and in this version, I >>> tweaked the Scheme code setting so that the two clefs would not collide in >>> the new system. It makes the bifurcated staffs have more distance, which I >>> am very sure you can tweak as you like - - - Yoshi >>> >>> %%% CODE BEGINS %%% >>> \version "2.24.4" >>> >>> \new Staff = "main" { >>> c''1 d'' e'' f'' >>> >>> \stopStaff >>> \override Staff.StaffSymbol.line-positions = #'(-9 -7 -5 -3 -1) >>> \set Staff.clefPosition = -7 >>> \set Staff.middleCPosition = -11 >>> \once \override Staff.Clef.stencil = ##f >>> \startStaff >>> << >>> { \repeat unfold 4 {c''1 d'' e'' f''} } >>> >>> \new Staff \with { >>> \remove Time_signature_engraver >>> alignAboveContext = "main" >>> \magnifyStaff #2/3 >>> \override VerticalAxisGroup.default-staff-staff-spacing = >>> #'((basic-distance . 0) >>> (minimum-distance . 0) >>> (padding . 0) >>> (stretchability . 10)) >>> firstClef = ##f >>> } >>> { \repeat unfold 4 {c''2 c''2 d'' d'' e'' e'' f'' f'' }} >>> >> >>> } >>> %%% END %%% >>> >>
\version "2.25.20" %% SNIPPET %% %%Adding indicators to staves which get split after a break %%This snippet defines the: %\splitStaffBarLine, convUpStaffBarLine and convDownStaffBarLine commands. %These add arrows at a bar line, to denote that several voices sharing a staff will each continue on a staff of their own in the next system, or that voices split in this way recombine. #(define-markup-command (arrow-at-angle layout props angle-deg length fill) (number? number? boolean?) (let* ( (PI-OVER-180 (/ (atan 1 1) 34)) (degrees->radians (lambda (degrees) (* degrees PI-OVER-180))) (angle-rad (degrees->radians angle-deg)) (target-x (* length (cos angle-rad))) (target-y (* length (sin angle-rad)))) (interpret-markup layout props (markup #:translate (cons (/ target-x 2) (/ target-y 2)) #:rotate angle-deg #:translate (cons (/ length -2) 0) #:concat (#:draw-line (cons length 0) #:arrow-head X RIGHT fill))))) splitStaffBarLineMarkup = \markup \with-dimensions #'(0 . 0) #'(0 . 0) { \combine \arrow-at-angle #45 #(sqrt 8) ##t \arrow-at-angle #-45 #(sqrt 8) ##t } splitStaffBarLine = { \once \override Staff.BarLine.stencil = #(lambda (grob) (ly:stencil-combine-at-edge (ly:bar-line::print grob) X RIGHT (grob-interpret-markup grob splitStaffBarLineMarkup) 0)) %\break } convDownStaffBarLine = { \once \override Staff.BarLine.stencil = #(lambda (grob) (ly:stencil-combine-at-edge (ly:bar-line::print grob) X RIGHT (grob-interpret-markup grob #{ \markup\with-dimensions #'(0 . 0) #'(0 . 0) { \translate #'(0 . -.13)\arrow-at-angle #-30 #(sqrt 30) ##t }#}) 0)) %\break } convUpStaffBarLine = { \once \override Staff.BarLine.stencil = #(lambda (grob) (ly:stencil-combine-at-edge (ly:bar-line::print grob) X RIGHT (grob-interpret-markup grob #{ \markup\with-dimensions #'(0 . 0) #'(0 . 0) { \translate #'(0 . -3.70)\arrow-at-angle #30 #(sqrt 30) ##t }#}) 0)) %\break } %% switch = { \new Staff = "switch" \with { \RemoveAllEmptyStaves } { % switch staff code c''1 d'' e'' f'' \stopStaff \splitStaffBarLine s1 \override Staff.StaffSymbol.line-positions = #'(-11 -9 -7 -5 -3) \set Staff.clefPosition = -9 \set Staff.middleCPosition = -13 \startStaff << %% First let's create the lower staff (bass clef). \override Score.BreakAlignment.break-align-orders = #(make-vector 3 '( staff-bar clef )) \clef bass \set Staff.clefPosition = -5 \set Staff.middleCPosition = -1 \set Staff.middleCClefPosition = -1 { \repeat unfold 2 {c1 d e f} \break % breaking the line just to test the converging together. \once \override Staff.Clef.X-extent = #'(-1 . 0) %{ Had to use this Clef.-X because the clef was going inside the initial left wall of the bar.%} c1 d e f \stopStaff \convUpStaffBarLine s1} %% Now to create the second staff (in this case, upper staff). {\new Staff \with { \remove Time_signature_engraver alignAboveContext = "switch" \magnifyStaff #1 \override VerticalAxisGroup.default-staff-staff-spacing = #'((basic-distance . 3) (minimum-distance . 4) (padding . 0) (stretchability . 10)) %{firstClef = ##f%} } { % higher staff code \override Score.BreakAlignment.break-align-orders = #(make-vector 3 '( staff-bar clef )) \clef treble \set Staff.clefPosition = -1 \set Staff.middleCPosition = 1 \set Staff.middleCClefPosition = 1 { \repeat unfold 3 {c1 d e f} \stopStaff \convDownStaffBarLine s1} }} % end higher staff code & variable >> \revert Score.BreakAlignment.break-align-orders \revert Staff.StaffSymbol.line-positions \startStaff \clef treble \relative c'' {\time 5/8 {\repeat unfold 4 {c8 b a g a}}} \once \override Score.TimeSignature.break-visibility = #'#(#f #t #t) } % end Switch Staff } % end Switch variable MelodyInUnison = { \new Staff \with { \RemoveAllEmptyStaves } { % MelodyInUnison staff code \relative c'' {{\repeat unfold 2 {c1 d e f}}} } % end of MelodyInUnison Staff } % end of MelodyInUnison variable music = { \MelodyInUnison \break \switch \revert Score.BreakAlignment.break-align-orders \revert Staff.StaffSymbol.line-positions \break \time 4/4 \MelodyInUnison } % end music variable \score { \music }