graphics files as marks

If you're generating scores with Lilypond you can add arbitrary Lilypond code to an event via add-mark and related methods. This is useful for all kinds of situations but especially when it comes to adding or modifying marks in a score.

Sometimes no existing mark expresses what you need so the best thing to do is create your own graphics file and attach that as a mark, using Lilypond code via a text mark.* An example follows:

(let* ((mini
        :ensemble '(((fl (flute :midi-channel 1))))
        :set-palette '((1 ((c4 d4 e4 f4 g4 a4 b4 c5))))
        :set-map '((1 (1)))
        :rthm-seq-palette '((1 ((((4 4) h. (q))
                                 ((q) h.)
                                 ((e) e (q) - e e e e -))
                                :pitch-seq-palette ((1 2 3 4 5 6 7)))))
        :rthm-seq-map '((1 ((fl (1))))))))
   mini 1 1 'fl
   '(text "^\\markup {\\general-align #Y #DOWN  ~
           {\\epsfile #X #1.5 #\"blah.eps\"} }"))
  (lp-display mini))

In order for this to work, the graphics file blah.eps will of course need to be in a place Lilypond can find it, e.g. in the same directory as the files generated by lp-display.

* Several such graphics files are already available as mark extensions to Lilypond. If you want to see how those new marks are created and linked to the graphics files, see the slippery chicken source code file