lilypond-user
[Top][All Lists]
Advanced

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

Re: scheme function for staccato


From: Stefan Thomas
Subject: Re: scheme function for staccato
Date: Tue, 22 Apr 2008 22:26:38 +0200

Dear Mats,
thanks! It works fine and is an excellent tool for my work!

2008/4/22 Mats Bengtsson <address@hidden>:
It seems that the articulation event has to be added after the note event in order not to confuse
\relative. The following modification of Reinhold's code seems to work better.

% To modify a sequence of notes, it's easiest to use a filter:
#(define (addStaccatoFilterFunction 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 "staccato"))
          ))))))
)

addStaccato = #(define-music-function (parser location music) (ly:music?)
 (music-filter addStaccatoFilterFunction music)
)


For some reason it also works if you use Reinhold's code with
\addStaccato { \relative { ... }}
instead of
\relative { \addStaccato {...}}

  /Mats

Stefan Thomas wrote:
Dear Reinhold,
many thanks for Your very usefull plugin. It works fine!
But there is one thing in the below quoted example I don't understand : Why is the second g in the first measure an octave lower?
 I'm sure, I don't see something, which is  quite obvious, but I have no idea.

\version "2.11.43"

\relative { \addStaccato { c4 c g' g a a g4 r
f8 r f8 r e8 r e r d4 r c r } }
------------------------------------------------------------------------

 



reply via email to

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