1

Let’s say I’ve got two lines of music and words, represented here by bullets:

  \lyricmode {
    doe ray songs i whooosh
    there’s two lines you say
  }
   •   •    •   •    •
  doe ray songs i whooosh

   •     •    •    •   •
there’s two lines you say

As far as I can tell (and as illustrated above), LilyPond automatically aligns the center of LyricText with the center of NoteHead. (Or something close to that.)

The Question:

Without having to know where line breaks occur, is there a way to automatically apply a change to the first syllable of the line? The change in this case is alignment, but I would be curious if it can be adapted for other changes.

What I Don’t Want:

Explicitly overriding the alignment with \once \override LyricText.self-alignment-X = #LEFT:

  left_here = \once \override LyricText.self-alignment-X = #LEFT
  \lyricmode {
    \left_here doe ray songs i whooosh
    \left_here there’s two lines you say
  }
   •    •    •   •    •              
   doe ray songs i whooosh     ┌─────────────────────┐
                               │ THIS WORKS FINE ... │
   •        •    •    •   •    └─────────────────────┘
   there’s two lines you say

-----

   •    •    •   
   doe ray songs             ┌───────────────────────┐
                             │ ... UNTIL THE LINE    │
   •    •    •               │ BREAKS ARE DIFFERENT. │
   i whooosh there’s         └───────────────────────┘

   •    •    •   •
  two lines you say

What I Do Want:

  ┌─────────────────────────┐
  │  INSERT PROBABLY SOME   │
  │ MAGICAL SCHEME FUNCTION │
  └─────────────────────────┘
  \lyricmode {
    doe ray songs i whooosh
    there’s two lines you say
  }
   •    •    •   •    •       ┌─────────────────────────┐
   doe ray songs i whooosh    │ LEFT-ALIGNED LYRICS,    │
                              │ AUTOMATICALLY APPLIED   │
   •        •    •    •   •   │ AT THE BEGINNING OF THE │
   there’s two lines you say  │ LINE!                   │
                              └─────────────────────────┘
-----

   •    •    •   
   doe ray songs             ┌───────┐
                             │ SAME! │
   •    •       •            └───────┘
   i whooosh there’s         

   •     •    •   •
   two lines you say

1 Answer 1

2

Maybe something this would work:

#(define (shift-first-syllable grob)
   (if (end-broken-spanner? grob)
       (begin
        (ly:grob-translate-axis!
         (ly:spanner-bound grob RIGHT)
         (- (ly:grob-property (ly:spanner-bound grob RIGHT) 'X-offset))
         X))))

{
  1 1 1 1 1 1 1
  \repeat unfold 64 c'8
} \addlyrics {
  \override LyricSpace.after-line-breaking = #shift-first-syllable 
  \override LyricHyphen.after-line-breaking = #shift-first-syllable 
  \override LyricExtender.after-line-breaking = #shift-first-syllable 
  
  aaaaa bbbbb \break ccccc ddddd -- \break eeeee -- fffff __ \break _
  \repeat unfold 64 xxx --
}

This might cause collisions with tight spacing. Generally Lilypond requires to work out Lyrics spacing to be able to determine line breaking in the first place.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.