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: Wed, 11 Sep 2013 01:24:27 +0200

2013/9/10 David Kastrup <address@hidden>:
> Thomas Morley <address@hidden> writes:
>
>> #(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)
>                    (for-each ...
>>                  (if (ly:music? e)
>>                      (add-text-script e x))
>>                      )))
>>    m)
>
> #(define (add-text-script m x)
>    (define (append-property! music property element)
>      (set! (ly:music-property music property)
>            (append! (ly:music-property music property)
>                     (list element)))
>      music)
>    (map-some-music
>      (lambda (m)
>        (cond ((music-is-of-type m 'event-chord)
>               (append-property! m 'elements (make-text-script x)))
>              ((music-is-of-type m 'note-event)
>               (append-property! m 'articulations (make-text-script x)))
>              ;; don't recurse into other rhythmic events
>              ((music-is-of-type m 'rhythmic-event) m)
>              ;; recurse:
>              (else #f)))
>      m))
>
> That's the "proper" variant (as opposed to the original, it _returns_
> the modified music however).  One has to note that the improper variant
> will generally work as well: adding material to 'articulations works for
> both 'event-chord as well as 'note-event so one can drop the
> distinction.  It's not what LilyPond itself would do, however.
>
> Of course, not recursing into other rhythmic events is just an
> optimization that's not particularly important.
>
> --
> David Kastrup



Hi David,

first let me thank you for your code. It's by far better and more
elegant as my own.

While I was going to add a revised but unapproved snippet to the the
LSR marking it [needs upgrade],
http://lsr.dsi.unimi.it/LSR/Item?u=1&id=887
I noticed that the original snippet was tagged "docs" !

And indeed, I found it in /Documentation/snippets:
'adding-extra-fingering-with-scheme.ly'.
But not in /snippets/new
And it seems not to be in the online snippets-manual or elsewhere.
I thought even a broken, but compiling snippet should appear.
?

Cheers,
  Harm



reply via email to

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