Am Sonntag, 20. April 2008 schrieb Stefan Thomas:
> Dear Lilypond-users,
> I've read the explanation in the manual of version 2.10. about adding
> articulation to notes. I thougt, with his I could be able to simply add a
> staccato-dots to a group of notes, but unfortunately, it doesn't work as
> expected.
> Is there a  solution available?

The thing is that you apply the function to a SequentialMusic (i.e. a sequence 
of notes inside {...} ), so adding the staccato there has no effect...

I suppose the easiest way is to use a music filter on the SequentialMusic, 
which adds the ArticulationEvent to all EventChord descendents (but only if 
the EventChord does not contain a rest!). An example is attached.

Cheers,
Reinhold

-- 
------------------------------------------------------------------
Reinhold Kainhofer, Vienna University of Technology, Austria
email: [EMAIL PROTECTED], http://reinhold.kainhofer.com/
 * Financial and Actuarial Mathematics, TU Wien, http://www.fam.tuwien.ac.at/
 * K Desktop Environment, http://www.kde.org, KOrganizer maintainer
 * Chorvereinigung "Jung-Wien", http://www.jung-wien.at/

Attachment: add_staccato_scheme.pdf
Description: Adobe PDF document

\version "2.11.44"
\header { title = "Using scheme to add staccato to a sequence of notes" }

% 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)
            (cons (make-music 'ArticulationEvent 'articulation-type "staccato")
              elements
            ))))))
)

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

\score {
  <<
    \new Staff \relative { \addStaccato { c4 r4 c g' g a g2 f f <c e > <c e> <b d>2 r4 c } \bar"|." }
  >>
}
_______________________________________________
lilypond-user mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to