lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: aligning melisma and non-melisma lyrics across staves in the same sy


From: Thomas Morley
Subject: Re: aligning melisma and non-melisma lyrics across staves in the same system
Date: Sat, 28 Nov 2015 22:55:33 +0100

2015-11-26 14:58 GMT+01:00 Kieren MacMillan <address@hidden>:
> Hi David,
>
>> It's not clear which issues you even mean
>
> Perhaps my post of a week ago
>
>> If you look at <http://sourceforge.net/p/testlilyissues/issues/2450/>
>
>> you’ll see a list of other related issues.
>
> was not clear enough? If so, please explain how I can make it more explicit 
> which issues I’m asking to sponsor.
>
> Regards,
> Kieren.


Hi Kieren,

in general we have not enough developers (not new, I know), more
specifically: most of the work for lyrics should be done in C++ (which
will put some more people off, like me).

That said, you need to "seduce" people to work on your favourite bugs,
issues, enhancements, etc, you surely don't won't to scare them away.

Speaking only for myself, I work on LilyPond in my spare leisure time.
I try to read every mail on the mailing-lists.
Though, as a non-native speaker with more limited english vocabulary
and grammar than I'd wish, I'm scared away from any lengthy mail and
tend to delete them. Also, a request without code-example is a no-go,
I tend to delete them. If I'm not interested, I tend to delete them.
etc
If I start work on a user-problem, I need feed-back: Does it work as
expected? Are there issues? When? Under which circumstances, etc, etc.
Quite often I have gotten _no_ feed-back. This may result in next time
putting even an interesting problem of that user at the very bottom of
my lists of things I could work on.


If you want to attract me working on some of your most pressing
issues, please write short, add a compilable code-example (no link)
and give feed-back.

Your initial post in this thread is a good example. I (hopefully)
understood it and a short example is part of it.
Thus I worked on it, although it might be only a workaround.

One problem with the code is still in need to be discussed:
Look at the example of the code below. How should the lyrics of third
Staff be aligned?
For now aligning is disabled there, \once setting the new defined
'align-to-melisma false, resulting in centered syllables.
Maybe affecting 'self-alignment-X is the wrong method at all, instead
I could probably set 'X-offset.
Feedback needed ;)

But here the code:


\version "2.19.32"

%%%%%%%%%%%%%%%%%%%%%%%%%
%% CUSTOM-GROB-PROPERTY
%%%%%%%%%%%%%%%%%%%%%%%%%

#(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)

#(define my-custom-grob-properties
  `(
    (align-to-melisma ,boolean? "Should LyricText be aligned to other LyricText
being in melisma?")
   ))

#(define (acknowledge-my-grob-properties lst)
  (for-each (lambda (x) (apply define-grob-property x)) lst))

#(acknowledge-my-grob-properties my-custom-grob-properties)

%%%%%%%%%%%%%%%%%%%%%%%%%
%% ENGRAVER
%%%%%%%%%%%%%%%%%%%%%%%%%

#(define (align-to-melisma-engraver ctx)
"
To be put in Score-context.
Collects all Voices, gets knowledge whether a melisma is active.
If a melisma is active, every LyricText's `self-alignment-X' is set to the value
of `lyricMelismaAlignment' unless `align-to-melisma' is set #f.
"
   (let ((voices '())
         ;; currently not needed:
         ;(lyrics '())
         (melisma? #f))
     `(
       (acknowledgers
         (lyric-syllable-interface
          . ,(lambda (engraver grob source-engraver)
               (let ((lyric-melisma-alignment
                       (ly:context-property ctx 'lyricMelismaAlignment))
                     (align-to-melisma?
                       (ly:grob-property grob 'align-to-melisma #t)))
                 (if (and melisma? align-to-melisma?)
                     (ly:grob-set-property!
                       grob 'self-alignment-X lyric-melisma-alignment))))))

       (listeners
         ;; TODO: don't forget `RemoveContext'
         ;; Thanks to David K
         (AnnounceNewContext
           .
           ,(lambda (engraver event)
              (let ((context (ly:event-property event 'context)))
               ;; currently not needed:
               ;(if (eq? (ly:context-name context) 'Lyrics)
               ;    (set! lyrics (cons context lyrics)))
               (if (eq? (ly:context-name context) 'Voice)
                   (set! voices (cons context voices)))))))

       (process-music
        . ,(lambda (trans)
             (let ((melisma-props
                     (ly:context-property ctx 'melismaBusyProperties)))
               (for-each
                 (lambda (voice)
                   (for-each
                     (lambda (prop)
                       (let ((mlsm (ly:context-property voice prop #f)))
                         (if mlsm (set! melisma? #t))))
                     melisma-props))
                 voices))))

       (stop-translation-timestep
        . ,(lambda (trans)
             (set! melisma? #f))))))

%% Short-cut:
%% don't align next syllable to a melisma by `align-to-melisma-engraver'
do-not-align-me =
  \once \override LyricText.align-to-melisma = ##f

%%%%%%%%%%%%%%%%%%%%%%%%%
%% EXAMPLE
%%%%%%%%%%%%%%%%%%%%%%%%%

my-layout =
  \layout {
    \context {
      \Score
      \consists #align-to-melisma-engraver
      lyricMelismaAlignment = -0.5
    }
  }

one =
  \new Staff
    \new Voice {
      c''1( d'')
      \set Score.lyricMelismaAlignment = -2.5
      e''( f''2) e''
    }
  \addlyrics {  "Left-1" __ "Left-1" __ }

two =
  \new Staff
    \new Voice {
      c''1
      d''
      e''
      f''2
      e''
    }
  \addlyrics {
    "Left-2"
    too!
    "Left-2"
    too!
  }

three =
  \new Staff
    \new Voice = "3" {
      c'1 d' e' f'
    }
  \addlyrics {
    \do-not-align-me
    one
    two
    \do-not-align-me
    three
    four
  }

\score {
  <<
    \one
    \two
    \three
  >>
  \my-layout
}

Code and png attached as well.


Cheers,
  Harm

P.S.
Now I'm guilty having written a lengthy mail myself, must be the
largest i ever wrote

Attachment: melisma-align-02.png
Description: PNG image

Attachment: melisma-align-02.ly
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]