Am Montag, 29. August 2011, 18:07:17 schrieb Marc Hohl:
> Hello list,
>
> I think I have asked a similar question long time ago, but I didn't
> find the answer.
>
> Currently, I am working on a little scheme engraver which should read the
> 'string-number, if given, and should do some calculations, depending on
> other articulations, like 'HarmonicEvent.
The articulations are a list, so you have to filter them to get the actual
string numbers.
Example attached,
Reinhold
--
------------------------------------------------------------------
Reinhold Kainhofer, [email protected], http://reinhold.kainhofer.com/
* Financial & Actuarial Math., Vienna Univ. of Technology, Austria
* http://www.fam.tuwien.ac.at/, DVR: 0005886
* LilyPond, Music typesetting, http://www.lilypond.org
\version "2.15.9"
#(define-public (test_engraver context)
(let ((string-pitch-list '()) ;; actually not used
(notes '()))
`((acknowledgers
(note-head-interface .
,(lambda (trans grob source)
(set! notes (cons grob notes)))))
(process-acknowledged
. ,(lambda (trans)
(for-each (lambda (note)
(let* ((event (event-cause note))
(pitch (ly:event-property event 'pitch))
(art (ly:event-property event 'articulations))
;; art is a LIST of events, so you have to filter out
;; all string-number events
(nrs (filter (lambda (s) (not (null? s)))
(map (lambda (a) (ly:event-property a 'string-number))
art)))
;;(type (ly:music-property art 'string-number)) <- this does not work
)
(display (extract-named-music art "ArticulationEvent"))
(display "The event: ")
;;(display event)
(display " has pitch: ")
;;(display pitch)
(display " and articulation: ")
(display art)
(display " and string numbers: ")
(display nrs)
(display " \n")
)
) ;; end lambda (note)
notes)))
(stop-translation-timestep
. ,(lambda (trans) (set! notes '()))))))
\layout {
\context {
\Voice
\consists \test_engraver
}
}
test = \relative c' {
% c4
<d\2-.> %e\2
% f g\4 a\4 b\4 < g\4\harmonic >
% c4\3 < d\3 g\2> c\3 r
}
%\displayMusic { \test }
\new Voice { \test }_______________________________________________
lilypond-user mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-user