lilypond-user
[Top][All Lists]
Advanced

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

Detect slurred notes in callback function


From: Jakub Pavlík
Subject: Detect slurred notes in callback function
Date: Sun, 7 Feb 2016 14:30:44 +0100

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

reply via email to

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