lilypond-devel
[Top][All Lists]
Advanced

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

Re: music function to be included somewhere in scm/*


From: Alexander Kobel
Subject: Re: music function to be included somewhere in scm/*
Date: Wed, 14 Dec 2016 10:43:01 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Icedove/45.4.0

Hi Knut, hi all.

On 2016-12-14 10:16, Knut Petersen wrote:
Hi everybody!

There is a discussion on lilypond-user with the target to allow
automated lyric extenders to lilypond. One part of that is a patch
to clean and extend lyric_extender.cc.

Knut is playing down his work here. The crucial point: with his patch, there is no harm in adding lyric extenders everywhere, because they will not produce any output on non-melismata (unless overriden specifically). Also, the handling of extender's minimum-length is cleaned up.

To allow automated creation of lyric extenders a helper function is
needed

... that does exactly this, adding extenders everywhere.

IMHO, the actual question to decide upon is: Do we want this to be enabled by default? IIUC, the fact that extenders are not automatic is a known shortcoming. NR 2.1.1 states under "Known issues and warnings": "Extender lines under melismata are not created automatically; they must be inserted manually with a double underscore." (see http://lilypond.org/doc/v2.19/Documentation/notation/common-notation-for-vocal-music#multiple-notes-to-one-syllable)

With Knut's patch, this will mostly impact scores where extenders are left out unintentionally. Still, it will be a burden for convert-ly unless we have a global (or per lyric definition) \noAutomaticExtender rule that is inserted by default.

On the other hand, there is the chance to get rid of scores where users don't add extenders simply because they are not aware of their importance or the proper syntax.


Putting the
following code into a lilypond score does the job:

#(define autoextenders (define-music-function (lyrics) (ly:music?)
   (music-map
     (lambda (event)
       (if (and (eq? (ly:music-property event 'name) 'LyricEvent)
          (not (let* ((art (ly:music-property event 'articulations))
                      (is-hyphen? (lambda (ev) (eq? (ly:music-property
ev 'name) 'HyphenEvent))))
               (find is-hyphen? art)))
          (not (string=? (ly:music-property event 'text) " ")))
          (ly:music-set-property! event 'articulations
             (append (ly:music-property event 'articulations) (list
(make-music (quote ExtenderEvent))))) event )
     event)
   lyrics)))

Q1: Where should a definition of \autoextenders reside?
scm/music-functions.scm?

AFAICS: yes.

Q2: Obviously the definition of \autoextenders does not match the coding
style used in scm/*. It does not even
work if it is added to music-functions.scm. Some advice is needed ...
the extending-manual is not a real help in
this case.

I think you mixed up define-music-function and a plain Scheme define.
IIUC, define-music-function creates an anonymous function with some syntactic sugar (e.g., type-checking of the additional arguments past parser and location) which is then assigned to a variable:

function = #(define-music-function
             (parser location arg1 arg2)
             (arg1-type-check? arg2-type-check?)
             ...)

That's used in user space and relies on Lilypond's parser, for the assignment of the anonymous function. So if we use that, it must go to some .ly file with my original syntax; e.g. ly/lyrics-tkit.ly, is apt.

Otherwise, it can go to a .scm file as just
(define (autoextenders lyrics)
 (music-map ...))


Cheers,
Alexander



reply via email to

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