> I have now spent ~25 minutes trying to strip down the engraver and adding what > you had in your first mail, but I can't reproduce anything. The music-cause > simply does not have any articulations here. > So, I now wasted almost half an hour for what?
Oh shoot, I confused my example scores. I just noticed that the articulations key (and the music-cause) only appears in the event list when there are simultaneous notes. This invalidates the approach (or rather "workaround"); anyway, I have attached a simple working example (articulations.ly) that generates the output I presented in my first email. I'm afraid it is not worth spending time on this anymore, now that the inadequacy of this procedure is established. I'm very sorry to have wasted your time. Your comments actually helped me to see how flawed my approach really is. Thank you for that. > As I said above, I can't reproduce your claim that the music-cause has the > articulations, so probably I did something different from what you had in mind > (but didn't include it in your list). Please adjust the file to show your > problem (and only your problem). In the future, this is the form that we would > expect from you. > So, if you really want us to spend precious time helping you, please make our > life easier by sending really small, relevant examples. Noted and understood. Thanks for your patience. I think I will have to start from scratch (again). This is what I'm trying to do for each note in the score: 1. get the string number (string-number-interface) 2. get the finger info (finger-interface) 3. get the stem direction (stem-interface) 4. replace the note head dependent on 1-3 (note-head-interface) I tried to add acknowledgers for all these interfaces, but the function for the note-head-interface was always called *before* the others (see attached example ack-order.ly). Is there a way to change that order, or call the note-head-interface function again at the very end for processing a grob? I'm sure I'm missing something obvious here. (My ignorance even after reading the documentation for multiple times annoys me so much.)
#(define-public (music-cause grob) (let* ((event (event-cause grob))) (if (ly:stream-event? event) (ly:event-property event 'music-cause) #f))) #(define stick-tab-engraver (list (cons 'acknowledgers (list (cons 'note-head-interface (lambda (engraver grob source-engraver) (let* ((context (ly:translator-context engraver)) (event (event-cause grob)) (mus (music-cause grob)) ;; get music object inside articulations ;; TODO: how do I get to the music-cause property in the Stream_event? (articulations (ly:music-property mus 'articulations))) ;; output articulations, so I can see how to ;; get to the music object inside. (display articulations)(newline) ;; replace the note head (do-something grob)))))))) #(define (do-something grob) (display "Not important\n")) % -------------------------------------------------- \version "2.14.2" \score { << \time 2/4 \new Staff { \clef "treble" \key g \minor \new Voice { \relative c'' { d4-1\4 } } } \new Staff { \clef "bass" \key g \minor \new Voice { \relative g { % ugh, articulations only exist when % there are simultaneous notes <d-2\4 g-4> } } } >> \layout { \context { \Staff \remove "Fingering_engraver" \consists \stick-tab-engraver } } }
#(define stick-tab-engraver (list (cons 'acknowledgers (list (cons 'string-number-interface (lambda (engraver grob source-engraver) ;; TODO: get string-number info and store in var (display "getting STRING info\n") )) (cons 'finger-interface (lambda (engraver grob source-engraver) ;; TODO: get fingering info and store in var (display "getting FINGER info\n") )) (cons 'stem-interface (lambda (engraver grob source-engraver) ;; TODO: get stem direction info and store in var (display "getting STEM info\n") )) (cons 'note-head-interface (lambda (engraver grob source-engraver) ;; TODO: replace the note head (do-something grob))))))) #(define (do-something grob) (display "Replacing note head\n")) % -------------------------------------------------- \version "2.14.2" \score { << \time 2/4 \new Staff { \clef "treble" \key g \minor \new Voice { \relative c'' { d4-1\4 } } } \new Staff { \clef "bass" \key g \minor \new Voice { \relative g { % ugh, articulations only exist when % there are simultaneous notes d-2\10 } } } >> \layout { \context { \Staff \remove "Fingering_engraver" \consists \stick-tab-engraver } } }
_______________________________________________ lilypond-devel mailing list lilypond-devel@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-devel