Yeah, great! It excludes the ties and the rests too, that seems to be
perfect for me!
Thanks a lot!!

2008/6/2 Gilles THIBAULT <[EMAIL PROTECTED]>:

>
>
>
> #(define (addTenutoFilterFunction event)
>  (let ( (eventname (ly:music-property  event 'name)) )
>   (if (eq? eventname 'EventChord)
>     (let ( (elements (ly:music-property event 'elements)) )
>       ; don't add staccato to rests!
>       (if (not (eq? (ly:music-property (car elements) 'name) 'RestEvent))
>         (set! (ly:music-property event 'elements)
>           (append elements (list (make-music 'ArticulationEvent
> 'articulation-type "tenuto"))
>           ))))))
> )
>
> addTenuto = #(define-music-function (parser location music) (ly:music?)
>  (music-filter addTenutoFilterFunction music)
> )
>
> \new Staff \relative { \addTenuto { c d e f~ f e d c } }
>
>
> Could it be possible to exclude those notes, that follows the one with the
> tie?
>
> Yes but perhaps music-filter is not convenient for that because it gives
> you the differents events in a order : sub-elements, elements.
> here is a version which seems to work with ties.
> (i do not test it a lot)
>
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
>
> #(define tieEvent? #f)
>
> #(define (add-Tenuto music)
>  (let (
>     (eventname (ly:music-property  music 'name))
>     (elts (ly:music-property music 'elements))
>     (elt  (ly:music-property music 'element))
>  )
>  (cond
>     ((pair? elts)
>         (begin
>             (if (and
>                     (eq? eventname 'EventChord)
>                     (eq? (ly:music-property (car elts) 'name) 'NoteEvent)
>                     (not tieEvent?)
>                  )
>                 (set! (ly:music-property music 'elements)
>                         (append elts (list (make-music 'ArticulationEvent
> 'articulation-type "tenuto"))))
>                 (set! tieEvent? #f)
>             )
>             (map add-Tenuto elts)
>         )
>     )
>     ((ly:music? elt) (add-Tenuto elt))
>     ((eq? eventname 'TieEvent) (set! tieEvent? #t))
>  )
>  music
> ))
>
> addTenuto = #(define-music-function (parser location music) (ly:music?)
>  (set! tieEvent? #f)
>  (add-Tenuto music)
> )
>
>
> \new Staff \relative { \addTenuto { c d e f~ f e d c } }
>
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
>
> Gilles
>
_______________________________________________
lilypond-user mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to