[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Break visibility for notes?
From: |
Thomas Morley |
Subject: |
Re: Break visibility for notes? |
Date: |
Thu, 23 Apr 2020 21:42:51 +0200 |
Am Do., 23. Apr. 2020 um 21:02 Uhr schrieb Fr. Samuel Springuel
<address@hidden>:
>
> > On 22 Apr, 2020, at 4:34 PM, Fr. Samuel Springuel <address@hidden> wrote:
> >
> > Is there a way to specify that a note should only appear if it’s the first
> > note on the line? I tried using the break-visibility property but this
> > doesn’t seem to be working (the notes simply disappear entirely.
> >
> > \version "2.19.84"
> >
> > mystart = \override Voice.NoteHead.break-visibility = #begin-of-line-visible
> >
> > myend = \revert Voice.NoteHead.break-visibility
> >
> > music = { \repeat unfold 20 { c' } \mystart g' g' g' g' g' g' g' g' \myend
> > \repeat unfold 20 { c' } }
> >
> > \new Staff {
> > \new Voice = "mel" { \music }
> > }
> >
>
> So, I figured out a way to do this using the Custos_engraver. My slightly
> more than MWE is attached below. Comments on this strategy are welcome.
>
> ✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝
> Fr. Samuel, OSB
> (R. Padraic Springuel)
> St. Anselm’s Abbey
> 4501 South Dakota Ave, NE
> Washington, DC, 20017
> 202-269-2300
> (c) 202-853-7036
>
> PAX ☧ ΧΡΙΣΤΟΣ
Using Custos for it sounds very strange.
How about below? Coded after ideas by David Nalesnik, for now, only
setting colors.
#(define (line-position grob)
(let* ((col (ly:item-get-column grob))
(ln (ly:grob-object col 'left-neighbor))
(rn (ly:grob-object col 'right-neighbor))
(col-to-check-left (if (ly:grob? ln) ln col))
(col-to-check-right (if (ly:grob? rn) rn col))
(break-dir-left
(and
(ly:grob-property col-to-check-left 'non-musical #f)
(ly:item-break-dir col-to-check-left)))
(break-dir-right
(and
(ly:grob-property col-to-check-right 'non-musical #f)
(ly:item-break-dir col-to-check-right))))
(cond ((eqv? 1 break-dir-left) 'start)
((eqv? -1 break-dir-right) 'end)
(else 'middle))))
tstWithColor =
\override NoteHead.color =
#(lambda (grob)
(case (line-position grob)
((end) red)
((start) cyan)
((middle) green)))
{
\tstWithColor
\repeat unfold 20 { c' }
g' g' g' g' g' g' g' g'
\repeat unfold 20 { c' }
}
Cheers,
Harm