lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Scheme Help


From: Benjamin Bloomfield
Subject: Re: Scheme Help
Date: Mon, 13 Nov 2017 10:51:22 -0500

Thanks, this looks very helpful.  Yes, I want any note at line-begin to be visible, but if the note is a breve and not at line-begin I want to check whether there is a breath mark immediately before it, or whether the note immediately before it is not a breve, in which case the current breve needs to be visible.

I think this may be enough for me to go on though.

Thanks very much,

Benjamin Bloomfield

On Sun, Nov 12, 2017 at 2:37 PM, Thomas Morley <address@hidden> wrote:
2017-11-11 17:11 GMT+01:00 Benjamin Bloomfield <address@hidden>:
> I am trying to write a scheme to achieve the functionality I was asking
> about in my earlier message.  I think that I could do it with a simple
> callback function on the NoteHead.transparent property and make the notehead
> transparent if it is a breve that is preceded by another breve and not the
> first note in its system.
>
> It's easy enough to determine whether the NoteHead is a breve in scheme, but
> how do I determine whether it's the first of its system, and how do I
> reference the NoteHead that comes immediately before it (if any) to
> determine whether that is also a breve?
>
> Thanks!
>
> Benjamin Bloomfield

Wouldn't you want any note at line-begin to be visible? So why check
what's the preceding?

For the other stuff you may find some procedures helpful, which David
Nalesnik had coded:

%% Thanks to David Nalesnik
#(define (at-line-end? grob)
   (let* ((col (ly:item-get-column grob))
          (ln (ly:grob-object col 'right-neighbor))
          (col-to-check (if (ly:grob? ln) ln col)))
     (and (eq? #t (ly:grob-property col-to-check 'non-musical))
          (= -1 (ly:item-break-dir col-to-check)))))

#(define (at-line-beginning? grob)
   (let* ((col (ly:item-get-column grob))
          (ln (ly:grob-object col 'left-neighbor))
          (col-to-check (if (ly:grob? ln) ln col)))
     (and (eq? #t (ly:grob-property col-to-check 'non-musical))
          (= 1 (ly:item-break-dir col-to-check)))))


{
  \override NoteHead.after-line-breaking =
    #(lambda (grob)
      (ly:grob-set-property! grob 'color
        (cond ((at-line-end? grob) cyan)
              ((at-line-beginning? grob) red)
              (else '()))))
  \repeat unfold 150 c'1
}

HTH,
  Harm


reply via email to

[Prev in Thread] Current Thread [Next in Thread]