Hi list,

I am working on a little piece that's played as written;
after that, the musician has to turn the page upside down and play the
resulting notes.

I managed to get the clef displayed at the beginning and the end of each line, and I can flip the clef ;-)

Unfortunately, overriding the Clef.stencil at the end of the line changes the apperance for the clef in the next line, too.

---

\version "2.19.0"

#(define-markup-command (flip layout props arg)
(markup?)
   (interpret-markup layout props
     (markup #:concat (#:null #:scale (cons -1 -1) #:line (arg)))))

global = {
  \repeat unfold 4 {
    s1 * 4 |
    \once\override Staff.BarLine.allow-span-bar = ##t
    \once\override Staff.Clef.stencil = #(lambda (grob)
(grob-interpret-markup grob #{ \markup\flip\musicglyph #"clefs.G" #}))
    \break
    }
}

melody = {
  \repeat unfold 16 { c'4 4 4 4 }
}

\layout {
  \context {
    \Staff
    explicitKeySignatureVisibility = ##(#t #f #t)
    explicitClefVisibility = ##(#t #f #t)

    \override Clef.break-visibility = ##(#t #f #t)
    \override KeySignature.break-visibility = ##(#t #f #t)
  }
}

\score {
  \new Staff << \global \melody >>
}

---


Is there an easy way to detect whether the clef is actually at the end of a line, so that I can write (in pseudo-code)

if (at-end-of-line)
   rotate the clef
else
   print the clef
fi

Thanks in advance,


Marc
\version "2.19.0"

#(define-markup-command (flip layout props arg)
(markup?) 
   (interpret-markup layout props
     (markup #:concat (#:null #:scale (cons -1 -1) #:line (arg)))))

global = {
  \repeat unfold 4 { 
    s1 * 4 |
    \once\override Staff.BarLine.allow-span-bar = ##t
    \once\override Staff.Clef.stencil = #(lambda (grob) 
          (grob-interpret-markup grob #{ \markup\flip\musicglyph #"clefs.G" #}))
    \break
    }
}

melody = { 
  \repeat unfold 16 { c'4 4 4 4 }
}

\layout {
  \context {
    \Staff
    explicitKeySignatureVisibility = ##(#t #f #t)
    explicitClefVisibility = ##(#t #f #t)
    
    \override Clef.break-visibility = ##(#t #f #t)
    \override KeySignature.break-visibility = ##(#t #f #t)
  }
}

\score {
  \new Staff << \global \melody >>
}
  


_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to