Hi Amy,

> On Jun 17, 2015, at 12:48 PM, Amelie Zapf <a...@ameliezapf.com> wrote:
> 
> OK. I need to define an engraver, that's a statement I can live with.
> However, is there any documentation or definition of the make-engraver
> function anywhere that is readable to the "informed layperson" that has
> been typesetting music with Lilypond ever since 1.6.6, but doesn't know
> all the internals of the program?

It’s not really documented beyond comments in the source code and some LSR 
examples.  Here’s a simple example of a custom engraver that uses the 
key-signature-interface to access and then log the tonic note as a number.

\version "2.19.20"

#(define My_engraver
   (make-engraver
    (acknowledgers
     ((key-signature-interface engraver grob source-engraver)
      (let*
       ((context (ly:translator-context engraver))
        (tonic-num (ly:pitch-notename (ly:context-property context 'tonic))))
       (display tonic-num)
       (newline)
       )))))

\new Staff \with {
  \consists \My_engraver
} {
  \key c \major
  c'1
  \key a \minor
  a'1
  \key g \major
  g'1
  \key f \major
  f'1
}

% logs: 0 5 4 3 ...


> I've gleaned from a few emails that the engraver then needs "listeners"
> and "acknowledgers" defined. If I understand correctly, I shouldn't need
> any listeners,

Yes, acknowledgers should do it.

> but the chord-name-interface as the acknowledger. Is that
> correct?

Sounds like you’re on the right track.  See David Kastrup’s message about 
(currently) needing the following to get the tonic context property into the 
ChordNames context:

\layout { \context { \ChordNames \alias Staff } }
\midi { \context { \ChordNames \alias Staff } }

> And then how do I go about stuffing the function that
> essentially redefines the chordRootNamer in there so
> chord-generic-names.scm will call it?

I’ll have to leave this "as an exercise to the reader” since I don’t know 
myself.

> I'm sorry I'm such a dunce, but with the amount of documentation
> supplied, make-engraver is extremely hard to grasp.

I’d say you’re doing pretty well.  As I understand it David Kastrup is working 
towards better integration of scheme engravers into LilyPond, granting them 
“full citizenship”.  Once that is finished maybe we can work to improve the 
documentation.

Cheers,
-Paul


_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to