lilypond-user
[Top][All Lists]
Advanced

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

Re: Function to add articulation to all notes


From: Caagr98
Subject: Re: Function to add articulation to all notes
Date: Thu, 28 Dec 2017 20:37:04 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0

That function seems rather destructive: removes all properties on existing 
articulations (including tweaks, direction, and midi stuff), and doesn't seem 
to handle anything other than ArticulationEvents at all. Dynamics, slurs, ties, 
etc are removed. Also, this version has no way to exclude a note from being 
articulated, unlike the earlier versions (where you can set 'articulations to 
an empty list to exclude it).

On 12/28/17 19:33, David Nalesnik wrote:
> Replying to the list with removal of some redundant code:
> 
> \version "2.19.65"
> 
> addArticulation =
> #(define-music-function (scripts music) (list? ly:music?)
>    (define (add mus)
>      (let* ((art (ly:music-property mus 'articulations))
>             (types (map (lambda (a) (ly:music-property a 'articulation-type))
>                      art))
>             (types (lset-union string=? types scripts)))
>        (ly:music-set-property!
>         mus 'articulations (map make-articulation types))))
>    (for-some-music
>     (lambda (mus)
>       (cond
>        ((music-is-of-type? mus 'event-chord) (add mus))
>        ((music-is-of-type? mus 'note-event) (add mus))
>        (else #f)))
>     music)
>    music)
> 
> {
>   \addArticulation #'("staccato" "accent") { c <c e g>-> d c'-! }
> }
> 
> HTH,
> David
> 
> _______________________________________________
> lilypond-user mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/lilypond-user
> 



reply via email to

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