Holy smokes. This is a thing of beauty.

Thank you Aaron! Not everything notation can be automated away, and I'm
fine with the flexibility this offers.

Many thanks,
mattfong

On Mon, Oct 5, 2020 at 11:32 AM Aaron Hill <lilyp...@hillvisions.com> wrote:

> On 2020-10-05 10:35 am, Matthew Fong wrote:
> > Hello Aaron,
> >
> > Thank you for your help. That does make sense to me and works out quite
> > well -- I don't yet have a grasp how various commands and settings are
> > actually working in LilyPond. I found another example in the LilyPond
> > documentation that shows the internal representation. Where do I find
> > this
> > for input I want to inspect further?
> >
> http://lilypond.org/doc/v2.20/Documentation/extending/doubling-a-note-with-slurs-_0028example_0029
> >
> > I tested your syllable function with tweaks (like changing a notehead
> > to a
> > quilisma), and expressive marks like a tenuto. It appears the current
> > code
> > doesn't handle them (this is getting into advanced territory much more
> > quickly than I expected).
>
> Argh... I feared you might want to go in that direction.  Simple runs of
> pitches are rarely enough.  :/
>
> Here's a more generalized approach that modifies durations, preserving
> other events and properties:
>
> %%%%
> \version "2.20.0"
>
> syllable =
> #(define-music-function
>    (notes)
>    (ly:music?)
>    ;; Adjust this number to support longer runs of notes.
>    (define denominator 5)
>    (let ((dur (ly:make-duration 2 0 1 denominator))
>          (count 0)
>          (last '()))
>      (for-some-music
>        (lambda (m)
>          (if (music-is-of-type? m 'rhythmic-event)
>            (begin
>              (set! count (1+ count))
>              (set! last m)
>              (ly:music-set-property! m 'duration dur)
>              #t)
>            #f))
>        notes)
>      (if (ly:music? last)
>        (ly:music-set-property! last
>          'duration
>          (ly:make-duration 2 0
>            (- denominator (1- count))
>            denominator)))
>      notes))
>
> redNotes = \override NoteHead.color = #red
> { \time 1/4 \hide Staff.BarLine \omit Stem
>    \syllable { a'\( \melisma c'' b'\tenuto \melismaEnd }
>    \syllable { \redNotes a' b'\) \undo \redNotes }
>    \syllable { \breathe \[ a' c''\accent a'_( b') \] }
>    \syllable { b'\espressivo } }
> \addlyrics {
>    lor -- em _ i -- _ _ psum
> }
> %%%%
>
> There is much more flexibility at the cost of no longer automatically
> adding \melisma/\melisaEnd nor Slurs.  In fact, the example shows a
> PhrasingSlur starting in one "syllable" ending in the following.
>
> NOTE: This function does not handle chords properly.
>
>
> -- Aaron Hill
>

Reply via email to