lilypond-user
[Top][All Lists]
Advanced

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

Function to add articulation to all notes


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

Sometimes when having a long section of staccato, it's a bit tedious to add -. 
to all notes, so then it's useful to have a function which automatically adds 
an articulation to all notes. I have one such function here:

addArticulation =
#(define-music-function (event music) (ly:event? ly:music?)
   (music-map
    (lambda (mus)
     (if (music-is-of-type? mus 'note-event)
      (if (not (memq 'articulations ; Don't add staccato if there already exist 
an articulation
                     (map car (ly:music-mutable-properties mus))))
        (ly:music-set-property! mus 'articulations (list event))))
     mus)
    music))

However, this function adds the articulation to all notes in chords (leading to 
multiple staccato dots), which is not what I want. Is there any better way to 
do this?



reply via email to

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