\version "2.13.11" %%%% Helper functions, which simply print out the observed rest/note events %%%% in a nice format: #(define (format-rest engraver event) (let* ((context (ly:translator-context engraver)) (moment (ly:context-current-moment context)) (duration (ly:event-property event 'duration))) ; TODO: Format the duration and the moment (ly:message "REST event of duration ~a at ~a\n" duration moment) ; or dump the whole event to see what information is available: ; (ly:message "REST event at ~a: ~a\n" moment event) ) ) #(define (format-note engraver event) (let* ((context (ly:translator-context engraver)) (moment (ly:context-current-moment context)) (duration (ly:event-property event 'duration)) (pitch (ly:event-property event 'pitch))) ; TODO: Format the duration, pitch and the moment (ly:message "NOTE event of duration ~a, pitch ~a at ~a\n" duration pitch moment) ; or dump the whole event to see what information is available: ; (ly:message "NOTE event at ~a: ~a\n" moment event) ) ) %%%% The actual engraver definition: We just install some listeners so we %%%% are notified about all notes and rests. We don't create any grobs or %%%% change any settings. \layout { \context { % I add this to the score, so all voices are caught. You can also only add % the engraver to selected voices to get the statistics split down. \Score \consists #(list (cons 'listeners (list (cons 'rest-event format-rest) (cons 'note-event format-note) )) ) } } \relative c' { c8[ r c] }