This reply is for both David Wright, Thomas Morley and others who may be interested.

On 2024-11-09 20:58, David Wright wrote:
On Sat 09 Nov 2024 at 15:13:02 (-0800), Stu McKenzie wrote:
On 2024-11-09 14:21, Thomas Morley wrote:
Am Sa., 9. Nov. 2024 um 21:10 Uhr schrieb Stu McKenzie:

The second bar loses the '\skip 8'.
Nope. Use bar-checks ;)

Cheers,
    Harm

I must be missing something here!
The first bar of the 'eighthNotes' has durations: 8 x 8.
  TOTAL = 8 quavers or 4 crotchets (1 bar in 4/4 time).
The first bar of the 'words' has durations: 8 + 4 + 8 = 2 beats, 8 + 8
+ 8 + 8 = 2 beats
  TOTAL = 8 quavers or 4 crotchets (1 bar in 4/4 time).
Why does the lyrics bar 1 'words' result in "warning: barcheck failed
at 7/8"?
I've attached some code to append to your example. I don't know
what sort of music you're setting, but as you mentioned melismas,
I've added some slurs to show the effect they have.

Note how you need to set an associated voice, when using durations,
to get the "melismatic shift" in the lyric position.

When not using durations, both slurs and "_" lyrics will cause
this shift, as seen in the last two examples. Because I don't use
durations, I prefer "" rather than \skip, because \skip must be
followed by a duration, but that duration is meaningless and
could be misleading.

Cheers,
David.

I don't think that melisma or ties provide the answer.

As Thomas will see below, I don't normally use '\lyricsto' in my scores.

LilyPond recommends using "tiny examples" (https://lilypond.org/tiny-examples.html), and the many lilypond-user posts mention a Minimal Working Example (MWE).

I presumed (perhaps wrongly) that this applied to the User Group and bug reports.

In this case, for clarity and maybe assist others, I've included the complete source code and a screenshot of the output below.

I'm writing a drum score for a song called "Come Together" by "The Beatles".

Drums don't normally use ties. Each stroke generally has no sustain.

In parts of all of the verses, the drum rhythm is eighth notes on the drums, with the lyrics "toe- jam foot- ball, he got".

I wanted to underline the part that both the lead and backup vocalists sing together, that is "toe- jam foot- ball,".

The lead vocalist sings "he got" on his own.

Having tried numerous times to get this right with a tiny example/MWE, the code that gives exactly what I want is below.

I would like to thank everybody who replied to my original post, and subsequent follow-up posts.

LilyPond is such a wonderful tool for us musicians.

Here is the part of my score that I was trying to achieve in the first place.

Taking all comments into account and modifying as necessary, here's the resultant code (This includes code from the reply from Kieren MacMillan):

\version "2.24.0"

#(define (add-bound-item spanner item)
   (if (null? (ly:spanner-bound spanner LEFT))
       (ly:spanner-set-bound! spanner LEFT item)
       (ly:spanner-set-bound! spanner RIGHT item)))

#(define (axis-offset-symbol axis)
   (if (eq? axis X) 'X-offset 'Y-offset))

#(define (set-axis! grob axis)
   (if (not (number? (ly:grob-property grob 'side-axis)))
       (begin
         (set! (ly:grob-property grob 'side-axis) axis)
         (ly:grob-chain-callback
          grob
          (if (eq? axis X)
              ly:side-position-interface::x-aligned-side
              ly:side-position-interface::y-aligned-side)
          (axis-offset-symbol axis)))))

#(define (underline-engraver context)
   (let ((span '())
         (finished '())
         (current-event '())
         (event-drul '(() . ())))
     (list (cons 'listeners
                 (list (cons 'text-span-event
                             (lambda (engraver event)
                               (if (= START (ly:event-property event 'span-direction))
                                   (set-car! event-drul event)
                                   (set-cdr! event-drul event))))))
           (cons 'acknowledgers
                 (list (cons 'lyric-syllable-interface
                             (lambda (engraver grob source-engraver)
                               (if (ly:spanner? span)
                                   (begin
(ly:pointer-group-interface::add-grob span 'note-columns grob)
                                     (add-bound-item span grob)))
                               (if (ly:spanner? finished)
                                   (begin
(ly:pointer-group-interface::add-grob finished 'note-columns grob)
                                     (add-bound-item finished grob)))))))
           (cons 'process-music
                 (lambda (trans)
                   (if (ly:stream-event? (cdr event-drul))
                       (if (null? span)
                           (ly:warning "cannot find start of underline")
                           (begin (set! finished span)
                                  (ly:engraver-announce-end-grob trans finished current-event)
                                  (set! span '())
                                  (set! current-event '())
                                  (set-cdr! event-drul '()))))
                   (if (ly:stream-event? (car event-drul))
                       (begin (set! current-event (car event-drul))
                              (set! span (ly:engraver-make-grob trans 'TextSpanner current-event))
                              (set-axis! span Y)
                              (set-car! event-drul '())))))
           (cons 'stop-translation-timestep
                 (lambda (trans)
                   (if (and (ly:spanner? span)
                            (null? (ly:spanner-bound span LEFT)))
                       (set! (ly:spanner-bound span LEFT)
                             (ly:context-property context 'currentMusicalColumn)))
                   (if (ly:spanner? finished)
                       (begin
                         (if (null? (ly:spanner-bound finished RIGHT))
                             (set! (ly:spanner-bound finished RIGHT)
                                   (ly:context-property context 'currentMusicalColumn)))
                         (set! finished '())
                         (set! event-drul '(() . ()))))))
           (cons 'finalize
                 (lambda (trans)
                   (if (ly:spanner? finished)
                       (begin
                         (if (null? (ly:spanner-bound finished RIGHT))
                             (set! (ly:spanner-bound finished RIGHT)
                                   (ly:context-property context 'currentMusicalColumn)))
                         (set! finished '())))
                   (if (ly:spanner? span)
                       (begin
                         (ly:warning "unterminated underline")
                         (ly:grob-suicide! span)
                         (set! span '()))))))))

\layout {
  ragged-right = ##f
  indent = 0
  \context {
    \Lyrics
    \consists #underline-engraver
    \override TextSpanner.direction = #DOWN
    \override TextSpanner.style = #'line
    \override TextSpanner.outside-staff-priority = ##f
    \override TextSpanner.padding = #0.2 % sets the distance of the line from the lyrics
    \override TextSpanner.bound-details =
    #`((left . ((Y . 0)
                (padding . 0)
                (attach-dir . ,LEFT)))
       (left-broken . ((end-on-note . #t)))
       (right . ((Y . 0)
                 (padding . 0)
                 (attach-dir . ,RIGHT))))
  }
}

% This provides the result that I wanted

% Drums

eighthNotesDr = {
  \drummode { \repeat unfold 4 { < bd toml tomh >8 toml } } |
}

% Lyrics, with underlined part for both vocalists

words = \lyricmode {
  \skip 8 toe-4 \startTextSpan jam8 foot- ball, \stopTextSpan He8 got |
}

\score {
 \new DrumStaff <<
  \new DrumVoice { \voiceOne \eighthNotesDr }
  \new Lyrics { \words }
 >>
}

The output is:



Thanks to all once again!

*_Footnote_*

I'd like to mention that Ringo Starr always used a Ludwig drum kit with 3 toms. The LilyPond drumpitch-init.ly file for both LilyPond 2.24.0 and 2.25.21 has multiple options, including:
 drums-style (default)
 weinberg-drums-style
Both of these have the 'tomh' position as the top line, whereas the book "GUIDE TO Standardized Drumset Notation BY NORMAN WEINBERG" recommends the top space for a drum kit with 2 to 4 toms. This is probably because the reference in the drumpitch-init.ly file for Weinberg is based on a 1994 magazine article, whereas the book that I have was published in 1998 (ISBN 978-0-9664928-1-1). I attempted to rectify the Weinberg definition a couple of years ago, but no action was taken. I will work on an alternative definition, based on the book, which has recommendations for drum kits with up to 10 Toms, and will create a new post on that subject.

Again, I'd like to thank all in the lilypond-user for taking the time and effort to assist all music lovers.

Reply via email to