I used to have a Lilypond template for engraving hymns, but I cannot find it again. Does anyone have such a thing? I *think* the one I had was made by Aristotle.
My template is here:https://github.com/magdalenesacredmusic/English-Hymns There are some additional files (containing variables) the template calls for, which should be on that page. I'm trying to post them all here too
tagIt = \once \override Lyrics.LyricText #'tagged = ##t
#(define (define-grob-property symbol type? description) (if (not (equal? (object-property symbol 'backend-doc) #f)) (ly:error (_ "symbol ~S redefined") symbol))
(set-object-property! symbol 'backend-type? type?) (set-object-property! symbol 'backend-doc description) symbol)
#(map (lambda (x) (apply define-grob-property x))
`( (tagged ,boolean? "is this grob marked?") (syllables ,array? "the lyric syllables at a timestep") ))
#(define (Lyric_text_align_engraver ctx) "If the property 'tagged is set, collect all lyric syllables at that timestep in the grob-array 'syllables" (let (; We will collect LyricText items here. (syl '())) (make-engraver (acknowledgers ((lyric-syllable-interface trans grob source) (set! syl (cons grob syl)))) ((stop-translation-timestep trans) ; This ensures that callbacks will have access to all of the LyricText grobs ; in a column though any of the LyricText grobs in that column. (if (any (lambda (x) (eq? #t (ly:grob-property x 'tagged))) syl) (for-each (lambda (x) (for-each (lambda (y) (ly:pointer-group-interface::add-grob x 'syllables y)) syl)) syl)) ; clear our cache of syllables in readiness for another group (set! syl '())))))
#(define (X-offset-callback grob) (let* (; This is the grob-array we created to hold targeted syllables. (target (ly:grob-object grob 'syllables)) ; Check is necessary because engraver has only created 'syllables ; grob-array in response to tag (target (if (ly:grob-array? target) (ly:grob-array->list target) '())) ; A procedure to determine the size of a text stencil: (length (lambda (item) (interval-length (ly:stencil-extent (grob-interpret-markup grob (ly:grob-property item 'text)) X))))) (if (pair? target) ; Do we have a 'syllables grob-array? (let ((longest (fold (lambda (elem prev) (if (> (length elem) (length prev)) elem prev)) (car target) target))) (if (eq? grob longest) ; If our grob has the longest syllable, return its default ; value for 'X-offset. (ly:self-alignment-interface::aligned-on-x-parent grob) ; Otherwise, give it the X-offset value of the longest syllable. (ly:grob-property longest 'X-offset)))
; If no grob-array, return the default function for 'X-offset (ly:self-alignment-interface::aligned-on-x-parent grob))))
My template is below. It will create a 4 part score and a cropped melody only score. I use frescobaldi, and render the melody scores as png files for use in Publisher for worship aids. There are additional files referenced in this template which I will post as additional comments below. You can see this all in practice at https://github.com/magdalenesacredmusic/English-Hymns
To participate in the discussions on Catholic church music, sign in or register as a forum member, The forum is a project of the Church Music Association of America.