Hi David

2011/9/24 David Nalesnik <david.nales...@gmail.com>

> Hi Harm,
>
>>
> Thanks for the insight!
>
> So then you could do something like this:
>

I tried, but without success. :)

\version "2.14.2"
>

> #(define (padding-for-tenuto x)
>    (lambda (grob)
>      (if (equal? "tenuto" (ly:prob-property (assoc-ref (ly:grob-properties
> grob) 'cause) 'articulation-type))
>          (ly:grob-set-property! grob 'padding x)
>          '())))
>
> #(define (custom-articulation-padding type x)
>    (lambda (grob)
>      (if (equal? type (ly:prob-property (assoc-ref (ly:grob-properties
> grob) 'cause) 'articulation-type))
>          (ly:grob-set-property! grob 'padding x)
>          '())))
>
> \relative c'' {
>   \once \override  Script #'after-line-breaking = #(padding-for-tenuto
> 0.75)
>   f1--
>   f1--
>   \override Script #'after-line-breaking = #(custom-articulation-padding
> "accent" 1)
>   f->
>   f->
>   \revert Script #'after-line-breaking
>   f->
> }
>
> I don't know if I've gotten at the name of the articulation in the best
> way, but this works.  One drawback is that there can only be one override of
> 'after-line-breaking at a time.
>

'before-line-breaking works too (see code below).


> So, if you want multiple changes to default values -- a change to tenuto, a
> change to accent, etc. -- these should be added as conditions to the
> function.  The second function lets you plug in the name of the articulation
> you want to override.
>

I did it this way:

\version "2.14.2"

#(define my-script-alist '(
    ("staccato" . (font-size . 15))
    ("accent" . (font-size . 4))
    ("tenuto" . (rotation . (45 0 0)))
    ("staccatissimo" . (padding . 2))
    ))

#(define ((custom-script-tweaks type) grob)
   (map (lambda (arg)
     (let ((lst (assoc-ref my-script-alist arg)))
        (if (equal? arg (ly:prob-property (assoc-ref (ly:grob-properties
grob) 'cause) 'articulation-type))
            (ly:grob-set-property! grob (car lst) (cdr lst))
            '())))
   type))

#(define (custom-articulation-tweaks type property x)
   (lambda (grob)
     (if (equal? type (ly:prob-property (assoc-ref (ly:grob-properties grob)
'cause) 'articulation-type))
         (ly:grob-set-property! grob property x)
         '())))

\relative c'' {
  f1--
  f1--
  \override  Script #'after-line-breaking =
      #(custom-articulation-tweaks "accent" 'color red)
  \override  Script #'before-line-breaking =
      #(custom-script-tweaks '("staccato" "tenuto" "accent"
"staccatissimo"))

  f-. f-| f-> f-> f-- f-|
  \revert Script #'after-line-breaking
  \revert Script #'before-line-breaking
  f-> f-.
}

To override "accent" I used the second function with 'before-line-breaking.
I'd prefer to store several properties in an alist, but I couldn't figure
out how to read-out and call.

p.e.:
#(define ls '(
    ("staccato" . ((color . (1 0 0))))
    ("accent" . ((font-size . 4)(color . (1 0 0))))
    ("tenuto" . ((rotation . (45 0 0))))
    ("staccatissimo" . ((padding . -10) (color . (1 0 0))))
    ))

Any idea?

Best,
  Harm
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to