lilypond-devel
[Top][All Lists]
Advanced

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

music function to be included somewhere in scm/*


From: Knut Petersen
Subject: music function to be included somewhere in scm/*
Date: Wed, 14 Dec 2016 10:16:13 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1

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.

To allow automated creation of lyric extenders a helper function is needed. 
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?

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.

Cheers,
 Knut



reply via email to

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