Hi,

is it possible to detect slurred notes in a callback function? I would like
to use a callback function to modify properties of all slurred notes.

Below is my unsuccessful attempt.
The callback function receives NoteHead grob as argument. The grob itself
doesn't seem to contain information about slur attached, so I get it's
event-cause. I know that slurs are stored in the NoteEvent's
"articulations" property, but this property either isn't accessible this
way (the object returned by event-cause doesn't seem to be a regular
NoteEvent; what is it actually?), or I fail to find the correct way to
access it.

---

#(define (in-slur? notehead)
   (begin
    (display "grob")
    (newline)
    (display-scheme-music notehead)
    (display "NoteEvent?")
    (newline)
    (display-scheme-music (event-cause notehead))
    (display "try to dig slur")
    (newline)
    (display-scheme-music (ly:event-property (event-cause notehead)
'articulations))
    #f))

\score {
  \relative c'' {
    \override NoteHead #'color = #(lambda (grob)
      (if (in-slur? grob)
          red
          blue))

    a a
    a( a)
    a( a a)
  }
}

---

Thanks for any help,
Jakub
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to