> On 14 Apr, 2020, at 3:02 PM, Aaron Hill <lilyp...@hillvisions.com> wrote: > > On 2020-04-14 9:14 am, Benjamin Bloomfield wrote: >> However, I am still trying to figure out how engravers and contexts work to >> be able to know exactly what's going on. >> Thanks for any help or ideas, > > Here is my take that works from events not grobs, plus it allows flexibility > in what you want to do between words: > > %%%% > \version "2.20.0" > > modifyContextPropertyWhereDefined = > #(define-scheme-function > (prop value-or-proc) (symbol? scheme?) > (lambda (context) > (ly:context-set-property! > (ly:context-property-where-defined context prop) > prop > (if (procedure? value-or-proc) > (value-or-proc (ly:context-property context prop)) > value-or-proc)))) > > incrementBarNumber = > \modifyContextPropertyWhereDefined > internalBarNumber #1+ > > insertBar = > \modifyContextPropertyWhereDefined > whichBar \etc > > betweenLyrics = #(define-scheme-function > (proc) (procedure?) > (lambda (context) > (let ((first-lyric? #t) (hyphen? #f)) > (make-engraver > (listeners > ((hyphen-event engraver event) (set! hyphen? #t)) > ((lyric-event engraver event) > (if first-lyric? > (set! first-lyric? #f) > (if (not hyphen?) (proc context))) > (set! hyphen? #f))))))) > > doBoth = #(define-scheme-function > (proc1 proc2) (procedure? procedure?) > (lambda args (apply proc1 args) (apply proc2 args))) > > repetitions = #3 > notes = \repeat unfold \repetitions { > fis'4 4 4 4 4 4 4( 4) 4( 4 4) 4 4 } > words = \repeat unfold \repetitions \lyricmode { > a b -- b c -- c -- c d e -- e f } > > << \new Staff { \cadenzaOn \new Voice = melody \notes } > \new Lyrics \with { > \consists \betweenLyrics \incrementBarNumber > } \lyricsto melody \words >> > > << \new Staff { \cadenzaOn \new Voice = melody \notes } > \new Lyrics \with { > \consists \betweenLyrics \insertBar "'" > } \lyricsto melody \words >> > > << \new Staff { \cadenzaOn \new Voice = melody \notes } > \new Lyrics \with { > \consists \betweenLyrics \doBoth \insertBar "" \incrementBarNumber > } \lyricsto melody \words >> > %%%% > > > -- Aaron Hill<reset-accidentals.cropped.png>
This look useful for me too, but I’m running into some difficulty when trying to insert regular bars. It seems the bar inserted by the betweenLyrics engraver is always used between words, even if the music specifies a different bar. Is there some way to adapt around that so that explicitly \bar commands take precedence?
auto-empty-bar-between-words.ly
Description: Binary data
✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝ Fr. Samuel, OSB (R. Padraic Springuel) St. Anselm’s Abbey 4501 South Dakota Ave, NE Washington, DC, 20017 202-269-2300 (c) 202-853-7036 PAX ☧ ΧΡΙΣΤΟΣ