Hi Erik,
On Tue, Oct 14, 2014 at 1:28 PM, erik flister <[email protected]>
wrote:
> thanks a lot david, i learned a lot from studying this!
>
>
Glad to hear it!
> looks like there would be two options to get lilypond to report pitch info:
>
> \void \displayLilyMusic % types absolute pitches to console
> \include "event-listener.ly" % writes file w/midi numbers
>
> but your example inspired me to figure it out in scheme, see attached. i
> would think auto-fingering-diagrams would be of general interest -- is it
> worth submitting either to the snippet library or the core scm library?
>
I think this would be a great idea.
> some questions:
> - how could i pass an argument to the engraver (like 'recorder, to tell it
> what diagrams to use)?
>
Add a parameter to the engraver:
autoFingerEngraver=
#(lambda (instrument)
(lambda (context)
(make-engraver
(acknowledgers
((note-column-interface trans grob source)
(let* ((cause (event-cause grob))
(p (get-fingering (ly:pitch-semitones
(ly:event-property cause 'pitch)))))
(if (not (null? p))
(ly:grob-set-property! (ly:engraver-make-grob trans
'TextScript cause) 'text
#{ \markup \woodwind-diagram #instrument #p #}))))))))
Then you would call it later like this:
\consists #(autoFingerEngraver 'recorder)
- i can't find doc on make-engraver -- are there any?
>
No, unfortunately not. You can find some material on C++ engravers in the
Contributor's Guide, but nothing on Scheme engravers. There are a few in
the LSR, and they surface from time to time on the lists.
> - this method ignored the layout overrides i need (that worked on manually
> entered markups):
> TextScript.staff-padding
> TextScript.self-alignment-X
> how do i get them back?
>
Unfortunately, I'm not going to be able to help at the moment. Your
recorder diagrams are still in review, and I find it very difficult to work
with your file in LilyDev. I'll be happy to take another look when your
patch is part of a release.
> - i like your 'display-fingering property, but i removed it for simplicity
> while trying to learn, i'll add it back...
>
> i also found
> http://www.lilypond.org/doc/v2.17/Documentation/learning/advanced-tweaks-with-scheme,
> which seems like it should also work and is simpler than defining a new
> engraver.
>
I used a Scheme engraver because it gives easy access to context
properties, and it's straightforward to create new grobs.
Possibly you could do this through a music function. See the thread on
"Handling automatic ottavas" for an example of something similar.
I have to say that, given a choice, I'd rather use an engraver given the
complexity of fiddling around with music lists. :)
> however, i can't figure out how to find the right object/property to give
> a note/column a markup. NoteHead.text doesn't do anything. where do i
> look this up?
>
Well, you could override NoteColumn.stencil. Here's a short example:
\version "2.19.15"
#(define (notehead-stencil grob)
(ly:stencil-aligned-to
(ly:stencil-translate-axis
(grob-interpret-markup grob #{ \markup "foo" #})
3 Y)
X CENTER))
{
\override NoteColumn.stencil = #notehead-stencil
<c'' e''> <c' e'> <c''' e'''>
}
The example shows the big limitation here, which is that no notice at all
is taken of collisions.
I'll take a better look later, but I hope this is helpful.
--David
_______________________________________________
lilypond-user mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-user