lilypond-user
[Top][All Lists]
Advanced

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

Accessing grobs generated by a music event?


From: Stefano Troncaro
Subject: Accessing grobs generated by a music event?
Date: Tue, 13 Mar 2018 04:37:24 -0300

Hello everyone,

I was wondering, is there a way to, given a 'NoteEvent (or 'EventChord, or whatever other music _expression_ for that matter) find the grob or grobs that it generates?

Although I don't know how Lilypond actually processes input, I suspect that this isn't possible. I imagine that if a function is getting passed the events then they have not been translated into grobs yet, and if they have then I imagine that functions in the input have already been processed at this point. But I don't really know, so I'd rather ask.

So, more concretely, say that in the following:

\relative c' {
  c d \something e f
}

Is it possible for `\something`, a music function that is receiving the note e as its argument (of type `ly:music?`), to get to the grob generated by that e and store a reference to it in a variable?

So, something among the lines of

something =
#(define-music-function (e-note) (ly:music?)
   (let ((e-notehead-grob (???magic-proc??? e-note)))
     (display e-notehead-grob)
     e-note))

I am curious as to whether this has a solution or not.

Thank you in advance!
Stéfano

reply via email to

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