lilypond-user
[Top][All Lists]
Advanced

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

Re: LSR - Adding extra fingering with scheme - Needs update.


From: Thomas Morley
Subject: Re: LSR - Adding extra fingering with scheme - Needs update.
Date: Tue, 10 Sep 2013 00:33:48 +0200

2013/9/9 Thomas Morley <address@hidden>:
> 2013/9/9 Pierre Perol-Schneider <address@hidden>:
>> Hi list,
>>
>> Here's the snippet.
>> http://lsr.dsi.unimi.it/LSR/Item?id=83
>>
>> Seems that convert-ly does not help to make it work.
>>
>> Cheers,
>> Pierre
>
> Hi Pierre,
>
> Will have a look later.

Hi Pierre,

the code below seems to do the trick (v2.16.2 and v2.17.25).

One problem with this old snippet is the very short example (a far
more complex is added now), so I'm not sure which use-cases are
intended to adress and which not.

One limitation persists: In simultaneaous music the TextScript is added twice.
Note that I made the function more generic to accept markup.
Also, I added a commented hint to LSR-snippet 637 for centered TextScript.



\version "2.17.25"
\version "2.16.2"

%% If you want to center TextScript on NoteHeads, you may be interested in
%% http://lsr.dsi.unimi.it/LSR/Item?id=637

#(define (make-text-script x)
   (make-music 'TextScriptEvent
               'direction DOWN
               'text x))

#(define (add-text-script m x)
   (cond ((music-is-of-type? m 'event-chord)
          (set! (ly:music-property m 'elements)
                 (cons (make-text-script x)
                       (ly:music-property m 'elements))))
         ((music-is-of-type? m 'note-event)
          (set! (ly:music-property m 'articulations)
                 (cons (make-text-script x)
                       (ly:music-property m 'articulations))))
         (else (let ((es (ly:music-property m 'elements))
                     (e (ly:music-property m 'element)))
                 (map (lambda (y) (add-text-script y x)) es)
                 (if (ly:music? e)
                     (add-text-script e x))
                     )))
   m)

addScript =
#(define-music-function (parser location script music) (markup? ly:music?)
   (add-text-script music script))

\score {
  {
    \addScript \markup \rounded-box \center-column { \line { x y z }
"6" } { c'4-3 }
  }
}

\score {
  {
    \addScript \markup \fontsize #-3 \italic "6"
      {
        \repeat volta 2 {
          <c'-3 e'>4\( <d'-3>^"foo" e'( f'\3-2)
          \grace a'8 g'2~ g'\)
          <<
            { e''4 e'' e'' }
            \\
            { c''2 c''4 c'' }
          >>
        }
      }
  }
}

If noone comes up with a better solution I'll add it to the LSR
(unapproved), adding
"[corrected] [needs LSR-upgrade]"
to the title.


Cheers,
  Harm



reply via email to

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