Hi Knut, very interesting project (which should be included in my plan for an additional "interesting uses" page on lilypond.org). Some comments (but explicitly without any warranty):
Am 07.07.2017 um 09:55 schrieb Knut Petersen: > Hi everybody! > > I extended my video generation script to allow coloring notes as they > are played. > Currently that works for noteheads and rests, see this example I > uploaded to youtube <https://www.youtube.com/watch?v=Z6MtIydbe-I>. > > Question 1: I use an after-line-breaking override for NoteHead, Rest > and MultiMeasureRest > events to encode the moment and the duration in the color fields of > the notehead > grobs, translate to postscript and postprocess the postscript files to > tell ghostscript > to generate images for every moment that has one of those events. Does > anybody > know a less hackish way to generate multiple copies of the systems of > a score > with changes to only the color of some grobs? What about generating the score as SVG and coloring the objects with CSS ? you could store a consecutive *index* in the grobs (rather than actual moments) and create a list with all moments when the coloring should change. In a post-processing step you could iterate over the list, color the elements with the corresponding index and produce an image from that. In a second post-processing step you could iterate over the list to compile the generated images according to the moments in the list. > > Question 2: I also would like to change the color of the stems, flags > and dots that > belong to a notehead, but those have no 'duration. Does anybody have > an idea > how to give a certain color to those grobs from inside the code called > by the > notehead after-line-breaking override? If nh is the name of your grob in the callback then (ly:grob-object nh 'stem) will give you the stem. AFAIK the Flag etc. are not all accessible this way but you can do (in a (let)): (nc (ly:item-get-column nh)) ; get the note column for the note head (elements (ly:grob-array->list (ly:grob-object nc 'elements))) which gives you a list of all items in the note column to iterate over. HTH Urs > > Knut > > > _______________________________________________ > lilypond-devel mailing list > lilypond-devel@gnu.org > https://lists.gnu.org/mailman/listinfo/lilypond-devel -- u...@openlilylib.org https://openlilylib.org http://lilypondblog.org _______________________________________________ lilypond-devel mailing list lilypond-devel@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-devel